1 #ifndef MAP_DATA_LAYER_HPP
2 #define MAP_DATA_LAYER_HPP
5 #include <unordered_map>
14 #include <sensor_msgs/msg/image.hpp>
19 #include <boost/asio.hpp>
20 #include <boost/asio/thread_pool.hpp>
21 #include <shared_mutex>
22 #include <rclcpp/rclcpp.hpp>
47 uint8_t centerLine = 0;
48 uint8_t rightLine = 0;
49 bool imageIgnoreField =
false;
50 uint32_t lastUpdateStep = 0;
57 typedef std::array<ColumnMapArray, MAP_SIZE>
MapArray;
60 bool m_simulationMode =
false;
70 std::atomic<uint32_t> m_updateStep = 0;
78 int m_lookupWindowSizeCMWidth = 160;
79 int m_lookupWindowSizeCMHeight = 150;
81 uint8_t m_cellThresholdRGBValue = 80;
82 uint8_t m_cellThresholdExtract = 99;
83 uint8_t m_cellLineDecreasePerView = 100;
84 uint8_t m_cellLineIncreasePerView = 100;
85 float m_laneImagePixelToPositionConversionFactor = 1.5625f;
86 float m_obstaclePositionDiffForRerecognitionCM = 40.0;
100 void enableSimulationMode();
101 void setLookupWindowSizeCMWidth(
int value);
102 void setLookupWindowSizeCMHeight(
int value);
104 void setCellThresholdRGBValue(uint8_t value);
105 void setCellThresholdExtract(uint8_t value);
106 void setCellLineDecreasePerView(uint8_t value);
107 void setCellLineIncreasePerView(uint8_t value);
108 void setLaneImageConversionFactor(
float factor);
109 void setObstaclePositionDiffForRerecognition(
float diff);
110 void setObstacleTrackTimeDuration(
int sec,
int nsec);
113 bool isInImageIgnoreField(
Vector2f p_position,
unsigned int p_maxImageX);
116 void updateMap(
const sensor_msgs::msg::Image::ConstSharedPtr& laneDetectionSPtr,
Vector2f currentAbsoluteCarPositionCM,
double currentAbsoluteOrientation);
117 std::shared_ptr<LinesObject<int16_t>> getLineObject(
Vector2f absolutePositionCM,
float lookBehindPosOffsetCM,
double absoluteOrientation,
Vector2i windowSize);
120 std::shared_ptr<std::vector<StaticObstacle>> getObstacles(rclcpp::Time
const& timestamp,
bool removeOld =
true);
121 void addOrUpdateStaticObstacle(
ObstacleType const& p_obstacle,
Vector2f absolutePositionCM,
double currentOrientation, rclcpp::Time
const& timestamp);
124 void preprocessPoints(
const sensor_msgs::msg::Image::ConstSharedPtr& laneDetectionSPtr,
Vector2f const& currentPositionCM,
int arrayOffsetStartIndex,
int arrayOffsetEndIndex,
double currentAbsoluteOrientation);
126 inline void decreaseStepCell(
MapCell* cellPtr);
127 float checkPositionRelativeToEdge(
int x1,
int y1,
int x2,
int y2,
int xp,
int yp);
128 void iterateThroughMap(
int arrayStartX,
int arrayEndX,
int arrayStartY,
int arrayEndY,
Vector2i const& absoluteCarPosition, std::array<Vector2f, 4>
const& windowEdges);
131 #endif // _MAP_DATA_LAYER_HPP_