1+ #ifndef INCLUDE_WEBGUI_HPP_
2+ #define INCLUDE_WEBGUI_HPP_
3+
4+ #include < boost/beast/core.hpp>
5+ #include < boost/beast/websocket.hpp>
6+ #include < boost/asio/connect.hpp>
7+ #include < boost/asio/ip/tcp.hpp>
8+ #include < boost/asio/strand.hpp>
9+ #include < nlohmann/json.hpp>
10+ #include " rclcpp/rclcpp.hpp"
11+ #include " geometry_msgs/msg/point.hpp"
12+ #include " std_msgs/msg/bool.hpp"
13+ #include " common_interfaces_cpp/hal/odometry.hpp"
14+ #include " common_interfaces_cpp/hal/laser.hpp"
15+ #include " Map.hpp"
16+ #include " Lap.hpp"
17+
18+ namespace beast = boost::beast;
19+ namespace websocket = beast::websocket;
20+ namespace net = boost::asio;
21+ using tcp = net::ip::tcp;
22+ using json = nlohmann::json;
23+
24+ class WebGUI {
25+ public:
26+ WebGUI ();
27+ static void showForces (const std::vector<double >& v1, const std::vector<double >& v2, const std::vector<double >& v3);
28+ static void showLocalTarget (const std::vector<double >& v);
29+ static std::shared_ptr<Target> getNextTarget ();
30+ static void setTargetx (double x);
31+ static void setTargety (double y);
32+ };
33+
34+ class WebGUINode : public rclcpp ::Node {
35+ public:
36+ WebGUINode ();
37+ static std::shared_ptr<Map> map_;
38+ static std::shared_ptr<Lap> lap_;
39+
40+ static std::shared_ptr<OdometryNode> pose3d_node_;
41+ static std::shared_ptr<LaserNode> laser_node_;
42+
43+ void publish_current_target ();
44+
45+ private:
46+ void target_reached_callback (std_msgs::msg::Bool::UniquePtr msg);
47+
48+ rclcpp::Subscription<geometry_msgs::msg::Point>::SharedPtr sub_car_;
49+ rclcpp::Subscription<geometry_msgs::msg::Point>::SharedPtr sub_obs_;
50+ rclcpp::Subscription<geometry_msgs::msg::Point>::SharedPtr sub_avg_;
51+ rclcpp::Subscription<geometry_msgs::msg::Point>::SharedPtr sub_target_;
52+ rclcpp::Subscription<std_msgs::msg::Bool>::SharedPtr sub_reached_;
53+ rclcpp::Publisher<geometry_msgs::msg::Point>::SharedPtr pub_current_target_;
54+
55+ std::shared_ptr<Target> current_target_obj_;
56+ };
57+
58+ #endif
0 commit comments