Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
stoplinedetection.hpp
Go to the documentation of this file.
1 #ifndef STOPLINE_DETECTION_NODE_HPP
2 #define STOPLINE_DETECTION_NODE_HPP
3 
4 
5 #include "utils/clock.hpp"
6 
7 #include "rclcpp/rclcpp.hpp"
9 
10 #include <sensor_msgs/msg/image.hpp>
11 #include <image_transport/image_transport.h>
12 #include <cv_bridge/cv_bridge.h>
13 #include <utils/settings.hpp>
14 
16 
17 #include <opencv2/core/mat.hpp>
18 
19 #include "galaxis/messages.hpp"
20 #include "std_msgs/msg/header.hpp"
21 
22 using namespace cv;
23 
25 private:
26  bool m_simulationMode = false;
27  bool m_debugMode = false;
28  bool m_startlineDetectionMode = true;
29  bool m_stopLineDetectionMode = true;
30 
31  cv_bridge::CvImagePtr m_imgBridge_ptr;
32  cv_bridge::CvImagePtr m_imgBridgeLeft_ptr;
33  cv_bridge::CvImagePtr m_imgBridgeRight_ptr;
34  cv_bridge::CvImagePtr m_imgBridgeLeftRef_ptr;
35  cv_bridge::CvImagePtr m_imgBridgeRightRef_ptr;
36 
37  // ROS2
38  // Publisher
39  image_transport::Publisher m_stopLineImagePublisher;
40  image_transport::Publisher m_startLineImagePublisher;
41 
42  rclcpp::Publisher<StopLineType>::SharedPtr m_stopLinePublisherSPtr;
43 
44  // Subscriber
45  rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr m_StopLineImageSubscriber;
46 
47  bool m_stopLineDetectedInLastStep = false;
48 
49  int m_stopLineHoughMinLineLength = 25;
50  int m_stopLineHoughMaxLineGap = 10;
51  int m_stopLineHoughThreshold = 70;
52 
53  int m_startLineGreynessLowerThreshold = 80;
54  double m_startLineQualityLevel = 0.35;
55  double m_startLineMinDistance = 10;
56  int m_startLineBlockSize = 3;
57  double m_startLineK = 0.04;
58  int m_startLineClusterEps = 10;
59  int m_startLinePointsCountThreshold = 9;
60 
61  cv::Mat newCameraMatrix;
63 
64 public:
67 
68 private:
69  // standard mode callbacks
70  void on_stop_line_detection_callback(sensor_msgs::msg::Image::SharedPtr msg);
71  bool detect_startline(cv::Mat &image, std_msgs::msg::Header const& header);
72  bool detect_stopline(cv::Mat &image, std_msgs::msg::Header const& header);
73  rcl_interfaces::msg::SetParametersResult new_parameters_callback(const std::vector<rclcpp::Parameter>& parameters);
74 };
75 
76 #endif // AUTOPILOT_NODE_HPP
StopLineDetection
Definition: stoplinedetection.hpp:24
StopLineDetection::perspectiveTransformMatrix
cv::Mat perspectiveTransformMatrix
Definition: stoplinedetection.hpp:62
CameraCalibration.hpp
StopLineDetection::m_startLineImagePublisher
image_transport::Publisher m_startLineImagePublisher
Definition: stoplinedetection.hpp:40
StopLineDetection::m_imgBridgeRight_ptr
cv_bridge::CvImagePtr m_imgBridgeRight_ptr
Definition: stoplinedetection.hpp:33
settings.hpp
clock.hpp
StopLineDetection::m_imgBridgeLeft_ptr
cv_bridge::CvImagePtr m_imgBridgeLeft_ptr
Definition: stoplinedetection.hpp:32
StopLineDetection::m_stopLineImagePublisher
image_transport::Publisher m_stopLineImagePublisher
Definition: stoplinedetection.hpp:39
StopLineDetection::m_imgBridge_ptr
cv_bridge::CvImagePtr m_imgBridge_ptr
Definition: stoplinedetection.hpp:31
GalaxisNode.hpp
StopLineDetection::m_stopLinePublisherSPtr
rclcpp::Publisher< StopLineType >::SharedPtr m_stopLinePublisherSPtr
Definition: stoplinedetection.hpp:42
StopLineDetection::newCameraMatrix
cv::Mat newCameraMatrix
Definition: stoplinedetection.hpp:61
StopLineDetection::m_imgBridgeLeftRef_ptr
cv_bridge::CvImagePtr m_imgBridgeLeftRef_ptr
Definition: stoplinedetection.hpp:34
GalaxisNode
Definition: GalaxisNode.hpp:21
StopLineDetection::m_StopLineImageSubscriber
rclcpp::Subscription< sensor_msgs::msg::Image >::SharedPtr m_StopLineImageSubscriber
Definition: stoplinedetection.hpp:45
messages.hpp
StopLineDetection::m_imgBridgeRightRef_ptr
cv_bridge::CvImagePtr m_imgBridgeRightRef_ptr
Definition: stoplinedetection.hpp:35