Skip to content

Commit 709448d

Browse files
committed
Finished cpp
1 parent 87b8531 commit 709448d

File tree

2 files changed

+11
-7
lines changed
  • exercises/static/exercises/follow_line/cpp_template/ros2_humble
  • react_frontend/src/constants

2 files changed

+11
-7
lines changed

exercises/static/exercises/follow_line/cpp_template/ros2_humble/WebGUI.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "HAL.hpp"
1717
#include "Lap.hpp"
1818
#include <utility>
19+
#include <iomanip>
20+
#include <sstream>
1921

2022
namespace beast = boost::beast;
2123
namespace http = beast::http;
@@ -197,7 +199,11 @@ class session : public std::enable_shared_from_this<session>
197199

198200
auto pose = HAL::get_pose();
199201
const json map = json{pose.at(0), pose.at(1)};
200-
const json j = json{{"map", map.dump()}, {"image", WebGUI::img_payload}, {"lap", lap_->getLapTime()}, {"brain", 20}, {"gui", 20}, {"rtf", (float) HAL::get_performance()}, {"fps", -1}, {"lat", -1}};
202+
double rtf = HAL::get_performance();
203+
std::stringstream stream;
204+
stream << std::fixed << std::setprecision(2) << rtf;
205+
std::string rtf_str = stream.str();
206+
const json j = json{{"map", map.dump()}, {"image", WebGUI::img_payload}, {"lap", lap_->getLapTime()}, {"brain", 20}, {"gui", 20}, {"rtf", rtf_str}, {"fps", -1}, {"lat", -1}};
201207
auto const text = j.dump();
202208

203209
// Close the WebSocket connection

react_frontend/src/constants/code.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ while True:
1111
export const defaultCppCode = `#include "HAL.hpp"
1212
#include "WebGUI.hpp"
1313
#include "Frequency.hpp"
14-
#include "opencv2/opencv.hpp"
1514
1615
void exercise() {
1716
Frequency freq = Frequency();
17+
// Enter sequential code!
1818
1919
while (true)
2020
{
21+
// Enter iterative code!
2122
freq.tick();
22-
cv::Mat img = HAL::get_image();
23-
WebGUI::show_image(img);
24-
HAL::set_v(1.0f);
25-
HAL::set_w(1.0f);
23+
24+
2625
}
2726
}
28-
2927
`;

0 commit comments

Comments
 (0)