Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
node_ros_pubsub_wrapper.hpp
Go to the documentation of this file.
1 #ifndef NODE_ROS_PUBSUB_WRAPPER_H
2 #define NODE_ROS_PUBSUB_WRAPPER_H
3 
4 #pragma GCC diagnostic ignored "-Wunused-function"
5 #pragma GCC diagnostic ignored "-Wunused-variable"
6 
7 #include "rclcpp/rclcpp.hpp"
8 #include <galaxis/messages.hpp>
9 #include <galaxis/Errors.hpp>
10 #include <galaxis/utilities.hpp>
11 #include <string>
12 #include "rmw/types.h"
13 
14 namespace galaxis {
15  namespace ros {
16  namespace {
17  const char* TOPIC_MEASUREMENT = "measurements";
18  const char* TOPIC_MOTION = "motion";
19  const char* TOPIC_LIGHTS = "lights";
20  const char* TOPIC_SERVICESTATE = "servicestate";
21  const char* TOPIC_PATHPOLYNOM = "pathpolynom";
22  const char* TOPIC_SETTINGSVALUES = "settingsvalues";
23  const char* TOPIC_DEBUGPOLYNOM = "debugpolynom";
24  const char* TOPIC_IDENTIFICATION = "identification";
25  const char* TOPIC_POINTSLIST = "pointslist";
26  const char* TOPIC_MARVELMINDCONTROL = "marvelmindcontrol";
27  const char* TOPIC_DEBUGCONTROLLER = "debugcontroller";
28  const char* TOPIC_MARVELMIND = "marvelmind";
29  const char* TOPIC_HEARTBEAT = "heartbeat";
30  const char* TOPIC_OBJECTVECTOR = "objects_vector";
31  const char* TOPIC_BUTTON_STATE = "buttonState";
32  const char* TOPIC_DEBUGMAPDATA = "/galaxis/map/debug/data";
33  const char* TOPIC_CONTROLLERREF = "/galaxis/controller/reference";
34  const char* TOPIC_OBSTACLES = "/galaxis/objectdetection/obstacles";
35  const char* TOPIC_CAR_POSE = "/galaxis/ap/carpose";
36  const char* TOPIC_SYSTEM_SETTINGS = "/galaxis/systemsettings";
37  const char* TOPIC_QR_CODE_DETECTTION= "/galaxis/qrcodedetection/state";
38  const char* TOPIC_STOP_LINE = "/galaxis/stopline";
39  const char* TOPIC_PARKING_STATE = "/galaxis/parking/state";
40  const char* TOPIC_PARKING_OPERATION = "/galaxis/ap/parkingoperation";
41 
42 
43  // separate Topics (without functions)
44  const char* TOPIC_CAMERA_RAW = "/galaxis/camera_raw";
45  const char* TOPIC_CAMERA_RAW_BE = "/galaxis/camera_raw/best_effort";
46  const char* TOPIC_CAMERA_COMPRESSED = "/galaxis/camera_compressed";
47  const char* TOPIC_VCI_LANE_IMAGE = "/galaxis/laneimage";
48  const char* TOPIC_VCI_LANE_IMAGE_SIMULATION = "/galaxis/simulation/laneimage";
49  const char* TOPIC_AP_DATA_IMAGE_DEBUG = "/galaxis/debug/ap/map/lanes";
50  const char* TOPIC_AP_FULL_MAP_DATA_IMAGE_DEBUG = "/galaxis/debug/ap/map/full";
51  const char* TOPIC_AP_DRIVE_LANE_DEBUG = "/galaxis/debug/ap/drivelanes";
52  const char* TOPIC_AP_CONTROLLER_DATA_DEBUG = "/galaxis/debug/controller/trajectory";
53  const char* TOPIC_STOP_LINE_IMAGE = "/galaxis/stoplineimage";
54  const char* TOPIC_START_LINE_IMAGE = "/galaxis/startline/debug";
55  const char* TOPIC_STOP_LINE_IMAGE_RIGHT = "/galaxis/stoplineimageright";
56  const char* TOPIC_STOP_LINE_IMAGE_LEFT = "/galaxis/stoplineimageleft";
57  const char* TOPIC_STOP_LINE_IMAGE_RIGHT_BORDER = "/galaxis/stoplineimagerightborder";
58 
59  enum QoS_Profile_t {
60  QOS_DEFAULT = 0,
61  QOS_BEST_EFFORT = 1,
62  QOS_RELIABLE = 2
63  };
64 
65  static const rmw_qos_profile_t qos_profile_default = {
66  RMW_QOS_POLICY_HISTORY_KEEP_LAST,
67  1,
68  RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
69  RMW_QOS_POLICY_DURABILITY_VOLATILE,
70  RMW_QOS_DEADLINE_DEFAULT,
71  RMW_QOS_LIFESPAN_DEFAULT,
72  RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
73  RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
74  false
75  };
76 
77  static const rmw_qos_profile_t qos_profile_reliable = {
78  RMW_QOS_POLICY_HISTORY_KEEP_LAST,
79  1,
80  RMW_QOS_POLICY_RELIABILITY_RELIABLE,
81  RMW_QOS_POLICY_DURABILITY_VOLATILE,
82  RMW_QOS_DEADLINE_DEFAULT,
83  RMW_QOS_LIFESPAN_DEFAULT,
84  RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
85  RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
86  false
87  };
88 
89  rclcpp::QoS get_qos_profile(QoS_Profile_t p_qos_settings) {
90  rclcpp::QoS qos_params = rclcpp::QoS(rclcpp::KeepLast(1), qos_profile_default);
91 
92  switch(p_qos_settings) {
93  case QOS_BEST_EFFORT:
94  qos_params = rclcpp::QoS(rclcpp::KeepLast(1), qos_profile_default);
95  break;
96  case QOS_RELIABLE:
97  qos_params = rclcpp::QoS(rclcpp::KeepLast(1), qos_profile_reliable);
98  break;
99  default:
100  //TODO galaxis::log("Wrong qos setting in get_qos_profile, using QOS_DEFAULT setting");
101  break;
102  }
103 
104  return qos_params;
105  }
106 
107  // Subscriber Measurements
108  template <typename CallbackT>
109  void create_subscription(
110  rclcpp::Node* p_nodePtr,
111  rclcpp::Subscription<MeasurementsType>::SharedPtr& p_subSPtr,
112  CallbackT&& p_bind) {
113  if(p_nodePtr == nullptr) {
115  }
116  std::string topic = TOPIC_MEASUREMENT;
117 
118  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
119 
120  p_subSPtr = p_nodePtr->create_subscription<MeasurementsType>(topic, qos_params, p_bind);
121  }
122 
123  // Publisher Measurements
124  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<MeasurementsType>::SharedPtr& p_pubSPtr) {
125  if(p_nodePtr == nullptr) {
127  }
128  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
129  std::string topic = TOPIC_MEASUREMENT;
130  p_pubSPtr = p_nodePtr->create_publisher<MeasurementsType>(topic, qos_params);
131  }
132 
133  // Subscriber ControlMotion
134  template <typename CallbackT>
135  void create_subscription(
136  rclcpp::Node* p_nodePtr,
137  rclcpp::Subscription<ControlMotionType>::SharedPtr& p_subSPtr,
138  CallbackT&& p_bind) {
139  if(p_nodePtr == nullptr) {
141  }
142  std::string topic = TOPIC_MOTION;
143 
144  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
145 
146  p_subSPtr = p_nodePtr->create_subscription<ControlMotionType>(topic, qos_params, p_bind);
147  }
148 
149  // Publisher ControlMotion
150  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ControlMotionType>::SharedPtr& p_pubSPtr) {
151  if(p_nodePtr == nullptr) {
153  }
154  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
155  std::string topic = TOPIC_MOTION;
156  p_pubSPtr = p_nodePtr->create_publisher<ControlMotionType>(topic, qos_params);
157  }
158 
159  // Subscriber Pathpolynom
160  template <typename CallbackT>
161  void create_subscription(
162  rclcpp::Node* p_nodePtr,
163  rclcpp::Subscription<PathpolynomType>::SharedPtr& p_subSPtr,
164  CallbackT&& p_bind) {
165  if(p_nodePtr == nullptr) {
167  }
168  std::string topic = TOPIC_PATHPOLYNOM;
169 
170  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
171 
172  p_subSPtr = p_nodePtr->create_subscription<PathpolynomType>(topic, qos_params, p_bind);
173  }
174 
175  // Publisher Pathpolynom
176  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<PathpolynomType>::SharedPtr& p_pubSPtr) {
177  if(p_nodePtr == nullptr) {
179  }
180  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
181  std::string topic = TOPIC_PATHPOLYNOM;
182  p_pubSPtr = p_nodePtr->create_publisher<PathpolynomType>(topic, qos_params);
183  }
184 
185  // Subscriber DebugPolynom
186  template <typename CallbackT>
187  void create_subscription(
188  rclcpp::Node* p_nodePtr,
189  rclcpp::Subscription<DebugPolynomType>::SharedPtr& p_subSPtr,
190  CallbackT&& p_bind) {
191  if(p_nodePtr == nullptr) {
193  }
194  std::string topic = TOPIC_DEBUGPOLYNOM;
195 
196  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
197 
198  p_subSPtr = p_nodePtr->create_subscription<DebugPolynomType>(topic, qos_params, p_bind);
199  }
200 
201  // Publisher DebugPolynom
202  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<DebugPolynomType>::SharedPtr& p_pubSPtr) {
203  if(p_nodePtr == nullptr) {
205  }
206  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
207  std::string topic = TOPIC_DEBUGPOLYNOM;
208  p_pubSPtr = p_nodePtr->create_publisher<DebugPolynomType>(topic, qos_params);
209  }
210 
211  // Subscriber Settingsvalues
212  template <typename CallbackT>
213  void create_subscription(
214  rclcpp::Node* p_nodePtr,
215  rclcpp::Subscription<SettingsValuesType>::SharedPtr& p_subSPtr,
216  CallbackT&& p_bind) {
217  if(p_nodePtr == nullptr) {
219  }
220  std::string topic = TOPIC_SETTINGSVALUES;
221 
222  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
223 
224  p_subSPtr = p_nodePtr->create_subscription<SettingsValuesType>(topic, qos_params, p_bind);
225  }
226 
227  // Publisher Settingsvalues
228  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<SettingsValuesType>::SharedPtr& p_pubSPtr) {
229  if(p_nodePtr == nullptr) {
231  }
232  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
233  std::string topic = TOPIC_SETTINGSVALUES;
234  p_pubSPtr = p_nodePtr->create_publisher<SettingsValuesType>(topic, qos_params);
235  }
236 
237  // Subscriber ServiceState
238  template <typename CallbackT>
239  void create_subscription(
240  rclcpp::Node* p_nodePtr,
241  rclcpp::Subscription<ServiceStateType>::SharedPtr& p_subSPtr,
242  CallbackT&& p_bind) {
243  if(p_nodePtr == nullptr) {
245  }
246  std::string topic = TOPIC_SERVICESTATE;
247 
248  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
249 
250  p_subSPtr = p_nodePtr->create_subscription<ServiceStateType>(topic, qos_params, p_bind);
251  }
252 
253  // Publisher servicestate
254  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ServiceStateType>::SharedPtr& p_pubSPtr) {
255  if(p_nodePtr == nullptr) {
257  }
258  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
259  std::string topic = TOPIC_SERVICESTATE;
260  p_pubSPtr = p_nodePtr->create_publisher<ServiceStateType>(topic, qos_params);
261  }
262 
263  // Subscriber Identification
264  template <typename CallbackT>
265  void create_subscription(
266  rclcpp::Node* p_nodePtr,
267  rclcpp::Subscription<IdentificationType>::SharedPtr& p_subSPtr,
268  CallbackT&& p_bind) {
269  if(p_nodePtr == nullptr) {
271  }
272  std::string topic = TOPIC_IDENTIFICATION;
273 
274  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
275 
276  p_subSPtr = p_nodePtr->create_subscription<IdentificationType>(topic, qos_params, p_bind);
277  }
278 
279  // Publisher Identification
280  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<IdentificationType>::SharedPtr& p_pubSPtr) {
281  if(p_nodePtr == nullptr) {
283  }
284  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
285  std::string topic = TOPIC_IDENTIFICATION;
286  p_pubSPtr = p_nodePtr->create_publisher<IdentificationType>(topic, qos_params);
287  }
288 
289  //Subscriber PointsList
290  template <typename CallbackT>
291  void create_subscription(
292  rclcpp::Node* p_nodePtr,
293  rclcpp::Subscription<PointsListType>::SharedPtr& p_subSPtr,
294  CallbackT&& p_bind) {
295  if(p_nodePtr == nullptr) {
297  }
298  std::string topic = TOPIC_POINTSLIST;
299 
300  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
301 
302  p_subSPtr = p_nodePtr->create_subscription<PointsListType>(topic, qos_params, p_bind);
303  }
304 
305  // Publisher PointsList
306  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<PointsListType>::SharedPtr& p_pubSPtr) {
307  if(p_nodePtr == nullptr) {
309  }
310  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
311  std::string topic = TOPIC_POINTSLIST;
312  p_pubSPtr = p_nodePtr->create_publisher<PointsListType>(topic, qos_params);
313  }
314 
315  //Subscriber MarvelMindControl
316  template <typename CallbackT>
317  void create_subscription(
318  rclcpp::Node* p_nodePtr,
319  rclcpp::Subscription<MarvelMindControlType>::SharedPtr& p_subSPtr,
320  CallbackT&& p_bind) {
321 
322  if(p_nodePtr == nullptr) {
324  }
325  std::string topic = TOPIC_MARVELMINDCONTROL;
326 
327  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
328 
329  p_subSPtr = p_nodePtr->create_subscription<MarvelMindControlType>(topic, qos_params, p_bind);
330  }
331 
332  // Publisher MarvelMindControl
333  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<MarvelMindControlType>::SharedPtr& p_pubSPtr) {
334  if(p_nodePtr == nullptr) {
336  }
337  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
338  std::string topic = TOPIC_MARVELMINDCONTROL;
339  p_pubSPtr = p_nodePtr->create_publisher<MarvelMindControlType>(topic, qos_params);
340  }
341 
342  //Subscriber ControllerSetReference
343  template <typename CallbackT>
344  void create_subscription(
345  rclcpp::Node* p_nodePtr,
346  rclcpp::Subscription<ControllerReferenceType>::SharedPtr& p_subSPtr,
347  CallbackT&& p_bind) {
348  if(p_nodePtr == nullptr) {
350  }
351  std::string topic = TOPIC_CONTROLLERREF;
352 
353  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
354 
355  p_subSPtr = p_nodePtr->create_subscription<ControllerReferenceType>(topic, qos_params, p_bind);
356  }
357 
358  // Publisher ControllerSetReference
359  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ControllerReferenceType>::SharedPtr& p_pubSPtr) {
360  if(p_nodePtr == nullptr) {
362  }
363  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
364  std::string topic = TOPIC_CONTROLLERREF;
365  p_pubSPtr = p_nodePtr->create_publisher<ControllerReferenceType>(topic, qos_params);
366  }
367 
368  //Subscriber GPSData
369  template <typename CallbackT>
370  void create_subscription(
371  rclcpp::Node* p_nodePtr,
372  rclcpp::Subscription<GPSDataType>::SharedPtr& p_subSPtr,
373  CallbackT&& p_bind) {
374  if(p_nodePtr == nullptr) {
376  }
377  std::string topic = TOPIC_MARVELMIND;
378 
379  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
380 
381  p_subSPtr = p_nodePtr->create_subscription<GPSDataType>(topic, qos_params, p_bind);
382  }
383 
384  // Publisher GPSData
385  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<GPSDataType>::SharedPtr& p_pubSPtr) {
386  if(p_nodePtr == nullptr) {
388  }
389  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
390  std::string topic = TOPIC_MARVELMIND;
391  p_pubSPtr = p_nodePtr->create_publisher<GPSDataType>(topic, qos_params);
392  }
393 
394  //Subscriber ControlLights
395  template <typename CallbackT>
396  void create_subscription(
397  rclcpp::Node* p_nodePtr,
398  rclcpp::Subscription<ControlLightsType>::SharedPtr& p_subSPtr,
399  CallbackT&& p_bind) {
400  if(p_nodePtr == nullptr) {
402  }
403  std::string topic = TOPIC_LIGHTS;
404 
405  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
406 
407  p_subSPtr = p_nodePtr->create_subscription<ControlLightsType>(topic, qos_params, p_bind);
408  }
409 
410  // Publisher ControlLights
411  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ControlLightsType>::SharedPtr& p_pubSPtr) {
412  if(p_nodePtr == nullptr) {
414  }
415  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
416  std::string topic = TOPIC_LIGHTS;
417  p_pubSPtr = p_nodePtr->create_publisher<ControlLightsType>(topic, qos_params);
418  }
419 
420  //Subscriber DebugControllerType
421  template <typename CallbackT>
422  void create_subscription(
423  rclcpp::Node* p_nodePtr,
424  rclcpp::Subscription<DebugControllerType>::SharedPtr& p_subSPtr,
425  CallbackT&& p_bind) {
426  if(p_nodePtr == nullptr) {
428  }
429  std::string topic = TOPIC_DEBUGCONTROLLER;
430 
431  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
432 
433  p_subSPtr = p_nodePtr->create_subscription<DebugControllerType>(topic, qos_params, p_bind);
434  }
435 
436  // Publisher DebugControllerType
437  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<DebugControllerType>::SharedPtr& p_pubSPtr) {
438  if(p_nodePtr == nullptr) {
440  }
441  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
442  std::string topic = TOPIC_DEBUGCONTROLLER;
443  p_pubSPtr = p_nodePtr->create_publisher<DebugControllerType>(topic, qos_params);
444  }
445 
446 
447  //Subscriber HeartbeatMessage
448  template <typename CallbackT>
449  void create_subscription(
450  rclcpp::Node* p_nodePtr,
451  rclcpp::Subscription<HeartbeatMessageType>::SharedPtr& p_subSPtr,
452  CallbackT&& p_bind) {
453  if(p_nodePtr == nullptr) {
455  }
456  std::string topic = TOPIC_HEARTBEAT;
457 
458  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
459 
460  p_subSPtr = p_nodePtr->create_subscription<HeartbeatMessageType>(topic, qos_params, p_bind);
461  }
462 
463  // Publisher HeartbeatMessage
464  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<HeartbeatMessageType>::SharedPtr& p_pubSPtr) {
465  if(p_nodePtr == nullptr) {
467  }
468  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
469  std::string topic = TOPIC_HEARTBEAT;
470  p_pubSPtr = p_nodePtr->create_publisher<HeartbeatMessageType>(topic, qos_params);
471  }
472 
473  //Subscriber ObjectVectorMessageType
474  template <typename CallbackT>
475  void create_subscription(
476  rclcpp::Node* p_nodePtr,
477  rclcpp::Subscription<ObjectVectorMessageType>::SharedPtr& p_subSPtr,
478  CallbackT&& p_bind) {
479  if(p_nodePtr == nullptr) {
481  }
482  std::string topic = TOPIC_OBJECTVECTOR;
483 
484  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
485 
486  p_subSPtr = p_nodePtr->create_subscription<ObjectVectorMessageType>(topic, qos_params, p_bind);
487  }
488 
489  // Publisher ObjectVectorMessageType
490  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ObjectVectorMessageType>::SharedPtr& p_pubSPtr) {
491  if(p_nodePtr == nullptr) {
493  }
494  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
495  std::string topic = TOPIC_OBJECTVECTOR;
496  p_pubSPtr = p_nodePtr->create_publisher<ObjectVectorMessageType>(topic, qos_params);
497  }
498 
499  //Subscriber ButtonStateMessageType
500  template <typename CallbackT>
501  void create_subscription(
502  rclcpp::Node* p_nodePtr,
503  rclcpp::Subscription<ButtonStateMessageType>::SharedPtr& p_subSPtr,
504  CallbackT&& p_bind) {
505  if(p_nodePtr == nullptr) {
507  }
508  std::string topic = TOPIC_BUTTON_STATE;
509 
510  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
511 
512  p_subSPtr = p_nodePtr->create_subscription<ButtonStateMessageType>(topic, qos_params, p_bind);
513  }
514 
515  // Publisher ButtonStateMessageType
516  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ButtonStateMessageType>::SharedPtr& p_pubSPtr) {
517  if(p_nodePtr == nullptr) {
519  }
520  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
521  std::string topic = TOPIC_BUTTON_STATE;
522  p_pubSPtr = p_nodePtr->create_publisher<ButtonStateMessageType>(topic, qos_params);
523  }
524 
525  //Subscriber Obstacles
526  template <typename CallbackT>
527  void create_subscription(
528  rclcpp::Node* p_nodePtr,
529  rclcpp::Subscription<ObstacleListType>::SharedPtr& p_subSPtr,
530  CallbackT&& p_bind) {
531  if(p_nodePtr == nullptr) {
533  }
534  std::string topic = TOPIC_OBSTACLES;
535 
536  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
537 
538  p_subSPtr = p_nodePtr->create_subscription<ObstacleListType>(topic, qos_params, p_bind);
539  }
540 
541  // Publisher Obstacles
542  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ObstacleListType>::SharedPtr& p_pubSPtr) {
543  if(p_nodePtr == nullptr) {
545  }
546  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
547  std::string topic = TOPIC_OBSTACLES;
548  p_pubSPtr = p_nodePtr->create_publisher<ObstacleListType>(topic, qos_params);
549  }
550 
551  //Subscriber CAR_POSE_ESTIMATED
552  template <typename CallbackT>
553  void create_subscription(
554  rclcpp::Node* p_nodePtr,
555  rclcpp::Subscription<CarPoseEstimatedType>::SharedPtr& p_subSPtr,
556  CallbackT&& p_bind) {
557  if(p_nodePtr == nullptr) {
559  }
560  std::string topic = TOPIC_CAR_POSE;
561 
562  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
563 
564  p_subSPtr = p_nodePtr->create_subscription<CarPoseEstimatedType>(topic, qos_params, p_bind);
565  }
566 
567  // Publisher CAR_POSE_ESTIMATED
568  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<CarPoseEstimatedType>::SharedPtr& p_pubSPtr) {
569  if(p_nodePtr == nullptr) {
571  }
572  rclcpp::QoS qos_params = get_qos_profile(QOS_BEST_EFFORT);
573  std::string topic = TOPIC_CAR_POSE;
574  p_pubSPtr = p_nodePtr->create_publisher<CarPoseEstimatedType>(topic, qos_params);
575  }
576 
577  //Subscriber SYSTEM_SETTINGS
578  template <typename CallbackT>
579  void create_subscription(
580  rclcpp::Node* p_nodePtr,
581  rclcpp::Subscription<SystemSettingsType>::SharedPtr& p_subSPtr,
582  CallbackT&& p_bind) {
583  if(p_nodePtr == nullptr) {
585  }
586  std::string topic = TOPIC_SYSTEM_SETTINGS;
587 
588  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
589 
590  p_subSPtr = p_nodePtr->create_subscription<SystemSettingsType>(topic, qos_params, p_bind);
591  }
592 
593  // Publisher SYSTEM_SETTINGS
594  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<SystemSettingsType>::SharedPtr& p_pubSPtr) {
595  if(p_nodePtr == nullptr) {
597  }
598  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
599  std::string topic = TOPIC_SYSTEM_SETTINGS;
600  p_pubSPtr = p_nodePtr->create_publisher<SystemSettingsType>(topic, qos_params);
601  }
602 
603  //Subscriber STOP_LINE
604  template <typename CallbackT>
605  void create_subscription(
606  rclcpp::Node* p_nodePtr,
607  rclcpp::Subscription<StopLineType>::SharedPtr& p_subSPtr,
608  CallbackT&& p_bind) {
609  if(p_nodePtr == nullptr) {
611  }
612  std::string topic = TOPIC_STOP_LINE;
613 
614  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
615 
616  p_subSPtr = p_nodePtr->create_subscription<StopLineType>(topic, qos_params, p_bind);
617  }
618 
619  // Publisher STOP_LINE
620  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<StopLineType>::SharedPtr& p_pubSPtr) {
621  if(p_nodePtr == nullptr) {
623  }
624  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
625  std::string topic = TOPIC_STOP_LINE;
626  p_pubSPtr = p_nodePtr->create_publisher<StopLineType>(topic, qos_params);
627  }
628 
629  //Subscriber QR Code Detection
630  template <typename CallbackT>
631  void create_subscription(
632  rclcpp::Node* p_nodePtr,
633  rclcpp::Subscription<QRCodeDetectType>::SharedPtr& p_subSPtr,
634  CallbackT&& p_bind) {
635  if(p_nodePtr == nullptr) {
637  }
638  std::string topic = TOPIC_QR_CODE_DETECTTION;
639 
640  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
641 
642  p_subSPtr = p_nodePtr->create_subscription<QRCodeDetectType>(topic, qos_params, p_bind);
643  }
644 
645  // Publisher QR Code Detection
646  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<QRCodeDetectType>::SharedPtr& p_pubSPtr) {
647  if(p_nodePtr == nullptr) {
649  }
650  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
651  std::string topic = TOPIC_QR_CODE_DETECTTION;
652  p_pubSPtr = p_nodePtr->create_publisher<QRCodeDetectType>(topic, qos_params);
653  }
654 
655  //Subscriber parking
656  template <typename CallbackT>
657  void create_subscription(
658  rclcpp::Node* p_nodePtr,
659  rclcpp::Subscription<ParkingStateType>::SharedPtr& p_subSPtr,
660  CallbackT&& p_bind) {
661  if(p_nodePtr == nullptr) {
663  }
664  std::string topic = TOPIC_PARKING_STATE;
665 
666  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
667 
668  p_subSPtr = p_nodePtr->create_subscription<ParkingStateType>(topic, qos_params, p_bind);
669  }
670 
671  // Publisher parking state
672  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ParkingStateType>::SharedPtr& p_pubSPtr) {
673  if(p_nodePtr == nullptr) {
675  }
676  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
677  std::string topic = TOPIC_PARKING_STATE;
678  p_pubSPtr = p_nodePtr->create_publisher<ParkingStateType>(topic, qos_params);
679  }
680 
681  //Subscriber parking op
682  template <typename CallbackT>
683  void create_subscription(
684  rclcpp::Node* p_nodePtr,
685  rclcpp::Subscription<ParkingOperationType>::SharedPtr& p_subSPtr,
686  CallbackT&& p_bind) {
687  if(p_nodePtr == nullptr) {
689  }
690  std::string topic = TOPIC_PARKING_OPERATION;
691 
692  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
693 
694  p_subSPtr = p_nodePtr->create_subscription<ParkingOperationType>(topic, qos_params, p_bind);
695  }
696 
697  // Publisher parking op
698  void create_publisher(rclcpp::Node* p_nodePtr, rclcpp::Publisher<ParkingOperationType>::SharedPtr& p_pubSPtr) {
699  if(p_nodePtr == nullptr) {
701  }
702  rclcpp::QoS qos_params = get_qos_profile(QOS_RELIABLE);
703  std::string topic = TOPIC_PARKING_OPERATION;
704  p_pubSPtr = p_nodePtr->create_publisher<ParkingOperationType>(topic, qos_params);
705  }
706 
707  } // namespace
708  } // namespace ros
709 } // namespace galaxis
710 
711 #pragma GCC diagnostic pop
712 #pragma GCC diagnostic pop
713 
714 #endif //NODE_ROS_PUBSUB_WRAPPER_H
MeasurementsType
messages::msg::Measurements MeasurementsType
Definition: messages.hpp:36
ParkingStateType
messages::msg::ParkingState ParkingStateType
Definition: messages.hpp:66
IdentificationType
messages::msg::Identification IdentificationType
Definition: messages.hpp:45
ButtonStateMessageType
messages::msg::ButtonState ButtonStateMessageType
Definition: messages.hpp:55
ControlLightsType
messages::msg::ControlLights ControlLightsType
Definition: messages.hpp:39
PointsListType
messages::msg::PointsList PointsListType
Definition: messages.hpp:46
MarvelMindControlType
messages::msg::MarvelMindControl MarvelMindControlType
Definition: messages.hpp:47
SettingsValuesType
messages::msg::SettingsValues SettingsValuesType
Definition: messages.hpp:40
galaxis::Errors::POINTER_ERROR
Definition: Errors.hpp:18
ObstacleListType
messages::msg::ObstacleList ObstacleListType
Definition: messages.hpp:60
DebugPolynomType
messages::msg::DebugPolynom DebugPolynomType
Definition: messages.hpp:43
StopLineType
messages::msg::StopLine StopLineType
Definition: messages.hpp:65
CarPoseEstimatedType
messages::msg::CarPoseEstimated CarPoseEstimatedType
Definition: messages.hpp:62
PathpolynomType
messages::msg::Pathpolynom PathpolynomType
Definition: messages.hpp:42
GPSDataType
messages::msg::GpsData GPSDataType
Definition: messages.hpp:49
DebugControllerType
messages::msg::DebugController DebugControllerType
Definition: messages.hpp:48
ServiceStateType
messages::msg::ServiceState ServiceStateType
Definition: messages.hpp:41
ObjectVectorMessageType
messages::msg::ObjectVector ObjectVectorMessageType
Definition: messages.hpp:52
galaxis
Definition: MapClasses.hpp:10
ParkingOperationType
messages::msg::ParkingOperation ParkingOperationType
Definition: messages.hpp:67
SystemSettingsType
messages::msg::SystemSettings SystemSettingsType
Definition: messages.hpp:63
QRCodeDetectType
messages::msg::QRCodeDetect QRCodeDetectType
Definition: messages.hpp:64
ControllerReferenceType
messages::msg::ControllerReference ControllerReferenceType
Definition: messages.hpp:37
HeartbeatMessageType
messages::msg::Heartbeat HeartbeatMessageType
Definition: messages.hpp:51
ControlMotionType
messages::msg::ControlMotion ControlMotionType
Definition: messages.hpp:38
utilities.hpp
messages.hpp
Errors.hpp