27#include <boost/thread/locks.hpp>
28#include <boost/thread/shared_mutex.hpp>
30#include "absl/strings/str_cat.h"
32#include "modules/common_msgs/task_manager_msgs/task_manager.pb.h"
33#include "modules/common_msgs/external_command_msgs/lane_follow_command.pb.h"
34#include "modules/common_msgs/external_command_msgs/valet_parking_command.pb.h"
35#include "modules/common_msgs/external_command_msgs/action_command.pb.h"
36#include "modules/dreamview_plus/proto/data_handler.pb.h"
44#include "modules/common_msgs/localization_msgs/localization.pb.h"
61class SimulationWorldUpdater :
public UpdaterBase {
73 WebSocketHandler *plugin_ws,
74 const MapService *map_service,
76 WebSocketHandler *sim_world_ws, HMI *hmi,
77 bool routing_from_file =
false);
83 const std::string &channel_name =
"",
84 nlohmann::json *subscribe_param =
nullptr)
override;
85 void StopStream(
const std::string &channel_name =
"")
override;
86 void PublishMessage(
const std::string &channel_name =
"")
override;
98 void OnTimer(
const std::string &channel_name =
"");
106 bool ConstructLaneFollowCommand(
107 const nlohmann::json &json,
116 bool ConstructValetParkingCommand(
117 const nlohmann::json &json,
119 const std::string &parking_space_id);
126 nlohmann::json GetConstructRoutingRequestJson(
const nlohmann::json &start,
127 const nlohmann::json &end);
135 bool ConstructLaneWayPoint(
const nlohmann::json &point,
137 std::string description);
139 bool ValidateCoordinate(
const nlohmann::json &json);
147 bool CheckRoutingPoint(
const nlohmann::json &json, nlohmann::json &result);
161 nlohmann::json GetPointJsonFromLaneWaypoint(
169 bool LoadUserDefinedRoutings(
const std::string &file_name,
170 google::protobuf::Message *message);
178 bool AddDefaultRouting(
const nlohmann::json &json);
186 bool DeleteDefaultRouting(
const std::string &routing_name);
198 void RegisterMessageHandlers();
199 void RegisterRoutingMessageHandlers();
206 std::unique_ptr<PluginManager> plugin_manager_ =
nullptr;
222 std::string simulation_world_with_planning_data_;
225 std::string relative_map_string_;
229 boost::shared_mutex mutex_;
231 std::unique_ptr<cyber::Timer> timer_;
233 volatile double last_pushed_adc_timestamp_sec_ = 0.0f;
237 uint64_t command_id_;
A module that maintains all dv-related plugin information.
This is a major component of the Simulation backend, which maintains a SimulationWorld object and kee...
void StartStream(const double &time_interval_ms, const std::string &channel_name="", nlohmann::json *subscribe_param=nullptr) override
Starts to push simulation_world to frontend.
void PublishMessage(const std::string &channel_name="") override
Publish Message to dreamview frontend.
double LastAdcTimestampSec()
SimulationWorldUpdater(WebSocketHandler *websocket, WebSocketHandler *map_ws, WebSocketHandler *camera_ws, WebSocketHandler *plugin_ws, const MapService *map_service, PerceptionCameraUpdater *perception_camera_updater, PluginManager *plugin_manager, bool routing_from_file=false)
Constructor with the websocket handler.
void StopStream(const std::string &channel_name="") override
Stop data flow.
The WebSocketHandler, built on top of CivetWebSocketHandler, is a websocket handler that handles diff...
SocketManager to manage all websocket