@@ -79,7 +79,7 @@ using BufferVariant = std::variant<
79
79
ControlCommandBuffer, TrajectoryBuffer, PointCloud2Buffer, PredictedObjectsBuffer,
80
80
DetectedObjectsBuffer>;
81
81
82
- enum class MessageType {
82
+ enum class SubscriberMessageType {
83
83
Unknown = 0 ,
84
84
AckermannControlCommand = 1 ,
85
85
Trajectory = 2 ,
@@ -88,11 +88,31 @@ enum class MessageType {
88
88
PredictedObjects = 5 ,
89
89
};
90
90
91
+ enum class PublisherMessageType {
92
+ Unknown = 0 ,
93
+ CameraInfo = 1 ,
94
+ Image = 2 ,
95
+ PointCloud2 = 3 ,
96
+ PoseWithCovarianceStamped = 4 ,
97
+ Imu = 5 ,
98
+ ControlModeReport = 6 ,
99
+ GearReport = 7 ,
100
+ HazardLightsReport = 8 ,
101
+ SteeringReport = 9 ,
102
+ TurnIndicatorsReport = 10 ,
103
+ VelocityReport = 11 ,
104
+ };
105
+
106
+ enum class RunningMode {
107
+ PerceptionPlanning = 0 ,
108
+ PlanningControl = 1 ,
109
+ };
110
+
91
111
struct TopicConfig
92
112
{
93
113
std::string node_name;
94
114
std::string topic_address;
95
- MessageType message_type;
115
+ SubscriberMessageType message_type;
96
116
};
97
117
98
118
using ChainModules = std::vector<TopicConfig>;
@@ -120,29 +140,32 @@ struct EntityParams
120
140
double z_l;
121
141
};
122
142
123
- struct NodeParams
143
+ struct GeneralParams
124
144
{
145
+ std::string running_mode;
125
146
double timer_period;
147
+ double object_search_radius_offset;
148
+ EntityParams entity_params;
149
+ PoseParams goal_pose;
150
+ };
151
+
152
+ struct PerceptionPlanningModeParams
153
+ {
154
+ std::string path_bag_without_object;
155
+ std::string path_bag_with_object;
156
+ bool publish_pointcloud_synchronically;
157
+ double synchronic_pointcloud_publishing_period;
158
+ double spawn_time_after_init;
159
+ };
160
+
161
+ struct PlanningControlModeParams
162
+ {
126
163
double spawn_distance_threshold;
164
+ double spawned_pointcloud_sampling_distance;
127
165
double control_cmd_buffer_time_interval;
128
166
double min_jerk_for_brake_cmd;
129
- int min_number_descending_order_control_cmd;
130
- bool run_from_bag;
131
- };
132
-
133
- enum class PublisherMessageType {
134
- Unknown = 0 ,
135
- CameraInfo = 1 ,
136
- Image = 2 ,
137
- PointCloud2 = 3 ,
138
- PoseWithCovarianceStamped = 4 ,
139
- Imu = 5 ,
140
- ControlModeReport = 6 ,
141
- GearReport = 7 ,
142
- HazardLightsReport = 8 ,
143
- SteeringReport = 9 ,
144
- TurnIndicatorsReport = 10 ,
145
- VelocityReport = 11 ,
167
+ size_t min_number_descending_order_control_cmd;
168
+ PoseParams initial_pose;
146
169
};
147
170
148
171
template <typename MessageType>
@@ -283,26 +306,26 @@ class ReactionAnalyzerNode : public rclcpp::Node
283
306
284
307
private:
285
308
std::mutex mutex_;
309
+ RunningMode node_running_mode_;
286
310
287
311
// Parameters
288
- EntityParams entity_params_;
289
- PoseParams initial_pose_params_;
290
- PoseParams goal_pose_params_;
291
- NodeParams node_params_;
292
- double entity_search_radius_;
312
+ GeneralParams general_params_;
313
+ PerceptionPlanningModeParams perception_planning_mode_params_;
314
+ PlanningControlModeParams planning_control_mode_params_;
293
315
294
316
// TEMP
295
- void genericMessagePublisherTimer (const std::string & topic_name);
317
+ void genericMessagePublisher (const std::string & topic_name);
296
318
std::unordered_map<std::string, PublisherVariablesVariant> topic_publisher_map_;
297
319
std::vector<PublisherVariables<PointCloud2>> sync_pointcloud_publishers_;
298
- bool publish_pointcloud_sync_{true };
299
- void publishAllPointClouds ();
320
+ void syncPointcloudPublisher ();
300
321
rclcpp::TimerBase::SharedPtr sync_pointcloud_publish_timer_;
322
+ void initRosbagPublishers ();
301
323
302
324
// Initialization Variables
303
325
geometry_msgs::msg::Pose entity_pose_;
304
326
geometry_msgs::msg::PoseWithCovarianceStamped init_pose_;
305
327
geometry_msgs::msg::PoseStamped goal_pose_;
328
+ double entity_search_radius_;
306
329
307
330
// Subscribers
308
331
rclcpp::Subscription<Odometry>::SharedPtr sub_kinematics_;
@@ -331,7 +354,7 @@ class ReactionAnalyzerNode : public rclcpp::Node
331
354
332
355
bool loadChainModules ();
333
356
334
- bool initObservers (const ChainModules & modules);
357
+ bool initSubscribers (const reaction_analyzer:: ChainModules & modules);
335
358
336
359
void initAnalyzerVariables ();
337
360
@@ -358,29 +381,29 @@ class ReactionAnalyzerNode : public rclcpp::Node
358
381
void onTimer ();
359
382
360
383
// Callbacks
361
- void vehiclePoseCallback (const Odometry::ConstSharedPtr msg_ptr);
384
+ void vehiclePoseCallback (Odometry::ConstSharedPtr msg_ptr);
362
385
363
- void initializationStateCallback (const LocalizationInitializationState::ConstSharedPtr msg_ptr);
386
+ void initializationStateCallback (LocalizationInitializationState::ConstSharedPtr msg_ptr);
364
387
365
- void routeStateCallback (const RouteState::ConstSharedPtr msg);
388
+ void routeStateCallback (RouteState::ConstSharedPtr msg);
366
389
367
- void operationModeCallback (const OperationModeState::ConstSharedPtr msg_ptr);
390
+ void operationModeCallback (OperationModeState::ConstSharedPtr msg_ptr);
368
391
369
392
// Callbacks for modules are observed
370
393
void controlCommandOutputCallback (
371
- const std::string & node_name, const AckermannControlCommand::ConstSharedPtr msg_ptr);
394
+ const std::string & node_name, const AckermannControlCommand::ConstSharedPtr& msg_ptr);
372
395
373
396
void trajectoryOutputCallback (
374
- const std::string & node_name, const Trajectory::ConstSharedPtr msg_ptr);
397
+ const std::string & node_name, const Trajectory::ConstSharedPtr& msg_ptr);
375
398
376
399
void pointcloud2OutputCallback (
377
- const std::string & node_name, const PointCloud2::ConstSharedPtr msg_ptr);
400
+ const std::string & node_name, const PointCloud2::ConstSharedPtr& msg_ptr);
378
401
379
402
void predictedObjectsOutputCallback (
380
- const std::string & node_name, const PredictedObjects::ConstSharedPtr msg_ptr);
403
+ const std::string & node_name, const PredictedObjects::ConstSharedPtr& msg_ptr);
381
404
382
405
void detectedObjectsOutputCallback (
383
- const std::string & node_name, const DetectedObjects::ConstSharedPtr msg_ptr);
406
+ const std::string & node_name, const DetectedObjects::ConstSharedPtr& msg_ptr);
384
407
385
408
// Variables
386
409
std::vector<rclcpp::SubscriptionBase::SharedPtr> subscribers_;
0 commit comments