Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
LaneDetectionGT.hpp
Go to the documentation of this file.
1 #ifndef LANE_DETECTION_HPP
2 #define LANE_DETECTION_HPP
3 
4 #include <memory>
5 #include <mutex>
6 #include <map>
7 
8 #include <rclcpp/rclcpp.hpp>
9 #include <galaxis/messages.hpp>
10 #include <galaxis/linatypes.hpp>
11 #include <visualization_msgs/msg/marker.hpp>
12 #include <geometry_msgs/msg/pose.hpp>
13 #include <sensor_msgs/msg/image.hpp>
14 #include <image_transport/image_transport.h>
15 
16 #include "MapDataLayer.hpp"
17 
18 #include <memory>
19 
20 enum LINE_TYPE : int {
21  LEFT_LINE = 0,
24 };
25 
26 class Obstacle {
27 public:
29  float widthCM;
30 };
31 
32 class LaneDetectionGT : public rclcpp::Node {
33 private:
35 
37 
39  bool m_ready = false;
41 
45 
46  std::map<int, Obstacle> m_obstacleMap;
47 
48  std::mutex m_carPoseMtx;
50  double m_currentAbsoluteOrientation = -100000;
52 
53  // Subscription
54  rclcpp::Subscription<visualization_msgs::msg::Marker>::SharedPtr m_subscriberLeftLineSPtr;
55  rclcpp::Subscription<visualization_msgs::msg::Marker>::SharedPtr m_subscriberMiddleLineSPtr;
56  rclcpp::Subscription<visualization_msgs::msg::Marker>::SharedPtr m_subscriberRightLineSPtr;
57 
58  rclcpp::Subscription<visualization_msgs::msg::Marker>::SharedPtr m_subscriberObstacleSPtr;
59 
60  rclcpp::Subscription<geometry_msgs::msg::Pose>::SharedPtr m_subscriberCarPoseSPtr;
61 
62  // Publisher
63  image_transport::Publisher m_imgtransPub;
64  rclcpp::Publisher<ObstacleListType>::SharedPtr m_publisherObstacleSPtr;
65 
66 public:
69 
70 private:
71  void groundtruthLeftLineCallback(visualization_msgs::msg::Marker::SharedPtr p_message);
72  void groundtruthCenterLineCallback(visualization_msgs::msg::Marker::SharedPtr p_message);
73  void groundtruthRightLineCallback(visualization_msgs::msg::Marker::SharedPtr p_message);
74  void groundtruthCallback(visualization_msgs::msg::Marker::SharedPtr p_message, LINE_TYPE type);
75 
76  void groundtruthObstacleCallback(visualization_msgs::msg::Marker::SharedPtr p_message);
77 
78  void carPoseCallback(geometry_msgs::msg::Pose::SharedPtr p_message);
79 
80  void checkReady();
81  void loop();
82 };
83 
84 #endif // LANE_DETECTION_HPP
LaneDetectionGT::groundtruthRightLineCallback
void groundtruthRightLineCallback(visualization_msgs::msg::Marker::SharedPtr p_message)
Definition: LaneDetectionGT.cpp:75
LEFT_LINE
@ LEFT_LINE
Definition: LaneDetectionGT.hpp:21
LaneDetectionGT::groundtruthCenterLineCallback
void groundtruthCenterLineCallback(visualization_msgs::msg::Marker::SharedPtr p_message)
Definition: LaneDetectionGT.cpp:71
LaneDetectionGT::LaneDetectionGT
LaneDetectionGT()
Definition: LaneDetectionGT.cpp:26
Obstacle::widthCM
float widthCM
Definition: LaneDetectionGT.hpp:29
LaneDetectionGT::m_currentCarPositionCM
Vector2f m_currentCarPositionCM
Definition: LaneDetectionGT.hpp:49
LaneDetectionGT::m_groundtruthTileIteratorRightLine
int m_groundtruthTileIteratorRightLine
Definition: LaneDetectionGT.hpp:44
LaneDetectionGT::m_carPoseMtx
std::mutex m_carPoseMtx
Definition: LaneDetectionGT.hpp:48
LaneDetectionGT::m_mapDataLayer
MapDataLayer m_mapDataLayer
Definition: LaneDetectionGT.hpp:36
LINE_TYPE
LINE_TYPE
Definition: LaneDetectionGT.hpp:20
LaneDetectionGT::m_obstacleDetectionDistanceCM
float m_obstacleDetectionDistanceCM
Definition: LaneDetectionGT.hpp:40
MapDataLayer.hpp
LaneDetectionGT::m_imgtransPub
image_transport::Publisher m_imgtransPub
Definition: LaneDetectionGT.hpp:63
LaneDetectionGT::m_subscriberRightLineSPtr
rclcpp::Subscription< visualization_msgs::msg::Marker >::SharedPtr m_subscriberRightLineSPtr
Definition: LaneDetectionGT.hpp:56
LaneDetectionGT::m_subscriberObstacleSPtr
rclcpp::Subscription< visualization_msgs::msg::Marker >::SharedPtr m_subscriberObstacleSPtr
Definition: LaneDetectionGT.hpp:58
LaneDetectionGT::groundtruthLeftLineCallback
void groundtruthLeftLineCallback(visualization_msgs::msg::Marker::SharedPtr p_message)
Definition: LaneDetectionGT.cpp:67
MapDataLayer
Definition: MapDataLayer.hpp:55
LaneDetectionGT::m_currentAbsoluteOrientation
double m_currentAbsoluteOrientation
Definition: LaneDetectionGT.hpp:50
LaneDetectionGT::m_subscriberMiddleLineSPtr
rclcpp::Subscription< visualization_msgs::msg::Marker >::SharedPtr m_subscriberMiddleLineSPtr
Definition: LaneDetectionGT.hpp:55
LaneDetectionGT::m_subscriberLeftLineSPtr
rclcpp::Subscription< visualization_msgs::msg::Marker >::SharedPtr m_subscriberLeftLineSPtr
Definition: LaneDetectionGT.hpp:54
LaneDetectionGT::m_publisherObstacleSPtr
rclcpp::Publisher< ObstacleListType >::SharedPtr m_publisherObstacleSPtr
Definition: LaneDetectionGT.hpp:64
LaneDetectionGT::groundtruthObstacleCallback
void groundtruthObstacleCallback(visualization_msgs::msg::Marker::SharedPtr p_message)
Definition: LaneDetectionGT.cpp:136
LaneDetectionGT::m_groundtruthTileIteratorCenterLine
int m_groundtruthTileIteratorCenterLine
Definition: LaneDetectionGT.hpp:43
LaneDetectionGT::loop
void loop()
Definition: LaneDetectionGT.cpp:206
Obstacle
Definition: LaneDetectionGT.hpp:26
LaneDetectionGT::m_obstacleMap
std::map< int, Obstacle > m_obstacleMap
Definition: LaneDetectionGT.hpp:46
LaneDetectionGT::m_groundtruthTileIteratorLeftLine
int m_groundtruthTileIteratorLeftLine
Definition: LaneDetectionGT.hpp:42
LaneDetectionGT::carPoseCallback
void carPoseCallback(geometry_msgs::msg::Pose::SharedPtr p_message)
Definition: LaneDetectionGT.cpp:162
LaneDetectionGT::m_simulatedLDFPSWaitingTimeMicroseconds
int m_simulatedLDFPSWaitingTimeMicroseconds
Definition: LaneDetectionGT.hpp:38
LaneDetectionGT::m_lineImageWindowSize
Vector2i m_lineImageWindowSize
Definition: LaneDetectionGT.hpp:34
galaxis::lina::Vector2f
Eigen::Vector2f Vector2f
Definition: linatypes.hpp:14
linatypes.hpp
LaneDetectionGT::m_ready
bool m_ready
Definition: LaneDetectionGT.hpp:39
LaneDetectionGT::m_currentCarPoseTimestamp
rclcpp::Time m_currentCarPoseTimestamp
Definition: LaneDetectionGT.hpp:51
LaneDetectionGT::~LaneDetectionGT
~LaneDetectionGT()
Definition: LaneDetectionGT.cpp:63
LaneDetectionGT::groundtruthCallback
void groundtruthCallback(visualization_msgs::msg::Marker::SharedPtr p_message, LINE_TYPE type)
Definition: LaneDetectionGT.cpp:79
LaneDetectionGT::checkReady
void checkReady()
Definition: LaneDetectionGT.cpp:195
galaxis::lina::Vector2i
Eigen::Vector2i Vector2i
Definition: linatypes.hpp:13
Obstacle::positionCM
Vector2f positionCM
Definition: LaneDetectionGT.hpp:28
LaneDetectionGT::m_subscriberCarPoseSPtr
rclcpp::Subscription< geometry_msgs::msg::Pose >::SharedPtr m_subscriberCarPoseSPtr
Definition: LaneDetectionGT.hpp:60
LaneDetectionGT
Definition: LaneDetectionGT.hpp:32
RIGHT_LINE
@ RIGHT_LINE
Definition: LaneDetectionGT.hpp:23
messages.hpp
CENTER_LINE
@ CENTER_LINE
Definition: LaneDetectionGT.hpp:22