Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
MapDataLayer Class Reference

#include <MapDataLayer.hpp>

Public Member Functions

 MapDataLayer ()
 
 MapDataLayer (int amountOfThreads)
 
 ~MapDataLayer ()
 
void init ()
 
void clear ()
 
void enableSimulationMode ()
 
void setLookupWindowSizeCMWidth (int value)
 
void setLookupWindowSizeCMHeight (int value)
 
void setCellThresholdRGBValue (uint8_t value)
 
void setCellThresholdExtract (uint8_t value)
 
void setCellLineDecreasePerView (uint8_t value)
 
void setCellLineIncreasePerView (uint8_t value)
 
void setLaneImageConversionFactor (float factor)
 
void setObstaclePositionDiffForRerecognition (float diff)
 
void setObstacleTrackTimeDuration (int sec, int nsec)
 
bool isInImageIgnoreField (Vector2f p_position, unsigned int p_maxImageX)
 
void updateMap (const sensor_msgs::msg::Image::ConstSharedPtr &laneDetectionSPtr, Vector2f currentAbsoluteCarPositionCM, double currentAbsoluteOrientation)
 
std::shared_ptr< LinesObject< int16_t > > getLineObject (Vector2f absolutePositionCM, float lookBehindPosOffsetCM, double absoluteOrientation, Vector2i windowSize)
 
std::shared_ptr< std::vector< StaticObstacle > > getObstacles (rclcpp::Time const &timestamp, bool removeOld=true)
 
void addOrUpdateStaticObstacle (ObstacleType const &p_obstacle, Vector2f absolutePositionCM, double currentOrientation, rclcpp::Time const &timestamp)
 
 MapDataLayer ()
 
 MapDataLayer (int amountOfThreads)
 
 ~MapDataLayer ()
 
void init ()
 
void clear ()
 
void updateMap (visualization_msgs::msg::Marker::SharedPtr laneDetectionSPtr, char laneType)
 
std::shared_ptr< LinesObject< int16_t > > getLineObject (Vector2f absolutePositionCM, float absoluteOrientation, Vector2i windowSize, Vector2i &effectiveWindowSize)
 

Public Attributes

int m_lookupWindowSizeCMWidth = 160
 
int m_lookupWindowSizeCMHeight = 150
 
uint8_t m_cellThresholdRGBValue = 80
 
uint8_t m_cellThresholdExtract = 99
 
uint8_t m_cellLineDecreasePerView = 100
 
uint8_t m_cellLineIncreasePerView = 100
 
float m_laneImagePixelToPositionConversionFactor = 1.5625f
 
float m_obstaclePositionDiffForRerecognitionCM = 40.0
 
std::shared_ptr< std::vector< StaticObstacle > > m_staticObstacleVecSPtr
 
rclcpp::Duration m_obstacleKeepDuration
 

Private Types

typedef std::array< MapCell, MAP_SIZE > ColumnMapArray
 
typedef std::array< ColumnMapArray, MAP_SIZE > MapArray
 
typedef std::array< MapCell, MAP_SIZE > ColumnMapArray
 
typedef std::array< ColumnMapArray, MAP_SIZE > MapArray
 

Private Member Functions

void preprocessPoints (const sensor_msgs::msg::Image::ConstSharedPtr &laneDetectionSPtr, Vector2f const &currentPositionCM, int arrayOffsetStartIndex, int arrayOffsetEndIndex, double currentAbsoluteOrientation)
 
void updateCell (MapCell const &cellUpdate, Vector2i position)
 
void decreaseStepCell (MapCell *cellPtr)
 
float checkPositionRelativeToEdge (int x1, int y1, int x2, int y2, int xp, int yp)
 
void iterateThroughMap (int arrayStartX, int arrayEndX, int arrayStartY, int arrayEndY, Vector2i const &absoluteCarPosition, std::array< Vector2f, 4 > const &windowEdges)
 
void updateCell (Vector2i position, char laneType)
 
void iterateThroughMap (int arrayStartX, int arrayEndX, int arrayStartY, int arrayEndY, Vector2i const &absoluteCarPosition)
 

Private Attributes

bool m_simulationMode = false
 
boost::asio::thread_pool m_threadPool
 
int m_amountOfThreads
 
std::shared_mutex m_sharedThreadMutex
 
MapArray m_data
 
Vector2f m_mapSize
 
std::mutex m_mapMutex
 
std::atomic< uint32_t > m_updateStep = 0
 
Vector2f m_absoluteCarPositionOffset
 
std::shared_ptr< LinesObject< int16_t > > m_linesObjectSPtr
 
geometry_msgs::msg::Point m_lastPointLeftLane
 
bool m_lastPointLeftLaneUsable = false
 
geometry_msgs::msg::Point m_lastPointCenterLane
 
bool m_lastPointCenterLaneUsable = false
 
geometry_msgs::msg::Point m_lastPointRightLane
 
bool m_lastPointRightLaneUsable = false
 

Detailed Description

Definition at line 55 of file MapDataLayer.hpp.

Member Typedef Documentation

◆ ColumnMapArray [1/2]

typedef std::array<MapCell, MAP_SIZE> MapDataLayer::ColumnMapArray
private

Definition at line 34 of file MapDataLayer.hpp.

◆ ColumnMapArray [2/2]

typedef std::array<MapCell, MAP_SIZE> MapDataLayer::ColumnMapArray
private

Definition at line 56 of file MapDataLayer.hpp.

◆ MapArray [1/2]

typedef std::array<ColumnMapArray, MAP_SIZE> MapDataLayer::MapArray
private

Definition at line 35 of file MapDataLayer.hpp.

◆ MapArray [2/2]

typedef std::array<ColumnMapArray, MAP_SIZE> MapDataLayer::MapArray
private

Definition at line 57 of file MapDataLayer.hpp.

Constructor & Destructor Documentation

◆ MapDataLayer() [1/4]

MapDataLayer::MapDataLayer ( )

Definition at line 18 of file MapDataLayer.cpp.

18  :
21  init();
22 }

References init(), and m_amountOfThreads.

Here is the call graph for this function:

◆ MapDataLayer() [2/4]

MapDataLayer::MapDataLayer ( int  amountOfThreads = 4)

Definition at line 12 of file MapDataLayer.cpp.

12  :
13  m_threadPool(amountOfThreads), m_amountOfThreads(amountOfThreads), m_obstacleKeepDuration(1, 0) {
14  assert(m_amountOfThreads > 0);
15  init();
16 }

References init(), and m_amountOfThreads.

Here is the call graph for this function:

◆ ~MapDataLayer() [1/2]

MapDataLayer::~MapDataLayer ( )

Definition at line 24 of file MapDataLayer.cpp.

24  {
25  m_threadPool.join();
26 }

References m_threadPool.

◆ MapDataLayer() [3/4]

MapDataLayer::MapDataLayer ( )

◆ MapDataLayer() [4/4]

MapDataLayer::MapDataLayer ( int  amountOfThreads)

◆ ~MapDataLayer() [2/2]

MapDataLayer::~MapDataLayer ( )

Member Function Documentation

◆ addOrUpdateStaticObstacle()

void MapDataLayer::addOrUpdateStaticObstacle ( ObstacleType const &  p_obstacle,
Vector2f  absolutePositionCM,
double  currentOrientation,
rclcpp::Time const &  timestamp 
)

Definition at line 391 of file MapDataLayer.cpp.

391  {
392  Vector2f obsPosition = Vector2f(p_obstacle.pos_x * 100, p_obstacle.pos_y * 100);
393  Eigen::Rotation2Df rotationMat(-currentOrientation);
394  obsPosition = rotationMat * obsPosition;
395  obsPosition += absolutePositionCM;
396 
397  bool obstacleUpdated = false;
398  for(StaticObstacle& obstacleStatic : *m_staticObstacleVecSPtr) {
399  Vector2f distanceDiff = obsPosition - obstacleStatic.get_position_now();
400  // TODO: also check dimensions
401  if(distanceDiff.norm() < m_obstaclePositionDiffForRerecognitionCM) { // obstacle already inserted -> update
402  obstacleStatic.update_position(timestamp, obsPosition);
403  obstacleUpdated = true;
404  break;
405  }
406  }
407 
408  if(obstacleUpdated == false) { // add new static obstacle
409  StaticObstacle newObstacle(timestamp, obsPosition, p_obstacle.width * 100);
410  m_staticObstacleVecSPtr->push_back(newObstacle);
411  }
412 }

References m_obstaclePositionDiffForRerecognitionCM, and m_staticObstacleVecSPtr.

Referenced by AutoPilotNode::on_obstacle_callback().

Here is the caller graph for this function:

◆ checkPositionRelativeToEdge()

float MapDataLayer::checkPositionRelativeToEdge ( int  x1,
int  y1,
int  x2,
int  y2,
int  xp,
int  yp 
)
private

Definition at line 328 of file MapDataLayer.cpp.

328  {
329  // Edge: (x1,y1) and (x2,y2) [counterclockwise]
330  // https://stackoverflow.com/questions/2752725/finding-whether-a-point-lies-inside-a-rectangle-or-not
331  return (x2 - x1) * (yp - y1) - (xp - x1) * (y2 - y1);
332 }

Referenced by iterateThroughMap().

Here is the caller graph for this function:

◆ clear() [1/2]

void MapDataLayer::clear ( )

◆ clear() [2/2]

void MapDataLayer::clear ( )

Definition at line 41 of file MapDataLayer.cpp.

41  {
42  for(ColumnMapArray& columnArray: m_data) {
43  columnArray.fill(MapCell());
44  }
45 }

References m_data.

Referenced by init().

Here is the caller graph for this function:

◆ decreaseStepCell()

void MapDataLayer::decreaseStepCell ( MapCell *  cellPtr)
inlineprivate

Definition at line 226 of file MapDataLayer.cpp.

226  {
227  // return; // TODO: remove
228  uint32_t updateDiff = m_updateStep - cellPtr->lastUpdateStep;
229  int decreaseValue = updateDiff * m_cellLineDecreasePerView;
230 
231  // decrease
232  if(decreaseValue < cellPtr->leftLine)
233  cellPtr->leftLine = cellPtr->leftLine - decreaseValue;
234  else
235  cellPtr->leftLine = 0;
236 
237  if(decreaseValue < cellPtr->centerLine)
238  cellPtr->centerLine = cellPtr->centerLine - decreaseValue;
239  else
240  cellPtr->centerLine = 0;
241 
242  if(decreaseValue < cellPtr->rightLine)
243  cellPtr->rightLine = cellPtr->rightLine - decreaseValue;
244  else
245  cellPtr->rightLine = 0;
246 
247  cellPtr->lastUpdateStep = m_updateStep;
248 }

References MapCell::centerLine, MapCell::lastUpdateStep, MapCell::leftLine, m_cellLineDecreasePerView, m_updateStep, and MapCell::rightLine.

◆ enableSimulationMode()

void MapDataLayer::enableSimulationMode ( )

Definition at line 48 of file MapDataLayer.cpp.

48  {
49  m_simulationMode = true;
50 }

References m_simulationMode.

Referenced by AutoPilotNode::AutoPilotNode().

Here is the caller graph for this function:

◆ getLineObject() [1/2]

std::shared_ptr< LinesObject< int16_t > > MapDataLayer::getLineObject ( Vector2f  absolutePositionCM,
float  absoluteOrientation,
Vector2i  windowSize,
Vector2i &  effectiveWindowSize 
)

Definition at line 133 of file MapDataLayer.cpp.

133  {
134  m_mapMutex.lock();
135 
136  // Eigen rotates COUNTER-clock wise!
137  Eigen::Rotation2Df rotationMatrix(-absoluteOrientation);
138  Eigen::Rotation2Df reverseRotationMatrix(absoluteOrientation);
139 
140  m_linesObjectSPtr->clear();
141  m_linesObjectSPtr->rotationMatrix = rotationMatrix;
142  m_linesObjectSPtr->reverseRotationMatrix = reverseRotationMatrix;
143 
144  absolutePositionCM += m_absoluteCarPositionOffset;
145  Vector2i absolutePositionInteger = Vector2i(std::round(absolutePositionCM[0]), std::round(absolutePositionCM[1]));
146 
147  // put larger rectangle above window for map iteration
148  Vector2f marginX = Vector2f(windowSize[0] / 2, 0);
149  Vector2f marginY = Vector2f(0, windowSize[1]);
150  marginX = rotationMatrix * marginX;
151  marginY = rotationMatrix * marginY;
152 
153  std::array<Vector2f, 4> windowEdges;
154  windowEdges[0] = absolutePositionCM - marginX;
155  windowEdges[1] = absolutePositionCM + marginX;
156  windowEdges[2] = windowEdges[0] + marginY;
157  windowEdges[3] = windowEdges[1] + marginY;
158 
159  Vector2i largerWindowBottomLeftCorner = Vector2i(std::round(map::utils::getMin(windowEdges, 0)), std::round(map::utils::getMin(windowEdges, 1)));
160  Vector2i largerWindowTopRightCorner = Vector2i(std::round(map::utils::getMax(windowEdges, 0)), std::round(map::utils::getMax(windowEdges, 1)));
161 
162  // check if lookup (axis aligned) window (larger window) inside of map
163  if(largerWindowBottomLeftCorner[0] < 0) {
164  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (X smaller than 0)");
165  largerWindowBottomLeftCorner[1] = 0;
166  }
167  if(largerWindowTopRightCorner[0] >= m_mapSize[0]) {
168  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (X larger than map)");
169  largerWindowTopRightCorner[0] = m_mapSize[0] - 1;
170  }
171  if(largerWindowBottomLeftCorner[1] < 0) {
172  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (Y smaller than 0)");
173  largerWindowBottomLeftCorner[1] = 0;
174  }
175  if(largerWindowTopRightCorner[1] >= m_mapSize[1]) {
176  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (Y larger than map)");
177  largerWindowTopRightCorner[1] = m_mapSize[1] - 1;
178  }
179 
180  // int largerWindowStepsPerThread = (largerWindowTopRightCorner[0] - largerWindowBottomLeftCorner[0]) / m_amountOfThreads;
181 
182  // assert(largerWindowStepsPerThread > 0);
183 
184  // int arrayStartX = largerWindowBottomLeftCorner[0];
185  // int arrayEndX = arrayStartX + largerWindowStepsPerThread;
186  // int arrayStartY = largerWindowBottomLeftCorner[1];
187  // int arrayEndY = largerWindowTopRightCorner[1];
188 
189  // for(int i = 0; i < m_amountOfThreads; ++i) {
190  // if(i == m_amountOfThreads - 1) {
191  // arrayEndX = largerWindowTopRightCorner[0] + 1;
192  // } else {
193  // arrayEndX = arrayStartX + largerWindowStepsPerThread;
194  // }
195 
196  // boost::asio::post(m_threadPool, std::bind(&MapDataLayer::iterateThroughMap, this, arrayStartX, arrayEndX, arrayStartY, arrayEndY, absolutePositionInteger));
197  // arrayStartX = arrayEndX;
198  // }
199 
200  iterateThroughMap(largerWindowBottomLeftCorner[0], largerWindowTopRightCorner[0] + 1, largerWindowBottomLeftCorner[1], largerWindowTopRightCorner[1], absolutePositionInteger);
201 
202  // m_threadPool.wait();
203  m_mapMutex.unlock();
204 
205  effectiveWindowSize[0] = largerWindowTopRightCorner[0] - largerWindowBottomLeftCorner[0];
206  assert(effectiveWindowSize[0] >= 0);
207  effectiveWindowSize[1] = largerWindowTopRightCorner[1] - largerWindowBottomLeftCorner[1];
208  assert(effectiveWindowSize[1] >= 0);
209 
210  return m_linesObjectSPtr;
211 }

References map::utils::getMax(), map::utils::getMin(), iterateThroughMap(), galaxis::utils::log_warning(), m_absoluteCarPositionOffset, m_linesObjectSPtr, m_mapMutex, and m_mapSize.

Here is the call graph for this function:

◆ getLineObject() [2/2]

std::shared_ptr< LinesObject< int16_t > > MapDataLayer::getLineObject ( Vector2f  absolutePositionCM,
float  lookBehindPosOffsetCM,
double  absoluteOrientation,
Vector2i  windowSize 
)

Definition at line 250 of file MapDataLayer.cpp.

250  {
251  m_mapMutex.lock();
252 
253  Eigen::Rotation2Df rotationMatrix(-absoluteOrientation);
254  Eigen::Rotation2Df reverseRotationMatrix(absoluteOrientation);
255 
256  Vector2f lookBehindVector = rotationMatrix * Vector2f(0.f, galaxis::autopilot::lookupLookBehindCarCM);
257 
258  m_linesObjectSPtr->clear();
259  m_linesObjectSPtr->rotationMatrix = rotationMatrix;
260  m_linesObjectSPtr->reverseRotationMatrix = reverseRotationMatrix;
261  m_linesObjectSPtr->rotateOrientation = -absoluteOrientation;
262 
263  absolutePositionCM += m_absoluteCarPositionOffset;
264  Vector2i absolutePositionInteger = Vector2i(std::round(absolutePositionCM[0]), std::round(absolutePositionCM[1]));
265 
266  // put larger rectangle above window for map iteration
267  Vector2f marginX = Vector2f(windowSize[0] / 2, 0);
268  Vector2f marginY = Vector2f(0, windowSize[1]);
269  marginX = rotationMatrix * marginX;
270  marginY = rotationMatrix * marginY;
271 
272  std::array<Vector2f, 4> windowEdges;
273  windowEdges[0] = absolutePositionCM - lookBehindVector - marginX; // left lower
274  windowEdges[1] = absolutePositionCM - lookBehindVector + marginX; // right lower
275  windowEdges[2] = windowEdges[0] + marginY; // left upper
276  windowEdges[3] = windowEdges[1] + marginY; // right upper
277 
278  Vector2i largerWindowBottomLeftCorner = Vector2i(std::round(map::utils::getMin(windowEdges, 0)), std::round(map::utils::getMin(windowEdges, 1)));
279  Vector2i largerWindowTopRightCorner = Vector2i(std::round(map::utils::getMax(windowEdges, 0)), std::round(map::utils::getMax(windowEdges, 1)));
280 
281  // check if lookup (axis aligned) window (larger window) inside of map
282  if(largerWindowBottomLeftCorner[0] < 0) {
283  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (X smaller than 0)");
284  largerWindowBottomLeftCorner[1] = 0;
285  }
286  if(largerWindowTopRightCorner[0] >= m_mapSize[0]) {
287  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (X larger than map)");
288  largerWindowTopRightCorner[0] = m_mapSize[0] - 1;
289  }
290  if(largerWindowBottomLeftCorner[1] < 0) {
291  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (Y smaller than 0)");
292  largerWindowBottomLeftCorner[1] = 0;
293  }
294  if(largerWindowTopRightCorner[1] >= m_mapSize[1]) {
295  log_warning("MapDataLayer::getLineObject: lookup (axis aligned) window size out of map size (Y larger than map)");
296  largerWindowTopRightCorner[1] = m_mapSize[1] - 1;
297  }
298 
299  int largerWindowStepsPerThread = (largerWindowTopRightCorner[0] - largerWindowBottomLeftCorner[0]) / m_amountOfThreads;
300 
301  int arrayStartX = largerWindowBottomLeftCorner[0];
302  int arrayEndX = arrayStartX + largerWindowStepsPerThread;
303  int arrayStartY = largerWindowBottomLeftCorner[1];
304  int arrayEndY = largerWindowTopRightCorner[1];
305 
306  for(int i = 0; i < m_amountOfThreads; ++i) {
307  if(i == m_amountOfThreads - 1) {
308  arrayEndX = largerWindowTopRightCorner[0] + 1;
309  } else {
310  arrayEndX = arrayStartX + largerWindowStepsPerThread;
311  }
312 
313  m_sharedThreadMutex.lock_shared();
314  boost::asio::post(m_threadPool, std::bind(&MapDataLayer::iterateThroughMap, this, arrayStartX, arrayEndX, arrayStartY, arrayEndY, absolutePositionInteger, windowEdges));
315  arrayStartX = arrayEndX;
316  }
317 
318  // wait for threads to complete
319  m_sharedThreadMutex.lock();
320  m_sharedThreadMutex.unlock();
321 
322  m_linesObjectSPtr->windowSize = Vector2i(largerWindowTopRightCorner[0] - largerWindowBottomLeftCorner[0], largerWindowTopRightCorner[1] - largerWindowBottomLeftCorner[1]);
323 
324  m_mapMutex.unlock();
325  return m_linesObjectSPtr;
326 }

References map::utils::getMax(), map::utils::getMin(), iterateThroughMap(), galaxis::utils::log_warning(), galaxis::autopilot::lookupLookBehindCarCM, m_absoluteCarPositionOffset, m_amountOfThreads, m_linesObjectSPtr, m_mapMutex, m_mapSize, m_sharedThreadMutex, and m_threadPool.

Referenced by AutoPilot::get_lane_centers(), LaneDetectionGT::loop(), and AutoPilotNode::send_full_map_debug_image().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObstacles()

std::shared_ptr< std::vector< StaticObstacle > > MapDataLayer::getObstacles ( rclcpp::Time const &  timestamp,
bool  removeOld = true 
)

Definition at line 375 of file MapDataLayer.cpp.

375  {
376  if(removeOld) {
377  // rm old obstacles
378  for(std::vector<StaticObstacle>::iterator it = m_staticObstacleVecSPtr->begin(); it != m_staticObstacleVecSPtr->end(); /* noop */) {
379  if (timestamp - it->get_last_update() > m_obstacleKeepDuration) {
380  it = m_staticObstacleVecSPtr->erase(it);
381  }
382  else {
383  ++it;
384  }
385  }
386  }
387 
389 }

References m_obstacleKeepDuration, and m_staticObstacleVecSPtr.

Referenced by AutoPilot::get_lane_blocked(), and AutoPilotNode::send_map_debug_image().

Here is the caller graph for this function:

◆ init() [1/2]

void MapDataLayer::init ( )

◆ init() [2/2]

void MapDataLayer::init ( )

Definition at line 28 of file MapDataLayer.cpp.

28  {
29  log("MapDataLayer:\n - Threads ", m_amountOfThreads, "\n - Map Size ", MAP_SIZE, "x", MAP_SIZE);
30 
33 
34  m_linesObjectSPtr = std::make_shared<LinesObject<int16_t>>();
35 
36  m_staticObstacleVecSPtr = std::make_shared<std::vector<StaticObstacle>>();
37 
38  clear();
39 }

References clear(), galaxis::utils::log(), m_absoluteCarPositionOffset, m_amountOfThreads, m_linesObjectSPtr, m_mapSize, m_staticObstacleVecSPtr, and MAP_SIZE.

Referenced by MapDataLayer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInImageIgnoreField()

bool MapDataLayer::isInImageIgnoreField ( Vector2f  p_position,
unsigned int  p_maxImageX 
)

Definition at line 115 of file MapDataLayer.cpp.

115  {
116  // check if in left ignore triangle
117  // y = m*x + n
118  float mLeftTriangle = static_cast<float>((imageIgnoreFieldArray[2] - imageIgnoreFieldArray[0])) / static_cast<float>(imageIgnoreFieldArray[1]);
119  float nLeftTriangle = imageIgnoreFieldArray[0];
120 
121  if(p_position[1] > mLeftTriangle * p_position[0] + nLeftTriangle) {
122  return true;
123  }
124 
125  // check if in ignore box
126  if(p_position[1] > imageIgnoreFieldArray[2] || p_position[1] > imageIgnoreFieldArray[4]) {
127  return true;
128  }
129 
130  // check if in right ignore triangle
131  // y = m*x + n
132  float mRightTriangle = static_cast<float>((imageIgnoreFieldArray[5] - imageIgnoreFieldArray[4])) / static_cast<float>((p_maxImageX - imageIgnoreFieldArray[3]));
133  float nRightTriangle = mRightTriangle * imageIgnoreFieldArray[3] - imageIgnoreFieldArray[4];
134 
135  if(p_position[1] > mRightTriangle * p_position[0] + nRightTriangle) {
136  return true;
137  }
138 
139  return false;
140 }

References galaxis::autopilot::imageIgnoreFieldArray.

Referenced by preprocessPoints().

Here is the caller graph for this function:

◆ iterateThroughMap() [1/2]

void MapDataLayer::iterateThroughMap ( int  arrayStartX,
int  arrayEndX,
int  arrayStartY,
int  arrayEndY,
Vector2i const &  absoluteCarPosition 
)
private

Definition at line 213 of file MapDataLayer.cpp.

213  {
214  MapCell const* cellPtr = nullptr;
215  for(int x = arrayStartX; x < arrayEndX; ++x) {
216  for(int y = arrayStartY; y <= arrayEndY; ++y) {
217  // append cell information to linesObject
218  cellPtr = &m_data[x][y];
219 
220  if(cellPtr->leftLine) {
221  m_linesObjectSPtr->leftLine.insert(x - absoluteCarPosition[0], y - absoluteCarPosition[1]);
222  }
223  if(cellPtr->centerLine) {
224  m_linesObjectSPtr->centerLine.insert(x - absoluteCarPosition[0], y - absoluteCarPosition[1]);
225  }
226  if(cellPtr->rightLine) {
227  m_linesObjectSPtr->rightLine.insert(x - absoluteCarPosition[0], y - absoluteCarPosition[1]);
228  }
229  }
230  }
231 }

References MapCell::centerLine, MapCell::leftLine, m_data, m_linesObjectSPtr, and MapCell::rightLine.

◆ iterateThroughMap() [2/2]

void MapDataLayer::iterateThroughMap ( int  arrayStartX,
int  arrayEndX,
int  arrayStartY,
int  arrayEndY,
Vector2i const &  absoluteCarPosition,
std::array< Vector2f, 4 > const &  windowEdges 
)
private

Definition at line 334 of file MapDataLayer.cpp.

334  {
335  MapCell* cellPtr = nullptr;
336  for(int x = arrayStartX; x < arrayEndX; ++x) {
337  for(int y = arrayStartY; y <= arrayEndY; ++y) {
338  // check if point lies in smaller/real window NOT only in larger Window
339  if ( checkPositionRelativeToEdge(windowEdges[0][0], windowEdges[0][1], windowEdges[2][0], windowEdges[2][1], x, y) > 0 // left edge
340  || checkPositionRelativeToEdge(windowEdges[2][0], windowEdges[2][1], windowEdges[3][0], windowEdges[3][1], x, y) > 0 // upper edge
341  || checkPositionRelativeToEdge(windowEdges[3][0], windowEdges[3][1], windowEdges[1][0], windowEdges[1][1], x, y) > 0 // right edge
342  || checkPositionRelativeToEdge(windowEdges[1][0], windowEdges[1][1], windowEdges[0][0], windowEdges[0][1], x, y) > 0 // lower edge
343  ){
344  continue;
345  }
346 
347  // append cell information to linesObject
348  cellPtr = &m_data[x][y];
349 
350  // clean
351  // decreaseStepCell(cellPtr);
352  if(m_updateStep - cellPtr->lastUpdateStep > 20) { //&& (!cellPtr->imageIgnoreField || m_updateStep - cellPtr->lastUpdateStep > 5)) {
353  cellPtr->leftLine = 0;
354  cellPtr->centerLine = 0;
355  cellPtr->rightLine = 0;
356  continue;
357  }
358 
359  if(cellPtr->leftLine > m_cellThresholdExtract) {
360  m_linesObjectSPtr->leftLine.insert(x - absoluteCarPosition[0], y - absoluteCarPosition[1]);
361  }
362  if(cellPtr->centerLine > m_cellThresholdExtract) {
363  m_linesObjectSPtr->centerLine.insert(x - absoluteCarPosition[0], y - absoluteCarPosition[1]);
364  }
365  if(cellPtr->rightLine > m_cellThresholdExtract) {
366  m_linesObjectSPtr->rightLine.insert(x - absoluteCarPosition[0], y - absoluteCarPosition[1]);
367  }
368  }
369  }
370 
371  m_sharedThreadMutex.unlock_shared();
372 }

References MapCell::centerLine, checkPositionRelativeToEdge(), MapCell::lastUpdateStep, MapCell::leftLine, m_cellThresholdExtract, m_data, m_linesObjectSPtr, m_sharedThreadMutex, m_updateStep, and MapCell::rightLine.

Referenced by getLineObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ preprocessPoints()

void MapDataLayer::preprocessPoints ( const sensor_msgs::msg::Image::ConstSharedPtr &  laneDetectionSPtr,
Vector2f const &  currentPositionCM,
int  arrayOffsetStartIndex,
int  arrayOffsetEndIndex,
double  currentAbsoluteOrientation 
)
private

Definition at line 142 of file MapDataLayer.cpp.

142  {
143  // TODO: position and orientation of car at recorded MapContents Message (history)
144 
145  Eigen::Rotation2Df rotationMatrix(-currentAbsoluteOrientation);
146 
147  // num of rows == height == Y, num of columns == width == X
148 
149  int pixelLengthInBytes = laneDetectionSPtr->step / laneDetectionSPtr->width;
150  for(int index = arrayOffsetStartIndex; index < arrayOffsetEndIndex; index += pixelLengthInBytes) {
151  int posXOriginal = (index % laneDetectionSPtr->step) / pixelLengthInBytes;
152  int posYOriginal = static_cast<int>(index / laneDetectionSPtr->step);
153 
154  // image position conversion to map positions
155  int posX = posXOriginal - laneDetectionSPtr->width / 2;
156  int posY = laneDetectionSPtr->height - posYOriginal;
157  Vector2f absoluteCellPosition = Vector2f(posX, posY) * m_laneImagePixelToPositionConversionFactor;
158  absoluteCellPosition = rotationMatrix * absoluteCellPosition;
159  absoluteCellPosition += currentPositionCM + m_absoluteCarPositionOffset;
160 
161  MapCell cellUpdate;
162  cellUpdate.leftLine = laneDetectionSPtr->data[index + galaxis::autopilot::imageLLinePixelByteIndex];
163  cellUpdate.centerLine = laneDetectionSPtr->data[index + galaxis::autopilot::imageCLinePixelByteIndex];
164  cellUpdate.rightLine = laneDetectionSPtr->data[index + galaxis::autopilot::imageRLinePixelByteIndex];
165 
166  Vector2i absoluteCellPositionOnGrid = Vector2i(std::round(absoluteCellPosition[0]), std::round(absoluteCellPosition[1]));
167 
168 
169  // skip Image Ignore Fields
170  if (!m_simulationMode && isInImageIgnoreField(Vector2f(posXOriginal, posYOriginal), laneDetectionSPtr->width)) {
171  m_data[absoluteCellPositionOnGrid[0]][absoluteCellPositionOnGrid[1]].imageIgnoreField = true;
172  }
173  else {
174  updateCell(cellUpdate, absoluteCellPositionOnGrid);
175  }
176  }
177 
178  m_sharedThreadMutex.unlock_shared();
179 }

References MapCell::centerLine, galaxis::autopilot::imageCLinePixelByteIndex, galaxis::autopilot::imageLLinePixelByteIndex, galaxis::autopilot::imageRLinePixelByteIndex, isInImageIgnoreField(), MapCell::leftLine, m_absoluteCarPositionOffset, m_data, m_laneImagePixelToPositionConversionFactor, m_sharedThreadMutex, m_simulationMode, MapCell::rightLine, and updateCell().

Referenced by updateMap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCellLineDecreasePerView()

void MapDataLayer::setCellLineDecreasePerView ( uint8_t  value)

Definition at line 66 of file MapDataLayer.cpp.

66  {
68 }

References m_cellLineDecreasePerView.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ setCellLineIncreasePerView()

void MapDataLayer::setCellLineIncreasePerView ( uint8_t  value)

Definition at line 69 of file MapDataLayer.cpp.

69  {
71 }

References m_cellLineIncreasePerView.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ setCellThresholdExtract()

void MapDataLayer::setCellThresholdExtract ( uint8_t  value)

Definition at line 63 of file MapDataLayer.cpp.

63  {
64  m_cellThresholdExtract = value;
65 }

References m_cellThresholdExtract.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ setCellThresholdRGBValue()

void MapDataLayer::setCellThresholdRGBValue ( uint8_t  value)

Definition at line 60 of file MapDataLayer.cpp.

60  {
62 }

References m_cellThresholdRGBValue.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ setLaneImageConversionFactor()

void MapDataLayer::setLaneImageConversionFactor ( float  factor)

Definition at line 72 of file MapDataLayer.cpp.

72  {
74 }

References m_laneImagePixelToPositionConversionFactor.

Referenced by AutoPilotNode::AutoPilotNode().

Here is the caller graph for this function:

◆ setLookupWindowSizeCMHeight()

void MapDataLayer::setLookupWindowSizeCMHeight ( int  value)

Definition at line 54 of file MapDataLayer.cpp.

54  {
56 }

References m_lookupWindowSizeCMHeight.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ setLookupWindowSizeCMWidth()

void MapDataLayer::setLookupWindowSizeCMWidth ( int  value)

Definition at line 51 of file MapDataLayer.cpp.

51  {
53 }

References m_lookupWindowSizeCMWidth.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ setObstaclePositionDiffForRerecognition()

void MapDataLayer::setObstaclePositionDiffForRerecognition ( float  diff)

Definition at line 75 of file MapDataLayer.cpp.

75  {
77 }

References m_obstaclePositionDiffForRerecognitionCM.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ setObstacleTrackTimeDuration()

void MapDataLayer::setObstacleTrackTimeDuration ( int  sec,
int  nsec 
)

Definition at line 78 of file MapDataLayer.cpp.

78  {
79  m_obstacleKeepDuration = rclcpp::Duration(sec, nsec);
80 }

References m_obstacleKeepDuration.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ updateCell() [1/2]

void MapDataLayer::updateCell ( MapCell const &  cellUpdate,
Vector2i  position 
)
inlineprivate

Definition at line 181 of file MapDataLayer.cpp.

181  {
182  if(position[0] < 0 || position[0] >= m_mapSize[0] || position[1] < 0 || position[1] >= m_mapSize[1]) {
183  log_warning("MapDataLayer::updateCell: cannot update Cell (out of bounds) at Position (", position[0], ",", position[1], ")");
184  return;
185  }
186 
187  MapCell* cellPtr = &m_data[position[0]][position[1]];
188 
189  // decrease
190  // decreaseStepCell(cellPtr);
191 
192  // increase
193  if(cellUpdate.leftLine > m_cellThresholdRGBValue) {
194  // int value = cellPtr->leftLine;
195  // value += m_cellLineIncreasePerView;
196  // cellPtr->leftLine = value > MAPCELL_MAXVALUE ? MAPCELL_MAXVALUE : value;
197  cellPtr->leftLine = 255;
198  }
199  else {
200  cellPtr->leftLine = 0;
201  }
202  if(cellUpdate.centerLine > m_cellThresholdRGBValue) {
203  // int value = cellPtr->centerLine;
204  // value += m_cellLineIncreasePerView;
205  // cellPtr->centerLine = value > MAPCELL_MAXVALUE ? MAPCELL_MAXVALUE : value;
206  cellPtr->centerLine = 255;
207  }
208  else {
209  cellPtr->centerLine = 0;
210  }
211  if(cellUpdate.rightLine > m_cellThresholdRGBValue) {
212  // int value = cellPtr->rightLine;
213  // value += m_cellLineIncreasePerView;
214  // cellPtr->rightLine = value > MAPCELL_MAXVALUE ? MAPCELL_MAXVALUE : value;
215  cellPtr->rightLine = 255;
216  }
217  else {
218  cellPtr->rightLine = 0;
219  }
220 
221  cellPtr->imageIgnoreField = false;
222 
223  cellPtr->lastUpdateStep = m_updateStep;
224 }

References MapCell::centerLine, MapCell::imageIgnoreField, MapCell::lastUpdateStep, MapCell::leftLine, galaxis::utils::log_warning(), m_cellThresholdRGBValue, m_data, m_mapSize, m_updateStep, and MapCell::rightLine.

Referenced by preprocessPoints(), and updateMap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateCell() [2/2]

void MapDataLayer::updateCell ( Vector2i  position,
char  laneType 
)
private

Definition at line 116 of file MapDataLayer.cpp.

116  {
117  if(position[0] < 0 || position[0] >= m_mapSize[0] || position[1] < 0 || position[1] >= m_mapSize[1]) {
118  log_warning("MapDataLayer::updateCell: cannot update Cell (out of bounds) at Position (", position[0], ",", position[1], ")");
119  return;
120  }
121 
122  MapCell* cellPtr = &m_data[position[0]][position[1]];
123  if (laneType == 'l')
124  cellPtr->leftLine = true;
125  else if (laneType == 'c')
126  cellPtr->centerLine = true;
127  else if (laneType == 'r')
128  cellPtr->rightLine = true;
129  else
130  log_warning("Failure to updateMap. Wrong lanetype parameter value (l,c,r)");
131 }

References MapCell::centerLine, MapCell::leftLine, galaxis::utils::log_warning(), m_data, m_mapSize, and MapCell::rightLine.

Here is the call graph for this function:

◆ updateMap() [1/2]

void MapDataLayer::updateMap ( const sensor_msgs::msg::Image::ConstSharedPtr &  laneDetectionSPtr,
Vector2f  currentAbsoluteCarPositionCM,
double  currentAbsoluteOrientation 
)

Definition at line 83 of file MapDataLayer.cpp.

83  {
84  // TODO: check update rate of vision (MapContentsType); maybe check at runtime
85  m_mapMutex.lock();
86  // Increment Update Step
87  m_updateStep++;
88 
89  int pixelLengthInBytes = laneDetectionSPtr->step / laneDetectionSPtr->width;
90 
91  int arrayStartIndex = 0;
92  int arrayWindowSizePerThread = (laneDetectionSPtr->height * laneDetectionSPtr->step) / m_amountOfThreads;
93  arrayWindowSizePerThread -= arrayWindowSizePerThread % pixelLengthInBytes;
94  int arrayEndIndex = arrayStartIndex + arrayWindowSizePerThread;
95  // split message and run preprocessPoints function on multiple threads in pool
96  for(int i = 0; i < m_amountOfThreads; ++i) {
97  if(i == m_amountOfThreads - 1) {
98  arrayEndIndex = (laneDetectionSPtr->height * laneDetectionSPtr->step) - 1;
99  } else {
100  arrayEndIndex = arrayStartIndex + arrayWindowSizePerThread;
101  }
102 
103  m_sharedThreadMutex.lock_shared();
104  boost::asio::post(m_threadPool, std::bind(&MapDataLayer::preprocessPoints, this, laneDetectionSPtr, currentAbsoluteCarPositionCM, arrayStartIndex, arrayEndIndex, currentAbsoluteOrientation));
105  arrayStartIndex = arrayEndIndex;
106  }
107 
108  // wait for threads to complete
109  m_sharedThreadMutex.lock();
110  m_sharedThreadMutex.unlock();
111 
112  m_mapMutex.unlock();
113 }

References m_amountOfThreads, m_mapMutex, m_sharedThreadMutex, m_threadPool, m_updateStep, and preprocessPoints().

Referenced by LaneDetectionGT::groundtruthCallback(), and AutoPilotNode::on_vci_lane_detection_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateMap() [2/2]

void MapDataLayer::updateMap ( visualization_msgs::msg::Marker::SharedPtr  laneDetectionSPtr,
char  laneType 
)

Definition at line 49 of file MapDataLayer.cpp.

49  {
50  // single-threaded
51  m_mapMutex.lock();
52 
53  bool usable = false;
54  geometry_msgs::msg::Point* lastPoint;
55 
56  if (laneType == 'l') {
58  lastPoint = &m_lastPointLeftLane;
59  }
60  else if (laneType == 'c') {
62  lastPoint = &m_lastPointCenterLane;
63  }
64  else if (laneType == 'r') {
66  lastPoint = &m_lastPointRightLane;
67  }
68 
69  for(geometry_msgs::msg::Point& point : laneDetectionSPtr->points) {
70  if (usable == false) {
71  lastPoint = &point;
72  usable = true;
73  continue;
74  }
75 
76  // approximate between points in 1cm steps
77  double distanceCM = sqrt((point.x - lastPoint->x)*(point.x - lastPoint->x) + (point.y - lastPoint->y)*(point.y - lastPoint->y)) * 100;
78  if (distanceCM <= 1) {
79  distanceCM = 1;
80  // log_warning("Fix distanceCM.");
81  }
82 
83  double distanceX = lastPoint->x - point.x; // in meter
84  double distanceY = lastPoint->y - point.y; // in meter
85  for (double p = 0; p < 1; p += 1/distanceCM) {
86  double pointX = point.x + p * distanceX;
87  double pointY = point.y + p * distanceY;
88  pointX *= 100; // to CM
89  pointY *= 100; // to CM
90 
91  Vector2i absoluteCellPositionOnGrid = Vector2i(std::round(pointX), std::round(pointY));
92  absoluteCellPositionOnGrid[0] += static_cast<int>(m_absoluteCarPositionOffset[0]);
93  absoluteCellPositionOnGrid[1] += static_cast<int>(m_absoluteCarPositionOffset[1]);
94 
95  updateCell(absoluteCellPositionOnGrid, laneType);
96  }
97 
98  lastPoint = &point;
99  }
100 
101  if (laneType == 'l') {
102  m_lastPointLeftLane = *lastPoint;
104  }
105  else if (laneType == 'c') {
106  m_lastPointCenterLane = *lastPoint;
108  }
109  else if (laneType == 'r') {
110  m_lastPointRightLane = *lastPoint;
112  }
113  m_mapMutex.unlock();
114 }

References m_absoluteCarPositionOffset, m_lastPointCenterLane, m_lastPointCenterLaneUsable, m_lastPointLeftLane, m_lastPointLeftLaneUsable, m_lastPointRightLane, m_lastPointRightLaneUsable, m_mapMutex, and updateCell().

Here is the call graph for this function:

Member Data Documentation

◆ m_absoluteCarPositionOffset

Vector2f MapDataLayer::m_absoluteCarPositionOffset
private

Definition at line 72 of file MapDataLayer.hpp.

Referenced by getLineObject(), init(), preprocessPoints(), and updateMap().

◆ m_amountOfThreads

int MapDataLayer::m_amountOfThreads
private

Definition at line 63 of file MapDataLayer.hpp.

Referenced by getLineObject(), init(), MapDataLayer(), and updateMap().

◆ m_cellLineDecreasePerView

uint8_t MapDataLayer::m_cellLineDecreasePerView = 100

Definition at line 83 of file MapDataLayer.hpp.

Referenced by decreaseStepCell(), and setCellLineDecreasePerView().

◆ m_cellLineIncreasePerView

uint8_t MapDataLayer::m_cellLineIncreasePerView = 100

Definition at line 84 of file MapDataLayer.hpp.

Referenced by setCellLineIncreasePerView().

◆ m_cellThresholdExtract

uint8_t MapDataLayer::m_cellThresholdExtract = 99

Definition at line 82 of file MapDataLayer.hpp.

Referenced by iterateThroughMap(), and setCellThresholdExtract().

◆ m_cellThresholdRGBValue

uint8_t MapDataLayer::m_cellThresholdRGBValue = 80

Definition at line 81 of file MapDataLayer.hpp.

Referenced by setCellThresholdRGBValue(), and updateCell().

◆ m_data

MapArray MapDataLayer::m_data
private

Definition at line 67 of file MapDataLayer.hpp.

Referenced by clear(), iterateThroughMap(), preprocessPoints(), and updateCell().

◆ m_laneImagePixelToPositionConversionFactor

float MapDataLayer::m_laneImagePixelToPositionConversionFactor = 1.5625f

Definition at line 85 of file MapDataLayer.hpp.

Referenced by preprocessPoints(), and setLaneImageConversionFactor().

◆ m_lastPointCenterLane

geometry_msgs::msg::Point MapDataLayer::m_lastPointCenterLane
private

Definition at line 49 of file MapDataLayer.hpp.

Referenced by updateMap().

◆ m_lastPointCenterLaneUsable

bool MapDataLayer::m_lastPointCenterLaneUsable = false
private

Definition at line 50 of file MapDataLayer.hpp.

Referenced by updateMap().

◆ m_lastPointLeftLane

geometry_msgs::msg::Point MapDataLayer::m_lastPointLeftLane
private

Definition at line 47 of file MapDataLayer.hpp.

Referenced by updateMap().

◆ m_lastPointLeftLaneUsable

bool MapDataLayer::m_lastPointLeftLaneUsable = false
private

Definition at line 48 of file MapDataLayer.hpp.

Referenced by updateMap().

◆ m_lastPointRightLane

geometry_msgs::msg::Point MapDataLayer::m_lastPointRightLane
private

Definition at line 51 of file MapDataLayer.hpp.

Referenced by updateMap().

◆ m_lastPointRightLaneUsable

bool MapDataLayer::m_lastPointRightLaneUsable = false
private

Definition at line 52 of file MapDataLayer.hpp.

Referenced by updateMap().

◆ m_linesObjectSPtr

std::shared_ptr< LinesObject< int16_t > > MapDataLayer::m_linesObjectSPtr
private

Definition at line 74 of file MapDataLayer.hpp.

Referenced by getLineObject(), init(), and iterateThroughMap().

◆ m_lookupWindowSizeCMHeight

◆ m_lookupWindowSizeCMWidth

int MapDataLayer::m_lookupWindowSizeCMWidth = 160

◆ m_mapMutex

std::mutex MapDataLayer::m_mapMutex
private

Definition at line 69 of file MapDataLayer.hpp.

Referenced by getLineObject(), and updateMap().

◆ m_mapSize

Vector2f MapDataLayer::m_mapSize
private

Definition at line 68 of file MapDataLayer.hpp.

Referenced by getLineObject(), init(), and updateCell().

◆ m_obstacleKeepDuration

rclcpp::Duration MapDataLayer::m_obstacleKeepDuration

Definition at line 90 of file MapDataLayer.hpp.

Referenced by getObstacles(), and setObstacleTrackTimeDuration().

◆ m_obstaclePositionDiffForRerecognitionCM

float MapDataLayer::m_obstaclePositionDiffForRerecognitionCM = 40.0

◆ m_sharedThreadMutex

std::shared_mutex MapDataLayer::m_sharedThreadMutex
private

Definition at line 64 of file MapDataLayer.hpp.

Referenced by getLineObject(), iterateThroughMap(), preprocessPoints(), and updateMap().

◆ m_simulationMode

bool MapDataLayer::m_simulationMode = false
private

Definition at line 60 of file MapDataLayer.hpp.

Referenced by enableSimulationMode(), and preprocessPoints().

◆ m_staticObstacleVecSPtr

std::shared_ptr<std::vector<StaticObstacle> > MapDataLayer::m_staticObstacleVecSPtr

Definition at line 89 of file MapDataLayer.hpp.

Referenced by addOrUpdateStaticObstacle(), getObstacles(), and init().

◆ m_threadPool

boost::asio::thread_pool MapDataLayer::m_threadPool
private

Definition at line 62 of file MapDataLayer.hpp.

Referenced by getLineObject(), updateMap(), and ~MapDataLayer().

◆ m_updateStep

std::atomic<uint32_t> MapDataLayer::m_updateStep = 0
private

Definition at line 70 of file MapDataLayer.hpp.

Referenced by decreaseStepCell(), iterateThroughMap(), updateCell(), and updateMap().


The documentation for this class was generated from the following files:
StationaryBeaconPosition::x
int32_t x
Definition: marvelmind.h:76
MapDataLayer::m_lastPointCenterLane
geometry_msgs::msg::Point m_lastPointCenterLane
Definition: MapDataLayer.hpp:49
MapDataLayer::m_amountOfThreads
int m_amountOfThreads
Definition: MapDataLayer.hpp:63
MapDataLayer::m_staticObstacleVecSPtr
std::shared_ptr< std::vector< StaticObstacle > > m_staticObstacleVecSPtr
Definition: MapDataLayer.hpp:89
StationaryBeaconPosition::y
int32_t y
Definition: marvelmind.h:76
MapDataLayer::iterateThroughMap
void iterateThroughMap(int arrayStartX, int arrayEndX, int arrayStartY, int arrayEndY, Vector2i const &absoluteCarPosition, std::array< Vector2f, 4 > const &windowEdges)
Definition: MapDataLayer.cpp:334
MapDataLayer::m_laneImagePixelToPositionConversionFactor
float m_laneImagePixelToPositionConversionFactor
Definition: MapDataLayer.hpp:85
galaxis::autopilot::imageCLinePixelByteIndex
constexpr int imageCLinePixelByteIndex
Definition: AutopilotSettings.hpp:30
galaxis::autopilot::lookupLookBehindCarCM
constexpr int lookupLookBehindCarCM
Definition: AutopilotSettings.hpp:38
MapCell::centerLine
uint8_t centerLine
Definition: MapDataLayer.hpp:47
galaxis::utils::log_warning
void log_warning(const Args &... args)
Definition: logger.hpp:41
MapDataLayer::m_lastPointLeftLaneUsable
bool m_lastPointLeftLaneUsable
Definition: MapDataLayer.hpp:48
MapDataLayer::clear
void clear()
Definition: MapDataLayer.cpp:41
MapDataLayer::checkPositionRelativeToEdge
float checkPositionRelativeToEdge(int x1, int y1, int x2, int y2, int xp, int yp)
Definition: MapDataLayer.cpp:328
MapDataLayer::m_lastPointCenterLaneUsable
bool m_lastPointCenterLaneUsable
Definition: MapDataLayer.hpp:50
MapCell::lastUpdateStep
uint32_t lastUpdateStep
Definition: MapDataLayer.hpp:50
MapDataLayer::updateCell
void updateCell(MapCell const &cellUpdate, Vector2i position)
Definition: MapDataLayer.cpp:181
MapDataLayer::m_mapSize
Vector2f m_mapSize
Definition: MapDataLayer.hpp:68
MapDataLayer::preprocessPoints
void preprocessPoints(const sensor_msgs::msg::Image::ConstSharedPtr &laneDetectionSPtr, Vector2f const &currentPositionCM, int arrayOffsetStartIndex, int arrayOffsetEndIndex, double currentAbsoluteOrientation)
Definition: MapDataLayer.cpp:142
map::utils::getMin
float getMin(std::array< galaxis::lina::Vector2f, 4 > const &array, int index)
Definition: MapUtils.hpp:10
MapDataLayer::m_simulationMode
bool m_simulationMode
Definition: MapDataLayer.hpp:60
MapDataLayer::m_lastPointRightLane
geometry_msgs::msg::Point m_lastPointRightLane
Definition: MapDataLayer.hpp:51
MapDataLayer::isInImageIgnoreField
bool isInImageIgnoreField(Vector2f p_position, unsigned int p_maxImageX)
Definition: MapDataLayer.cpp:115
MapCell::leftLine
uint8_t leftLine
Definition: MapDataLayer.hpp:46
MapCell::rightLine
uint8_t rightLine
Definition: MapDataLayer.hpp:48
map::utils::getMax
float getMax(std::array< galaxis::lina::Vector2f, 4 > const &array, int index)
Definition: MapUtils.hpp:20
MapDataLayer::m_data
MapArray m_data
Definition: MapDataLayer.hpp:67
MapDataLayer::m_linesObjectSPtr
std::shared_ptr< LinesObject< int16_t > > m_linesObjectSPtr
Definition: MapDataLayer.hpp:74
MapDataLayer::m_updateStep
std::atomic< uint32_t > m_updateStep
Definition: MapDataLayer.hpp:70
MapDataLayer::m_absoluteCarPositionOffset
Vector2f m_absoluteCarPositionOffset
Definition: MapDataLayer.hpp:72
galaxis::autopilot::imageLLinePixelByteIndex
constexpr int imageLLinePixelByteIndex
Definition: AutopilotSettings.hpp:29
MapCell
Definition: MapDataLayer.hpp:45
MAP_SIZE
constexpr int MAP_SIZE
Definition: MapDataLayer.hpp:53
galaxis::autopilot::imageIgnoreFieldArray
constexpr std::array< unsigned int, 6 > imageIgnoreFieldArray
Definition: AutopilotSettings.hpp:35
galaxis::lina::Vector2f
Eigen::Vector2f Vector2f
Definition: linatypes.hpp:14
MapCell::imageIgnoreField
bool imageIgnoreField
Definition: MapDataLayer.hpp:49
MapDataLayer::m_sharedThreadMutex
std::shared_mutex m_sharedThreadMutex
Definition: MapDataLayer.hpp:64
MapDataLayer::m_cellThresholdRGBValue
uint8_t m_cellThresholdRGBValue
Definition: MapDataLayer.hpp:81
MapDataLayer::m_mapMutex
std::mutex m_mapMutex
Definition: MapDataLayer.hpp:69
MapDataLayer::m_lastPointLeftLane
geometry_msgs::msg::Point m_lastPointLeftLane
Definition: MapDataLayer.hpp:47
galaxis::autopilot::imageRLinePixelByteIndex
constexpr int imageRLinePixelByteIndex
Definition: AutopilotSettings.hpp:31
map::classes::StaticObstacle
Definition: MapClasses.hpp:107
MapDataLayer::ColumnMapArray
std::array< MapCell, MAP_SIZE > ColumnMapArray
Definition: MapDataLayer.hpp:56
MapDataLayer::m_lastPointRightLaneUsable
bool m_lastPointRightLaneUsable
Definition: MapDataLayer.hpp:52
MapDataLayer::m_lookupWindowSizeCMHeight
int m_lookupWindowSizeCMHeight
Definition: MapDataLayer.hpp:79
galaxis::lina::Vector2i
Eigen::Vector2i Vector2i
Definition: linatypes.hpp:13
MapDataLayer::m_obstacleKeepDuration
rclcpp::Duration m_obstacleKeepDuration
Definition: MapDataLayer.hpp:90
MapDataLayer::m_cellLineIncreasePerView
uint8_t m_cellLineIncreasePerView
Definition: MapDataLayer.hpp:84
MapDataLayer::init
void init()
Definition: MapDataLayer.cpp:28
MapDataLayer::m_obstaclePositionDiffForRerecognitionCM
float m_obstaclePositionDiffForRerecognitionCM
Definition: MapDataLayer.hpp:86
galaxis::utils::log
void log(const Args &... args)
Definition: logger.hpp:33
MapDataLayer::m_threadPool
boost::asio::thread_pool m_threadPool
Definition: MapDataLayer.hpp:62
MapDataLayer::m_cellThresholdExtract
uint8_t m_cellThresholdExtract
Definition: MapDataLayer.hpp:82
MapDataLayer::m_lookupWindowSizeCMWidth
int m_lookupWindowSizeCMWidth
Definition: MapDataLayer.hpp:78
MapDataLayer::m_cellLineDecreasePerView
uint8_t m_cellLineDecreasePerView
Definition: MapDataLayer.hpp:83