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

#include <AutoPilot.hpp>

Collaboration diagram for AutoPilot:

Public Member Functions

 AutoPilot ()=delete
 
 AutoPilot (GalaxisNode *p_gNodePtr)
 
 ~AutoPilot ()
 
void set_obstacle_lookup_distance (int value)
 
void set_obstacle_lookup_distance_step (float value)
 
void set_obstacle_to_lane_center_min_distance_for_dodge (float value)
 
void set_polynom_degree (int value)
 
void set_polynom_min_points_amount (int value)
 
void set_traj_points_to_append_amount (int value)
 
void set_traj_points_start_appending_offset (int value)
 
void set_line_cluster_eps (int value)
 
void set_line_cluster_min_pts (int value)
 
void set_line_polynom_evaluation_step (int value)
 
void set_line_polynom_evaluation_step_size (int value)
 
void set_min_number_of_clustered_line_points (int value)
 
std::shared_ptr< DriveInformation_t > get_drive_information ()
 
double eval_poly (DynamicPolynom p_polynom, double p_x)
 

Public Attributes

MapDataLayer m_mapDataLayer
 
Localizer m_localizer
 
Decision m_decision
 
std::shared_ptr< LinesObject< int16_t > > m_linesObject
 
std::unique_ptr< std::pair< std::vector< galaxis::lina::Vector2f >, std::vector< galaxis::lina::Vector2f > > > m_laneCentersPairVecUPtr
 
std::pair< DynamicPolynom, DynamicPolynom > m_lanePolynom
 
std::shared_ptr< DriveInformation_t > m_lastDriveInformationSPtr
 
std::vector< double > m_polynomPointsXVector
 
std::vector< double > m_polynomPointsYVector
 
int m_obstacleLookupDistanceCM = 200
 
int m_obstacleLookupDistanceStepCM = 5
 
int m_obstacleToLaneCenterMinimumDistanceForDodge = 10
 
int m_polynomDegree = 3
 
int m_polynomMinimumPointsAmount = 30
 
int m_trajPointsToAppendAmount = 5
 
int m_trajPointsStartAppendingOffset = 20
 
int m_lineClusterEps = 2
 
int m_lineClusterMinPts = 2
 
int m_linePolynomEvaluationStepCM = 1
 
int m_linePolynomEvaluationStepSizeCM = 8
 
int m_minNumberOfClusteredLinePoints = 20
 
std::shared_ptr< std::vector< Vector2f > > m_leftLinePolynomPointsVecSPtr
 
std::shared_ptr< std::vector< Vector2f > > m_rightLinePolynomPointsVecSPtr
 

Private Member Functions

void cluster_line_object (std::map< int16_t, std::vector< int16_t >> &linePointsMapInputRef, std::shared_ptr< std::map< int16_t, int16_t >> linePointsOutVecSPtr)
 
std::unique_ptr< std::pair< std::vector< galaxis::lina::Vector2f >, std::vector< galaxis::lina::Vector2f > > > get_lane_centers (std::shared_ptr< PositionTimepoint > positionTimepoint)
 
std::unique_ptr< std::pair< std::vector< galaxis::lina::Vector2f >, std::vector< galaxis::lina::Vector2f > > > get_lane_center ()
 
void get_lane_centers_thread_helper (Eigen::Rotation2Df p_reverseRotationMat, std::shared_ptr< std::map< int16_t, int16_t >> p_leftLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_centerLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_rightLinePointsMapSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_leftLaneMutexedVecSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_rightLaneMutexedVecSPtr, bool p_yxMapping)
 
void get_lane_centers_via_polynom_thread_helper (Eigen::Rotation2Df p_reverseRotationMat, std::shared_ptr< std::map< int16_t, int16_t >> p_leftLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_centerLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_rightLinePointsMapSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_leftLaneMutexedVecSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_rightLaneMutexedVecSPtr)
 
void insert_lane_point (std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_mutVecPointerSPtr, float p_x, float p_y, Eigen::Rotation2Df const &p_rotationMat, bool p_reverseInsertion)
 
std::tuple< float, float, float, float > get_lane_blocked (std::pair< DynamicPolynom, DynamicPolynom > &lanePolynom)
 

Private Attributes

GalaxisNode * m_gNodePtr
 
boost::asio::thread_pool m_threadPool
 
std::shared_mutex m_sharedThreadMutex
 
std::shared_ptr< std::map< int16_t, int16_t > > m_leftLineXYTmpVecSPtr
 
std::shared_ptr< std::map< int16_t, int16_t > > m_centerLineXYTmpVecSPtr
 
std::shared_ptr< std::map< int16_t, int16_t > > m_rightLineXYTmpVecSPtr
 
std::shared_ptr< std::map< int16_t, int16_t > > m_leftLineYXTmpVecSPtr
 
std::shared_ptr< std::map< int16_t, int16_t > > m_centerLineYXTmpVecSPtr
 
std::shared_ptr< std::map< int16_t, int16_t > > m_rightLineYXTmpVecSPtr
 
std::shared_ptr< std::vector< double > > m_leftLinePolynomXVectorSPtr
 
std::shared_ptr< std::vector< double > > m_leftLinePolynomYVectorSPtr
 
std::shared_ptr< std::vector< double > > m_centerLinePolynomXVectorSPtr
 
std::shared_ptr< std::vector< double > > m_centerLinePolynomYVectorSPtr
 
std::shared_ptr< std::vector< double > > m_rightLinePolynomXVectorSPtr
 
std::shared_ptr< std::vector< double > > m_rightLinePolynomYVectorSPtr
 
std::tuple< float, float, float, float > m_laneBlocked
 
double m_leftPolyMax
 
double m_leftPolyMin
 
std::shared_ptr< std::vector< double > > m_leftLinePoly
 
double m_centerPolyMax
 
double m_centerPolyMin
 
std::shared_ptr< std::vector< double > > m_centerLinePoly
 
double m_rightPolyMax
 
double m_rightPolyMin
 
std::shared_ptr< std::vector< double > > m_rightLinePoly
 
rclcpp::Time m_lastTimeLaneVisible
 

Detailed Description

Definition at line 46 of file AutoPilot.hpp.

Constructor & Destructor Documentation

◆ AutoPilot() [1/2]

AutoPilot::AutoPilot ( )
delete

◆ AutoPilot() [2/2]

AutoPilot::AutoPilot ( GalaxisNode *  p_gNodePtr)

Definition at line 6 of file AutoPilot.cpp.

6  :
7  m_mapDataLayer(3), m_threadPool(3), m_decision(dynamic_cast<rclcpp::Node*>(p_gNodePtr)) {
8 
9  // init
10  m_leftLineXYTmpVecSPtr = std::make_shared<std::map<int16_t, int16_t>>();
11  m_centerLineXYTmpVecSPtr = std::make_shared<std::map<int16_t, int16_t>>();
12  m_rightLineXYTmpVecSPtr = std::make_shared<std::map<int16_t, int16_t>>();
13  m_leftLineYXTmpVecSPtr = std::make_shared<std::map<int16_t, int16_t>>();
14  m_centerLineYXTmpVecSPtr = std::make_shared<std::map<int16_t, int16_t>>();
15  m_rightLineYXTmpVecSPtr = std::make_shared<std::map<int16_t, int16_t>>();
16 
17  m_leftLinePolynomXVectorSPtr = std::make_shared<std::vector<double>>();
18  m_leftLinePolynomYVectorSPtr = std::make_shared<std::vector<double>>();
19  m_centerLinePolynomXVectorSPtr = std::make_shared<std::vector<double>>();
20  m_centerLinePolynomYVectorSPtr = std::make_shared<std::vector<double>>();
21  m_rightLinePolynomXVectorSPtr = std::make_shared<std::vector<double>>();
22  m_rightLinePolynomYVectorSPtr = std::make_shared<std::vector<double>>();
23 
24  m_leftLinePolynomPointsVecSPtr = std::make_shared<std::vector<Vector2f>>();
25  m_rightLinePolynomPointsVecSPtr = std::make_shared<std::vector<Vector2f>>();
26 
27  m_leftLinePolynomXVectorSPtr->reserve(500);
28  m_leftLinePolynomYVectorSPtr->reserve(500);
29  m_centerLinePolynomXVectorSPtr->reserve(500);
30  m_centerLinePolynomYVectorSPtr->reserve(500);
31  m_rightLinePolynomXVectorSPtr->reserve(500);
32  m_rightLinePolynomYVectorSPtr->reserve(500);
33 
35 
36  m_polynomPointsXVector.reserve(1000);
37  m_polynomPointsYVector.reserve(1000);
38 
39  m_gNodePtr = p_gNodePtr;
40 
41  m_laneBlocked = std::make_tuple(-1.f, -1.f, -1.f, -1.f);
42 }

References m_centerLinePolynomXVectorSPtr, m_centerLinePolynomYVectorSPtr, m_centerLineXYTmpVecSPtr, m_centerLineYXTmpVecSPtr, m_gNodePtr, m_laneBlocked, m_lastDriveInformationSPtr, m_leftLinePolynomPointsVecSPtr, m_leftLinePolynomXVectorSPtr, m_leftLinePolynomYVectorSPtr, m_leftLineXYTmpVecSPtr, m_leftLineYXTmpVecSPtr, m_polynomPointsXVector, m_polynomPointsYVector, m_rightLinePolynomPointsVecSPtr, m_rightLinePolynomXVectorSPtr, m_rightLinePolynomYVectorSPtr, m_rightLineXYTmpVecSPtr, and m_rightLineYXTmpVecSPtr.

◆ ~AutoPilot()

AutoPilot::~AutoPilot ( )

Definition at line 44 of file AutoPilot.cpp.

44  {
45  m_threadPool.join();
46 }

References m_threadPool.

Member Function Documentation

◆ cluster_line_object()

void AutoPilot::cluster_line_object ( std::map< int16_t, std::vector< int16_t >> &  linePointsMapInputRef,
std::shared_ptr< std::map< int16_t, int16_t >>  linePointsOutVecSPtr 
)
private

Definition at line 289 of file AutoPilot.cpp.

289  {
290  // CLUSTERING PARAMETERS // TODO: evaluate // MOVED TO SYSTEM.JSON
291  // int clusterEpsCM = 2; // must be positive
292  // int clusterMinPts = 2;
293 
294  // TODO: maybe use only median (higher performance)
295  for(auto& [xKey, xVec]: linePointsMapInputRef) { // iterate through all points of specific line
296  if(xVec.size() < 1)
297  continue;
298 
299  // sort ascending
300  std::sort(xVec.begin(), xVec.end()); // TODO: check performance
301 
302  int amountOfPoints = 0;
303  int16_t yMedianOfxVec = xVec.at(static_cast<int>((xVec.size() + 1) / 2) - 1);
304 
305  for(int16_t i = xKey - m_lineClusterEps; i <= xKey + m_lineClusterEps; ++i) { // iterate over possible points in Eps (X)
306  auto iPointsVecIterator = linePointsMapInputRef.find(i);
307 
308  if(iPointsVecIterator != linePointsMapInputRef.end()) { // if there exist Y points for the X
309  for(auto yPoint: iPointsVecIterator->second) { // iterate through all Y points and check if they are in Eps (Y)
310 
311  if(yPoint >= yMedianOfxVec - m_lineClusterEps && yPoint <= yMedianOfxVec + m_lineClusterEps) {
312  ++amountOfPoints;
313  }
314  }
315  }
316 
317  if(amountOfPoints >= m_lineClusterMinPts)
318  break; // boost
319  }
320 
321  if(amountOfPoints >= m_lineClusterMinPts) {
322  linePointsOutVecSPtr->insert(std::pair<int16_t,int16_t>(xKey, yMedianOfxVec));
323  }
324  }
325 
326  m_sharedThreadMutex.unlock_shared();
327 }

References m_lineClusterEps, m_lineClusterMinPts, and m_sharedThreadMutex.

Referenced by get_lane_centers().

Here is the caller graph for this function:

◆ eval_poly()

double AutoPilot::eval_poly ( DynamicPolynom  p_polynom,
double  p_x 
)

Definition at line 640 of file AutoPilot.cpp.

640  {
641  double value = 0.0;
642  double iValue;
643  for(size_t i = 0; i < p_polynom->size(); ++i) {
644  iValue = 1;
645  // x^i
646  for(size_t j = 0; j < i; ++j) {
647  iValue *= p_x;
648  }
649  value += p_polynom->at(i) * iValue;
650  }
651  return value;
652 }

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

Here is the caller graph for this function:

◆ get_drive_information()

std::shared_ptr< DriveInformation_t > AutoPilot::get_drive_information ( )

Definition at line 87 of file AutoPilot.cpp.

87  { // mTODO: add timestamp to get location at
88  std::shared_ptr<DriveInformation_t> driveInformationSPtr = std::make_shared<DriveInformation_t>();
89 
90  std::shared_ptr<PositionTimepoint> positionTimepoint = m_localizer.get_latest_position_timepoint(); // TODO: check if we use simulation -> other clock
91  driveInformationSPtr->positionTimepoint = *positionTimepoint;
92 
93  m_laneCentersPairVecUPtr = get_lane_centers(positionTimepoint);
94 
95  // left Lane
96  std::pair<bool,bool> laneVisiblity = std::make_pair<bool, bool>(false, false); // <left, right>
98  if(m_decision.get_chosen_lane() == false) { // left lane
99  // append line behind car for better/smoother fitting
101  m_laneCentersPairVecUPtr->first.push_back(galaxis::lina::Vector2f(0.f, - i * 1.f));
102  }
103  }
104 
105  m_polynomPointsXVector.clear();
106  m_polynomPointsYVector.clear();
107 
108  for(auto const& point : m_laneCentersPairVecUPtr->first) {
109  m_polynomPointsXVector.push_back(point[1] / 100); // from cm to m, rotate -90 cc to look into x direction (not y)
110  m_polynomPointsYVector.push_back(-point[0] / 100);
111  }
112 
113  std::get<0>(laneVisiblity) = true;
114  std::get<0>(m_lanePolynom) = galaxis_polyfit(m_polynomPointsXVector, m_polynomPointsYVector, m_polynomPointsXVector.size() * 0.6f, 10, 7);
115  }
116  // right Lane
118  if(m_decision.get_chosen_lane() == true) { // left lane
119  // append line behind car for better/smoother fitting
121  m_laneCentersPairVecUPtr->second.push_back(galaxis::lina::Vector2f(0.f, - i * 1.f));
122  }
123  }
124 
125  m_polynomPointsXVector.clear();
126  m_polynomPointsYVector.clear();
127 
128  for(auto const& point : m_laneCentersPairVecUPtr->second) {
129  m_polynomPointsXVector.push_back(point[1] / 100); // from cm to m
130  m_polynomPointsYVector.push_back(-point[0] / 100);
131  }
132 
133  std::get<1>(laneVisiblity) = true;
134  std::get<1>(m_lanePolynom) = galaxis_polyfit(m_polynomPointsXVector, m_polynomPointsYVector, m_polynomPointsXVector.size() * 0.6f, 10, 7);
135  }
136 
137  driveInformationSPtr->right = m_rightLinePoly;
138  driveInformationSPtr->center = m_centerLinePoly;
139  driveInformationSPtr->left = m_leftLinePoly;
140 
141 
142  if (std::get<0>(laneVisiblity) == false && std::get<1>(laneVisiblity) == false) { // Blindfish -> Fall back to last polynom
143  m_decision.update(positionTimepoint, m_laneBlocked);
144 
145  rclcpp::Duration maxDriveOnOldPoly(0, 750000000); // 750ms
146  if (m_lastDriveInformationSPtr == nullptr || (positionTimepoint->timestamp - m_lastDriveInformationSPtr->timeLastPolynomCalculated) > maxDriveOnOldPoly) {
147  // drive straight
148  driveInformationSPtr->polynom = std::make_shared<std::vector<double>>();
149  driveInformationSPtr->polynom->push_back(0.f); // x^0
150  driveInformationSPtr->polynom->push_back(0.f); // x^1
151  driveInformationSPtr->polynom->push_back(0.f); // x^2
152  driveInformationSPtr->polynom->push_back(0.f); // x^3
153  // Set Velocity Ref
154  driveInformationSPtr->velocityReference = m_decision.get_velocity_reference() * 0.5f;
155  driveInformationSPtr->indicatorLeft = m_decision.get_indicator_left();
156  driveInformationSPtr->indicatorRight = m_decision.get_indicator_right();
158  log_warning("AutoPilot: Blindfish mode! Drive straight.");
159  }
160  else { // last polynom exists => calculate new shifted polynom
161  // calculate x,y shift
162  // Rotation2Df posDiffRotationMat(driveInformationSPtr->positionTimepoint.orientation);
163  // Vector2f positionDiffToPolynomPosition = positionTimepoint->position - driveInformationSPtr->positionTimepoint.position;
164  // positionDiffToPolynomPosition = posDiffRotationMat * positionDiffToPolynomPosition;
165  // positionDiffToPolynomPosition = Vector2f(positionDiffToPolynomPosition[1],-positionDiffToPolynomPosition[0])
166  // positionDiffToPolynomPosition /= 1000; // from mm to m
167  // Rotation2Df rotationMat(positionTimepoint->orientation - driveInformationSPtr->positionTimepoint.orientation); // rotation matrix for point rotation
168 
169 
170  m_polynomPointsXVector.clear();
171  m_polynomPointsYVector.clear();
172 
173  // eval poly at estimated position // get time diff and multiply with velocity
174  auto timestamp = positionTimepoint->timestamp - m_lastDriveInformationSPtr->positionTimepoint.timestamp;
175  float drivenDistanceM = (m_lastDriveInformationSPtr->velocityReference * 1e9) / timestamp.nanoseconds(); // velocityReference is m/s (m/s * 1e9 = nm/s)
176 
177  // use drivenDistance as approximation of x-shift in polynom
178  Vector2f newPosition = Vector2f(drivenDistanceM, eval_poly(m_lastDriveInformationSPtr->polynom, drivenDistanceM)); // nm / 1e9 = m
179 
180  float gradient = static_cast<float>(galaxis::utils::calculate_gradient(m_lastDriveInformationSPtr->polynom, newPosition[0]));
181  float rotationClockwise = std::atan(gradient);
182  Eigen::Rotation2Df rotationMat(-rotationClockwise); // because Eigen is CC
183 
184  // get points of last polynom
185  // polynom is in meter => we want to get cm precision for new poly
186  for(float x = 0.01; x < m_mapDataLayer.m_lookupWindowSizeCMHeight / 100.f; x += 0.01) {
187  // eval poly and direct shift
188  // calulate pos on polynom + shift to new position
189  Vector2f newPoint = Vector2f(x, eval_poly(m_lastDriveInformationSPtr->polynom, x)) - newPosition;
190  newPoint = rotationMat * newPoint;
191 
192  m_polynomPointsXVector.push_back(newPoint[0]);
193  m_polynomPointsYVector.push_back(newPoint[1]);
194  }
195 
196  driveInformationSPtr->positionTimepoint = *positionTimepoint;
197  // TODO: reenable when fixed
198  // driveInformationSPtr->polynom = galaxis_polyfit(m_polynomPointsXVector, m_polynomPointsYVector, m_polynomPointsXVector.size() * 0.9, 20, 3);
199  driveInformationSPtr->polynom = m_lastDriveInformationSPtr->polynom;
200  driveInformationSPtr->velocityReference = m_decision.get_velocity_reference() * 0.7f; // decrease velocity
201  driveInformationSPtr->timeLastPolynomCalculated = m_lastDriveInformationSPtr->timeLastPolynomCalculated;
203 
204  log_warning("AutoPilot: Blindfish mode! Fall back to last polynom.");
205  }
206  }
207  else {
209  m_decision.update(positionTimepoint, m_laneBlocked);
210 
211  // TODO: move to decision state machine
212  if(m_decision.get_chosen_lane() == false) { // leftLane
213  driveInformationSPtr->polynom = m_lanePolynom.first;
214  }
215  else { // rightLane
216  driveInformationSPtr->polynom = m_lanePolynom.second;
217  }
218 
219  driveInformationSPtr->velocityReference = m_decision.get_velocity_reference();
220  driveInformationSPtr->indicatorLeft = m_decision.get_indicator_left();
221  driveInformationSPtr->indicatorRight = m_decision.get_indicator_right();
223  driveInformationSPtr->timeLastPolynomCalculated = positionTimepoint->timestamp;
224 
225  m_lastDriveInformationSPtr = driveInformationSPtr; // set last correctly calculated driveInformation
226  }
227 
228  return driveInformationSPtr;
229 }

References galaxis::utils::calculate_gradient(), eval_poly(), Decision::get_chosen_lane(), Decision::get_current_situationstate(), Decision::get_indicator_left(), Decision::get_indicator_right(), get_lane_blocked(), get_lane_centers(), Localizer::get_latest_position_timepoint(), Decision::get_velocity_reference(), galaxis::utils::log_warning(), m_centerLinePoly, m_decision, m_laneBlocked, m_laneCentersPairVecUPtr, m_lanePolynom, m_lastDriveInformationSPtr, m_leftLinePoly, m_localizer, MapDataLayer::m_lookupWindowSizeCMHeight, m_mapDataLayer, m_polynomMinimumPointsAmount, m_polynomPointsXVector, m_polynomPointsYVector, m_rightLinePoly, m_trajPointsStartAppendingOffset, m_trajPointsToAppendAmount, Parking, ParkingZone, and Decision::update().

Referenced by AutoPilotNode::send_controller_references().

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

◆ get_lane_blocked()

std::tuple< float, float, float, float > AutoPilot::get_lane_blocked ( std::pair< DynamicPolynom, DynamicPolynom > &  lanePolynom)
private

Definition at line 581 of file AutoPilot.cpp.

581  {
582  std::tuple<float, float, float, float> laneBlocked = std::make_tuple<float, float, float>(-1, -1, -1, -1); // left, right, intersection-right lane,
583 
584  std::shared_ptr<PositionTimepoint> positionTimepointNow = m_localizer.get_latest_position_timepoint(); // TODO: check if we use simulation -> other clock
585  auto staticObstaclesVectorSPtr = m_mapDataLayer.getObstacles(positionTimepointNow->timestamp);
586 
587  for(auto& obstacle : *staticObstaclesVectorSPtr) {
588  Vector2f obstaclePos = obstacle.get_position_now();
589  Vector2f distanceToObstacle = obstaclePos - positionTimepointNow->position / 10; // mm to cm
590  if(distanceToObstacle.norm() <= m_obstacleLookupDistanceCM) {
591 
592  Eigen::Rotation2Df rotationMat(positionTimepointNow->orientation);
593  distanceToObstacle = rotationMat * distanceToObstacle;
594 
595  if(distanceToObstacle[1] >= 0) {
596  // obstacle is in 180deg FOV -> check if line blocked
597  double x;
598  Vector2f laneToObstacleDistance;
600  if(std::get<0>(laneBlocked) < 0) {
601  x = -eval_poly(std::get<0>(lanePolynom), y / 100 /* to m */) * 100 /* to cm */; // x,y flipped because of polynom look into x direction => *(-1)
602  laneToObstacleDistance[0] = x - distanceToObstacle[0];
603  laneToObstacleDistance[1] = y - distanceToObstacle[1];
604  if(laneToObstacleDistance.norm() - obstacle.get_width() / 2 < m_obstacleToLaneCenterMinimumDistanceForDodge) {
605  // lane blocked
606  std::get<0>(laneBlocked) = y;
607  }
608  }
609 
610  // same for right lane
611  if(std::get<1>(laneBlocked) < 0) {
612  x = -eval_poly(std::get<1>(lanePolynom), y / 100) * 100; // x,y flipped because of polynom look into x direction
613  laneToObstacleDistance[0] = x - distanceToObstacle[0];
614  laneToObstacleDistance[1] = y - distanceToObstacle[1];
615  if(laneToObstacleDistance.norm() - obstacle.get_width() / 2 < m_obstacleToLaneCenterMinimumDistanceForDodge) {
616  // lane blocked
617  std::get<1>(laneBlocked) = y;
618  }
619  }
620  }
621 
622  // check if obstacle at right lane of intersection
623  if(distanceToObstacle[0] >= 10 && distanceToObstacle[0] <= 120) {
624  if(std::get<2>(laneBlocked) < 0.f || std::get<2>(laneBlocked) > distanceToObstacle[1]) {
625  std::get<2>(laneBlocked) = distanceToObstacle[1];
626  }
627  }
628  if(distanceToObstacle[1] <= 120) {
629  if(std::get<3>(laneBlocked) < 0.f || std::get<3>(laneBlocked) > distanceToObstacle[1]) {
630  std::get<3>(laneBlocked) = distanceToObstacle[1];
631  }
632  }
633  }
634  }
635  }
636 
637  return laneBlocked;
638 }

References eval_poly(), Localizer::get_latest_position_timepoint(), MapDataLayer::getObstacles(), m_localizer, m_mapDataLayer, m_obstacleLookupDistanceCM, m_obstacleLookupDistanceStepCM, and m_obstacleToLaneCenterMinimumDistanceForDodge.

Referenced by get_drive_information().

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

◆ get_lane_center()

std::unique_ptr<std::pair<std::vector<galaxis::lina::Vector2f>, std::vector<galaxis::lina::Vector2f> > > AutoPilot::get_lane_center ( )
private

◆ get_lane_centers()

std::unique_ptr< std::pair< std::vector< galaxis::lina::Vector2f >, std::vector< galaxis::lina::Vector2f > > > AutoPilot::get_lane_centers ( std::shared_ptr< PositionTimepoint >  positionTimepoint)
private

Definition at line 231 of file AutoPilot.cpp.

231  { // TODO: add timestamp to get location at
232  std::unique_ptr<std::pair<std::vector<galaxis::lina::Vector2f>, std::vector<galaxis::lina::Vector2f>>> lanesPairVecUPtr = std::make_unique<std::pair<std::vector<galaxis::lina::Vector2f>, std::vector<galaxis::lina::Vector2f>>>();
233 
234  m_linesObject = m_mapDataLayer.getLineObject(positionTimepoint->position / 10, galaxis::autopilot::lookupLookBehindCarCM, positionTimepoint->orientation, Vector2i(m_mapDataLayer.m_lookupWindowSizeCMWidth, m_mapDataLayer.m_lookupWindowSizeCMHeight)); // m_localizer.get_position_timepoint_by_time()
235 
236  // DBSCAN cluster lines
237  m_leftLineXYTmpVecSPtr->clear();
238  m_centerLineXYTmpVecSPtr->clear();
239  m_rightLineXYTmpVecSPtr->clear();
240  m_leftLineYXTmpVecSPtr->clear();
241  m_centerLineYXTmpVecSPtr->clear();
242  m_rightLineYXTmpVecSPtr->clear();
243 
244  // XY
245  m_sharedThreadMutex.lock_shared();
246  boost::asio::post(m_threadPool, std::bind(&AutoPilot::cluster_line_object, this, m_linesObject->leftLine.getPointsXY(), m_leftLineXYTmpVecSPtr));
247  m_sharedThreadMutex.lock_shared();
248  boost::asio::post(m_threadPool, std::bind(&AutoPilot::cluster_line_object, this, m_linesObject->centerLine.getPointsXY(), m_centerLineXYTmpVecSPtr));
249  m_sharedThreadMutex.lock_shared();
250  boost::asio::post(m_threadPool, std::bind(&AutoPilot::cluster_line_object, this, m_linesObject->rightLine.getPointsXY(), m_rightLineXYTmpVecSPtr));
251  m_sharedThreadMutex.lock(); // wait for threads to complete
252  m_sharedThreadMutex.unlock(); // wait for threads to complete
253 
254  // YX (switched)
255  m_sharedThreadMutex.lock_shared();
256  boost::asio::post(m_threadPool, std::bind(&AutoPilot::cluster_line_object, this, m_linesObject->leftLine.getPointsYX(), m_leftLineYXTmpVecSPtr));
257  m_sharedThreadMutex.lock_shared();
258  boost::asio::post(m_threadPool, std::bind(&AutoPilot::cluster_line_object, this, m_linesObject->centerLine.getPointsYX(), m_centerLineYXTmpVecSPtr));
259  m_sharedThreadMutex.lock_shared();
260  boost::asio::post(m_threadPool, std::bind(&AutoPilot::cluster_line_object, this, m_linesObject->rightLine.getPointsYX(), m_rightLineYXTmpVecSPtr));
261  m_sharedThreadMutex.lock(); // wait for threads to complete
262  m_sharedThreadMutex.unlock(); // wait for threads to complete
263 
264  // Get center points of right/left line
265  auto leftLaneMutVecPointer = std::make_shared<MutexedVectorPointer<galaxis::lina::Vector2f>>(&lanesPairVecUPtr->first);
266  auto rightLaneMutVecPointer = std::make_shared<MutexedVectorPointer<galaxis::lina::Vector2f>>(&lanesPairVecUPtr->second);
267 
268 
269  m_sharedThreadMutex.lock_shared();
270  boost::asio::post(m_threadPool, std::bind(&AutoPilot::get_lane_centers_thread_helper, this, m_linesObject->reverseRotationMatrix, m_leftLineXYTmpVecSPtr, m_centerLineXYTmpVecSPtr, m_rightLineXYTmpVecSPtr, leftLaneMutVecPointer, rightLaneMutVecPointer, false));
271 
272  m_sharedThreadMutex.lock_shared();
273  boost::asio::post(m_threadPool, std::bind(&AutoPilot::get_lane_centers_thread_helper, this, m_linesObject->reverseRotationMatrix, m_leftLineYXTmpVecSPtr, m_centerLineYXTmpVecSPtr, m_rightLineYXTmpVecSPtr, leftLaneMutVecPointer, rightLaneMutVecPointer, true));
274 
275  // improve lanecenter calculation if center line has not enough points
276  // if (m_centerLineYXTmpVecSPtr->size() < m_minNumberOfClusteredLinePoints) {
277  // polynom + orthogonal calculation
278  m_sharedThreadMutex.lock_shared();
279  boost::asio::post(m_threadPool, std::bind(&AutoPilot::get_lane_centers_via_polynom_thread_helper, this, m_linesObject->reverseRotationMatrix, m_leftLineXYTmpVecSPtr, m_centerLineXYTmpVecSPtr, m_rightLineXYTmpVecSPtr, leftLaneMutVecPointer, rightLaneMutVecPointer));
280  // }
281 
282  m_sharedThreadMutex.lock(); // wait for threads to complete
283  m_sharedThreadMutex.unlock(); // wait for threads to complete
284 
285 
286  return std::move(lanesPairVecUPtr);
287 }

References cluster_line_object(), get_lane_centers_thread_helper(), get_lane_centers_via_polynom_thread_helper(), MapDataLayer::getLineObject(), galaxis::autopilot::lookupLookBehindCarCM, m_centerLineXYTmpVecSPtr, m_centerLineYXTmpVecSPtr, m_leftLineXYTmpVecSPtr, m_leftLineYXTmpVecSPtr, m_linesObject, MapDataLayer::m_lookupWindowSizeCMHeight, MapDataLayer::m_lookupWindowSizeCMWidth, m_mapDataLayer, m_rightLineXYTmpVecSPtr, m_rightLineYXTmpVecSPtr, m_sharedThreadMutex, and m_threadPool.

Referenced by get_drive_information().

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

◆ get_lane_centers_thread_helper()

void AutoPilot::get_lane_centers_thread_helper ( Eigen::Rotation2Df  p_reverseRotationMat,
std::shared_ptr< std::map< int16_t, int16_t >>  p_leftLinePointsMapSPtr,
std::shared_ptr< std::map< int16_t, int16_t >>  p_centerLinePointsMapSPtr,
std::shared_ptr< std::map< int16_t, int16_t >>  p_rightLinePointsMapSPtr,
std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >>  p_leftLaneMutexedVecSPtr,
std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >>  p_rightLaneMutexedVecSPtr,
bool  p_yxMapping 
)
private

Definition at line 329 of file AutoPilot.cpp.

335  {
336 
337 
338  // Iterate Left (left-center, left-right)
339  for(auto const& leftPointPairRef: *p_leftLinePointsMapSPtr) {
340  auto centerPointPairIt = p_centerLinePointsMapSPtr->find(leftPointPairRef.first);
341  if(centerPointPairIt != p_centerLinePointsMapSPtr->end()) { // found centerPoint
342  float difference = centerPointPairIt->second - leftPointPairRef.second;
343 
344  this->insert_lane_point(p_leftLaneMutexedVecSPtr, leftPointPairRef.first, (leftPointPairRef.second + difference * 0.5f), p_reverseRotationMat, p_yxMapping);
345  this->insert_lane_point(p_rightLaneMutexedVecSPtr, leftPointPairRef.first, (leftPointPairRef.second + difference * 1.5f), p_reverseRotationMat, p_yxMapping);
346  }
347 
348  auto rightPointPairIt = p_rightLinePointsMapSPtr->find(leftPointPairRef.first);
349  if(rightPointPairIt != p_rightLinePointsMapSPtr->end()) { // found rightPoint
350  float difference = rightPointPairIt->second - leftPointPairRef.second;
351 
352  this->insert_lane_point(p_leftLaneMutexedVecSPtr, leftPointPairRef.first, (leftPointPairRef.second + difference * 0.25f), p_reverseRotationMat, p_yxMapping);
353  this->insert_lane_point(p_rightLaneMutexedVecSPtr, leftPointPairRef.first, (leftPointPairRef.second + difference * 0.75f), p_reverseRotationMat, p_yxMapping);
354  }
355  }
356 
357  // Iterate Center (center-right)
358  for(auto const& centerPointPairRef: *p_centerLinePointsMapSPtr) {
359  auto rightPointPairIt = p_rightLinePointsMapSPtr->find(centerPointPairRef.first);
360  if(rightPointPairIt != p_rightLinePointsMapSPtr->end()) { // found rightPoint
361  float difference = rightPointPairIt->second - centerPointPairRef.second;
362 
363  this->insert_lane_point(p_leftLaneMutexedVecSPtr, centerPointPairRef.first, (centerPointPairRef.second - difference * 0.5f), p_reverseRotationMat, p_yxMapping);
364  this->insert_lane_point(p_rightLaneMutexedVecSPtr, centerPointPairRef.first, (centerPointPairRef.second + difference * 0.5f), p_reverseRotationMat, p_yxMapping);
365  }
366  }
367 
368  m_sharedThreadMutex.unlock_shared();
369 }

References insert_lane_point(), and m_sharedThreadMutex.

Referenced by get_lane_centers().

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

◆ get_lane_centers_via_polynom_thread_helper()

void AutoPilot::get_lane_centers_via_polynom_thread_helper ( Eigen::Rotation2Df  p_reverseRotationMat,
std::shared_ptr< std::map< int16_t, int16_t >>  p_leftLinePointsMapSPtr,
std::shared_ptr< std::map< int16_t, int16_t >>  p_centerLinePointsMapSPtr,
std::shared_ptr< std::map< int16_t, int16_t >>  p_rightLinePointsMapSPtr,
std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >>  p_leftLaneMutexedVecSPtr,
std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >>  p_rightLaneMutexedVecSPtr 
)
private

Definition at line 371 of file AutoPilot.cpp.

376  {
377 
378 
385 
388 
389  m_leftLinePoly = nullptr;
390  m_rightLinePoly = nullptr;
391  m_centerLinePoly = nullptr;
392 
393  Vector2f point1, point2, pointsDistanceVector, newPointToInsert, newPointToInsertLeft, newPointToInsertRight, toLaneCenterVector;
394  Eigen::Rotation2Df rotationRightLine(MATH_PI_DOUBLE / 2);
395  Eigen::Rotation2Df rotationLeftLine (-MATH_PI_DOUBLE / 2);
396 
397  if(p_leftLinePointsMapSPtr->size() > 25) {
398  // Iterate Left
399  int leftMin = 10000000;
400  int leftMax = 0;
401  for(auto const& pointRef: *p_leftLinePointsMapSPtr) {
402  Vector2f point = Vector2f(pointRef.first, pointRef.second);
403  point = p_reverseRotationMat * point;
404  m_leftLinePolynomXVectorSPtr->push_back(point[1]); // looking in X direction not Y
405  m_leftLinePolynomYVectorSPtr->push_back(-point[0]);
406 
407  if (point[1] < leftMin) { // point[1] because we want to look in X direction
408  leftMin = point[1];
409  }
410  if (point[1] > leftMax) { // point[1] because we want to look in X direction
411  leftMax = point[1];
412  }
413 
414  m_leftPolyMax = leftMax;
415  m_leftPolyMin = leftMin;
416  }
417 
419 
421  // left
422  point1[0] = x;
423  point1[1] = galaxis::utils::evaluate_polynom(*m_leftLinePoly, point1[0]);
424  point2[0] = x + m_linePolynomEvaluationStepSizeCM;
425  point2[1] = galaxis::utils::evaluate_polynom(*m_leftLinePoly, point2[0]);
426 
427  pointsDistanceVector = point2 - point1;
428  toLaneCenterVector = pointsDistanceVector.normalized();
429  toLaneCenterVector = rotationLeftLine * toLaneCenterVector;
430 
431  newPointToInsert = point1 + pointsDistanceVector / 2; // ausgehend von Mitte zwischen beiden points
432 
433  newPointToInsertLeft = newPointToInsert + toLaneCenterVector * 20; // 20cm to left lane center (80cm street width)
434  newPointToInsertRight = newPointToInsert + toLaneCenterVector * 60; // 60cm to right lane center (80cm street width)
435  p_leftLaneMutexedVecSPtr->push_back(Vector2f(-newPointToInsertLeft[1], newPointToInsertLeft[0]));
436  p_rightLaneMutexedVecSPtr->push_back(Vector2f(-newPointToInsertRight[1], newPointToInsertRight[0]));
437 
438  // debug: show in debug image
439  // m_leftLinePolynomPointsVecSPtr->push_back(Vector2f(-newPointToInsertLeft[1], newPointToInsertLeft[0]));
440  // m_leftLinePolynomPointsVecSPtr->push_back(Vector2f(-newPointToInsertRight[1], newPointToInsertRight[0]));
441 
442 
443  // m_leftLinePolynomPointsVecSPtr->push_back(Vector2f(-point1[1],point1[0]));
444  }
445  }
446  else {
447  // log_debug("[AutoPilot] get_lane_centers_via_polynom*: Not enought points for left lane polynom");
448  }
449 
450  if(p_centerLinePointsMapSPtr->size() > 25) {
451  // Iterate Left
452  int leftMin = 10000000;
453  int leftMax = 0;
454  for(auto const& pointRef: *p_centerLinePointsMapSPtr) {
455  Vector2f point = Vector2f(pointRef.first, pointRef.second);
456  point = p_reverseRotationMat * point;
457  m_centerLinePolynomXVectorSPtr->push_back(point[1]); // looking in X direction not Y
458  m_centerLinePolynomYVectorSPtr->push_back(-point[0]);
459 
460  if (point[1] < leftMin) { // point[1] because we want to look in X direction
461  leftMin = point[1];
462  }
463  if (point[1] > leftMax) { // point[1] because we want to look in X direction
464  leftMax = point[1];
465  }
466  m_centerPolyMax = leftMax;
467  m_centerPolyMin = leftMin;
468  }
469 
470 
472 
473 
475  // left
476  point1[0] = x;
477  point1[1] = galaxis::utils::evaluate_polynom(*m_centerLinePoly, point1[0]);
478  point2[0] = x + m_linePolynomEvaluationStepSizeCM;
479  point2[1] = galaxis::utils::evaluate_polynom(*m_centerLinePoly, point2[0]);
480 
481  pointsDistanceVector = point2 - point1;
482  toLaneCenterVector = pointsDistanceVector.normalized();
483  toLaneCenterVector = rotationLeftLine * toLaneCenterVector;
484 
485  newPointToInsert = point1 + pointsDistanceVector / 2; // ausgehend von Mitte zwischen beiden points
486 
487  newPointToInsertLeft = newPointToInsert + toLaneCenterVector * -20; // 20cm to left lane center (80cm street width)
488  newPointToInsertRight = newPointToInsert + toLaneCenterVector * 20; // 60cm to right lane center (80cm street width)
489  p_leftLaneMutexedVecSPtr->push_back(Vector2f(-newPointToInsertLeft[1], newPointToInsertLeft[0]));
490  p_rightLaneMutexedVecSPtr->push_back(Vector2f(-newPointToInsertRight[1], newPointToInsertRight[0]));
491 
492  // debug: show in debug image
493  // m_leftLinePolynomPointsVecSPtr->push_back(Vector2f(-newPointToInsertLeft[1], newPointToInsertLeft[0]));
494  // m_leftLinePolynomPointsVecSPtr->push_back(Vector2f(-newPointToInsertRight[1], newPointToInsertRight[0]));
495 
496 
497  // m_leftLinePolynomPointsVecSPtr->push_back(Vector2f(-point1[1],point1[0]));
498  }
499  }
500  else {
501  // log_debug("[AutoPilot] get_lane_centers_via_polynom*: Not enought points for left lane polynom");
502  }
503 
504  if(p_rightLinePointsMapSPtr->size() > 25) {
505  // Iterate Right
506  int rightMin = 10000000;
507  int rightMax = 0;
508  for(auto const& pointRef: *p_rightLinePointsMapSPtr) {
509  Vector2f point = Vector2f(pointRef.first, pointRef.second);
510  point = p_reverseRotationMat * point;
511  m_rightLinePolynomXVectorSPtr->push_back(point[1]);
512  m_rightLinePolynomYVectorSPtr->push_back(-point[0]);
513 
514  if (point[1] < rightMin) { // point[1] because we want to look in X direction
515  rightMin = point[1];
516  }
517  if (point[1] > rightMax) { // point[1] because we want to look in X direction
518  rightMax = point[1];
519  }
520 
521  m_rightPolyMax = rightMax;
522  m_rightPolyMin = rightMin;
523  }
525 
527  // right
528  point1[0] = x;
529  point1[1] = galaxis::utils::evaluate_polynom(*m_rightLinePoly, point1[0]);
530  point2[0] = x + m_linePolynomEvaluationStepSizeCM;
531  point2[1] = galaxis::utils::evaluate_polynom(*m_rightLinePoly, point2[0]);
532 
533  pointsDistanceVector = point2 - point1;
534  toLaneCenterVector = pointsDistanceVector.normalized();
535  toLaneCenterVector = rotationRightLine * toLaneCenterVector;
536 
537  newPointToInsert = point1 + pointsDistanceVector / 2; // ausgehend von Mitte zwischen beiden points
538 
539  newPointToInsertLeft = newPointToInsert + toLaneCenterVector * 60; // 60cm to left lane center (80cm street width)
540  newPointToInsertRight = newPointToInsert + toLaneCenterVector * 20; // 20cm to right lane center (80cm street width)
541 
542  p_leftLaneMutexedVecSPtr->push_back(Vector2f(-newPointToInsertLeft[1], newPointToInsertLeft[0]));
543  p_rightLaneMutexedVecSPtr->push_back(Vector2f(-newPointToInsertRight[1], newPointToInsertRight[0]));
544 
545  // m_rightLinePolynomPointsVecSPtr->push_back(Vector2f(-point1[1],point1[0]));
546  }
547  }
548  else {
549  // log_debug("[AutoPilot] get_lane_centers_via_polynom*: Not enought points for right lane polynom");
550  }
551 
552  // p_leftLaneMutexedVecSPtr
553  // p_rightLaneMutexedVecSPtr
554 
555  m_sharedThreadMutex.unlock_shared();
556 }

References galaxis::utils::evaluate_polynom(), m_centerLinePoly, m_centerLinePolynomXVectorSPtr, m_centerLinePolynomYVectorSPtr, m_centerPolyMax, m_centerPolyMin, m_leftLinePoly, m_leftLinePolynomPointsVecSPtr, m_leftLinePolynomXVectorSPtr, m_leftLinePolynomYVectorSPtr, m_leftPolyMax, m_leftPolyMin, m_linePolynomEvaluationStepCM, m_linePolynomEvaluationStepSizeCM, MapDataLayer::m_lookupWindowSizeCMHeight, m_mapDataLayer, m_rightLinePoly, m_rightLinePolynomPointsVecSPtr, m_rightLinePolynomXVectorSPtr, m_rightLinePolynomYVectorSPtr, m_rightPolyMax, m_rightPolyMin, m_sharedThreadMutex, and MATH_PI_DOUBLE.

Referenced by get_lane_centers().

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

◆ insert_lane_point()

void AutoPilot::insert_lane_point ( std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >>  p_mutVecPointerSPtr,
float  p_x,
float  p_y,
Eigen::Rotation2Df const &  p_rotationMat,
bool  p_reverseInsertion 
)
inlineprivate

Definition at line 558 of file AutoPilot.cpp.

562  {
563 
564  Vector2f point;
565  if(!p_reverseInsertion) { // for normal insertion
566  point[0] = p_x;
567  point[1] = p_y;
568  }
569  else { // for reverse insertion
570  point[1] = p_x;
571  point[0] = p_y;
572  }
573 
574  // rotate Point
575  point = p_rotationMat * point;
576 
577  // insert
578  p_mutVecPointerSPtr->push_back(point);
579 }

Referenced by get_lane_centers_thread_helper().

Here is the caller graph for this function:

◆ set_line_cluster_eps()

void AutoPilot::set_line_cluster_eps ( int  value)

Definition at line 70 of file AutoPilot.cpp.

70  {
71  m_lineClusterEps = value;
72 }

References m_lineClusterEps.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_line_cluster_min_pts()

void AutoPilot::set_line_cluster_min_pts ( int  value)

Definition at line 73 of file AutoPilot.cpp.

73  {
74  m_lineClusterMinPts = value;
75 }

References m_lineClusterMinPts.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_line_polynom_evaluation_step()

void AutoPilot::set_line_polynom_evaluation_step ( int  value)

Definition at line 76 of file AutoPilot.cpp.

76  {
78 }

References m_linePolynomEvaluationStepCM.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_line_polynom_evaluation_step_size()

void AutoPilot::set_line_polynom_evaluation_step_size ( int  value)

Definition at line 79 of file AutoPilot.cpp.

79  {
81 }

References m_linePolynomEvaluationStepSizeCM.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_min_number_of_clustered_line_points()

void AutoPilot::set_min_number_of_clustered_line_points ( int  value)

Definition at line 82 of file AutoPilot.cpp.

82  {
84 }

References m_minNumberOfClusteredLinePoints.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_obstacle_lookup_distance()

void AutoPilot::set_obstacle_lookup_distance ( int  value)

Definition at line 49 of file AutoPilot.cpp.

49  {
51 }

References m_obstacleLookupDistanceCM.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_obstacle_lookup_distance_step()

void AutoPilot::set_obstacle_lookup_distance_step ( float  value)

Definition at line 52 of file AutoPilot.cpp.

52  {
54 }

References m_obstacleLookupDistanceStepCM.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_obstacle_to_lane_center_min_distance_for_dodge()

void AutoPilot::set_obstacle_to_lane_center_min_distance_for_dodge ( float  value)

Definition at line 55 of file AutoPilot.cpp.

References m_obstacleToLaneCenterMinimumDistanceForDodge.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_polynom_degree()

void AutoPilot::set_polynom_degree ( int  value)

Definition at line 58 of file AutoPilot.cpp.

58  {
59  m_polynomDegree = value;
60 }

References m_polynomDegree.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_polynom_min_points_amount()

void AutoPilot::set_polynom_min_points_amount ( int  value)

Definition at line 61 of file AutoPilot.cpp.

61  {
63 }

References m_polynomMinimumPointsAmount.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_traj_points_start_appending_offset()

void AutoPilot::set_traj_points_start_appending_offset ( int  value)

Definition at line 67 of file AutoPilot.cpp.

67  {
69 }

References m_trajPointsStartAppendingOffset.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

◆ set_traj_points_to_append_amount()

void AutoPilot::set_traj_points_to_append_amount ( int  value)

Definition at line 64 of file AutoPilot.cpp.

64  {
66 }

References m_trajPointsToAppendAmount.

Referenced by AutoPilotNode::new_parameters_callback().

Here is the caller graph for this function:

Member Data Documentation

◆ m_centerLinePoly

std::shared_ptr<std::vector<double> > AutoPilot::m_centerLinePoly
private

◆ m_centerLinePolynomXVectorSPtr

std::shared_ptr<std::vector<double> > AutoPilot::m_centerLinePolynomXVectorSPtr
private

Definition at line 80 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers_via_polynom_thread_helper().

◆ m_centerLinePolynomYVectorSPtr

std::shared_ptr<std::vector<double> > AutoPilot::m_centerLinePolynomYVectorSPtr
private

Definition at line 81 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers_via_polynom_thread_helper().

◆ m_centerLineXYTmpVecSPtr

std::shared_ptr<std::map<int16_t, int16_t> > AutoPilot::m_centerLineXYTmpVecSPtr
private

Definition at line 70 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers().

◆ m_centerLineYXTmpVecSPtr

std::shared_ptr<std::map<int16_t, int16_t> > AutoPilot::m_centerLineYXTmpVecSPtr
private

Definition at line 73 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers().

◆ m_centerPolyMax

double AutoPilot::m_centerPolyMax
private

Definition at line 91 of file AutoPilot.hpp.

Referenced by get_lane_centers_via_polynom_thread_helper().

◆ m_centerPolyMin

double AutoPilot::m_centerPolyMin
private

Definition at line 92 of file AutoPilot.hpp.

Referenced by get_lane_centers_via_polynom_thread_helper().

◆ m_decision

◆ m_gNodePtr

GalaxisNode* AutoPilot::m_gNodePtr
private

Definition at line 63 of file AutoPilot.hpp.

Referenced by AutoPilot().

◆ m_laneBlocked

std::tuple<float, float, float, float> AutoPilot::m_laneBlocked
private

Definition at line 86 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_drive_information().

◆ m_laneCentersPairVecUPtr

std::unique_ptr<std::pair<std::vector<galaxis::lina::Vector2f>, std::vector<galaxis::lina::Vector2f> > > AutoPilot::m_laneCentersPairVecUPtr

Definition at line 54 of file AutoPilot.hpp.

Referenced by get_drive_information(), and AutoPilotNode::send_map_debug_image().

◆ m_lanePolynom

std::pair<DynamicPolynom, DynamicPolynom> AutoPilot::m_lanePolynom

Definition at line 55 of file AutoPilot.hpp.

Referenced by get_drive_information().

◆ m_lastDriveInformationSPtr

std::shared_ptr<DriveInformation_t> AutoPilot::m_lastDriveInformationSPtr

Definition at line 57 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_drive_information().

◆ m_lastTimeLaneVisible

rclcpp::Time AutoPilot::m_lastTimeLaneVisible
private

Definition at line 98 of file AutoPilot.hpp.

◆ m_leftLinePoly

std::shared_ptr<std::vector<double> > AutoPilot::m_leftLinePoly
private

◆ m_leftLinePolynomPointsVecSPtr

std::shared_ptr<std::vector<Vector2f> > AutoPilot::m_leftLinePolynomPointsVecSPtr

◆ m_leftLinePolynomXVectorSPtr

std::shared_ptr<std::vector<double> > AutoPilot::m_leftLinePolynomXVectorSPtr
private

Definition at line 77 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers_via_polynom_thread_helper().

◆ m_leftLinePolynomYVectorSPtr

std::shared_ptr<std::vector<double> > AutoPilot::m_leftLinePolynomYVectorSPtr
private

Definition at line 78 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers_via_polynom_thread_helper().

◆ m_leftLineXYTmpVecSPtr

std::shared_ptr<std::map<int16_t, int16_t> > AutoPilot::m_leftLineXYTmpVecSPtr
private

Definition at line 69 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers().

◆ m_leftLineYXTmpVecSPtr

std::shared_ptr<std::map<int16_t, int16_t> > AutoPilot::m_leftLineYXTmpVecSPtr
private

Definition at line 72 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers().

◆ m_leftPolyMax

double AutoPilot::m_leftPolyMax
private

Definition at line 88 of file AutoPilot.hpp.

Referenced by get_lane_centers_via_polynom_thread_helper().

◆ m_leftPolyMin

double AutoPilot::m_leftPolyMin
private

Definition at line 89 of file AutoPilot.hpp.

Referenced by get_lane_centers_via_polynom_thread_helper().

◆ m_lineClusterEps

int AutoPilot::m_lineClusterEps = 2

Definition at line 113 of file AutoPilot.hpp.

Referenced by cluster_line_object(), and set_line_cluster_eps().

◆ m_lineClusterMinPts

int AutoPilot::m_lineClusterMinPts = 2

Definition at line 114 of file AutoPilot.hpp.

Referenced by cluster_line_object(), and set_line_cluster_min_pts().

◆ m_linePolynomEvaluationStepCM

int AutoPilot::m_linePolynomEvaluationStepCM = 1

◆ m_linePolynomEvaluationStepSizeCM

int AutoPilot::m_linePolynomEvaluationStepSizeCM = 8

◆ m_linesObject

std::shared_ptr<LinesObject<int16_t> > AutoPilot::m_linesObject

Definition at line 53 of file AutoPilot.hpp.

Referenced by get_lane_centers(), and AutoPilotNode::send_map_debug_image().

◆ m_localizer

◆ m_mapDataLayer

◆ m_minNumberOfClusteredLinePoints

int AutoPilot::m_minNumberOfClusteredLinePoints = 20

Definition at line 118 of file AutoPilot.hpp.

Referenced by set_min_number_of_clustered_line_points().

◆ m_obstacleLookupDistanceCM

int AutoPilot::m_obstacleLookupDistanceCM = 200

Definition at line 103 of file AutoPilot.hpp.

Referenced by get_lane_blocked(), and set_obstacle_lookup_distance().

◆ m_obstacleLookupDistanceStepCM

int AutoPilot::m_obstacleLookupDistanceStepCM = 5

Definition at line 104 of file AutoPilot.hpp.

Referenced by get_lane_blocked(), and set_obstacle_lookup_distance_step().

◆ m_obstacleToLaneCenterMinimumDistanceForDodge

int AutoPilot::m_obstacleToLaneCenterMinimumDistanceForDodge = 10

◆ m_polynomDegree

int AutoPilot::m_polynomDegree = 3

Definition at line 107 of file AutoPilot.hpp.

Referenced by set_polynom_degree().

◆ m_polynomMinimumPointsAmount

int AutoPilot::m_polynomMinimumPointsAmount = 30

Definition at line 108 of file AutoPilot.hpp.

Referenced by get_drive_information(), and set_polynom_min_points_amount().

◆ m_polynomPointsXVector

std::vector<double> AutoPilot::m_polynomPointsXVector

Definition at line 59 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_drive_information().

◆ m_polynomPointsYVector

std::vector<double> AutoPilot::m_polynomPointsYVector

Definition at line 60 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_drive_information().

◆ m_rightLinePoly

std::shared_ptr<std::vector<double> > AutoPilot::m_rightLinePoly
private

◆ m_rightLinePolynomPointsVecSPtr

std::shared_ptr<std::vector<Vector2f> > AutoPilot::m_rightLinePolynomPointsVecSPtr

◆ m_rightLinePolynomXVectorSPtr

std::shared_ptr<std::vector<double> > AutoPilot::m_rightLinePolynomXVectorSPtr
private

Definition at line 83 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers_via_polynom_thread_helper().

◆ m_rightLinePolynomYVectorSPtr

std::shared_ptr<std::vector<double> > AutoPilot::m_rightLinePolynomYVectorSPtr
private

Definition at line 84 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers_via_polynom_thread_helper().

◆ m_rightLineXYTmpVecSPtr

std::shared_ptr<std::map<int16_t, int16_t> > AutoPilot::m_rightLineXYTmpVecSPtr
private

Definition at line 71 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers().

◆ m_rightLineYXTmpVecSPtr

std::shared_ptr<std::map<int16_t, int16_t> > AutoPilot::m_rightLineYXTmpVecSPtr
private

Definition at line 74 of file AutoPilot.hpp.

Referenced by AutoPilot(), and get_lane_centers().

◆ m_rightPolyMax

double AutoPilot::m_rightPolyMax
private

Definition at line 94 of file AutoPilot.hpp.

Referenced by get_lane_centers_via_polynom_thread_helper().

◆ m_rightPolyMin

double AutoPilot::m_rightPolyMin
private

Definition at line 95 of file AutoPilot.hpp.

Referenced by get_lane_centers_via_polynom_thread_helper().

◆ m_sharedThreadMutex

std::shared_mutex AutoPilot::m_sharedThreadMutex
private

◆ m_threadPool

boost::asio::thread_pool AutoPilot::m_threadPool
private

Definition at line 65 of file AutoPilot.hpp.

Referenced by get_lane_centers(), and ~AutoPilot().

◆ m_trajPointsStartAppendingOffset

int AutoPilot::m_trajPointsStartAppendingOffset = 20

Definition at line 111 of file AutoPilot.hpp.

Referenced by get_drive_information(), and set_traj_points_start_appending_offset().

◆ m_trajPointsToAppendAmount

int AutoPilot::m_trajPointsToAppendAmount = 5

Definition at line 110 of file AutoPilot.hpp.

Referenced by get_drive_information(), and set_traj_points_to_append_amount().


The documentation for this class was generated from the following files:
StationaryBeaconPosition::x
int32_t x
Definition: marvelmind.h:76
AutoPilot::m_lineClusterEps
int m_lineClusterEps
Definition: AutoPilot.hpp:113
Localizer::get_latest_position_timepoint
std::shared_ptr< PositionTimepoint > get_latest_position_timepoint()
Definition: Localizer.cpp:85
MapDataLayer::getObstacles
std::shared_ptr< std::vector< StaticObstacle > > getObstacles(rclcpp::Time const &timestamp, bool removeOld=true)
Definition: MapDataLayer.cpp:375
Decision::get_current_situationstate
SituationState get_current_situationstate()
Definition: DecisionStateMachine.cpp:339
AutoPilot::m_threadPool
boost::asio::thread_pool m_threadPool
Definition: AutoPilot.hpp:65
AutoPilot::m_rightLinePolynomPointsVecSPtr
std::shared_ptr< std::vector< Vector2f > > m_rightLinePolynomPointsVecSPtr
Definition: AutoPilot.hpp:123
StationaryBeaconPosition::y
int32_t y
Definition: marvelmind.h:76
AutoPilot::m_centerPolyMax
double m_centerPolyMax
Definition: AutoPilot.hpp:91
AutoPilot::cluster_line_object
void cluster_line_object(std::map< int16_t, std::vector< int16_t >> &linePointsMapInputRef, std::shared_ptr< std::map< int16_t, int16_t >> linePointsOutVecSPtr)
Definition: AutoPilot.cpp:289
Decision::get_velocity_reference
float get_velocity_reference() const
Definition: DecisionStateMachine.cpp:333
AutoPilot::m_obstacleLookupDistanceStepCM
int m_obstacleLookupDistanceStepCM
Definition: AutoPilot.hpp:104
AutoPilot::eval_poly
double eval_poly(DynamicPolynom p_polynom, double p_x)
Definition: AutoPilot.cpp:640
AutoPilot::m_obstacleToLaneCenterMinimumDistanceForDodge
int m_obstacleToLaneCenterMinimumDistanceForDodge
Definition: AutoPilot.hpp:105
galaxis::utils::evaluate_polynom
float evaluate_polynom(polynom const &p_polynomRef, float p_x)
Definition: poly.cpp:50
AutoPilot::get_lane_centers_via_polynom_thread_helper
void get_lane_centers_via_polynom_thread_helper(Eigen::Rotation2Df p_reverseRotationMat, std::shared_ptr< std::map< int16_t, int16_t >> p_leftLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_centerLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_rightLinePointsMapSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_leftLaneMutexedVecSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_rightLaneMutexedVecSPtr)
Definition: AutoPilot.cpp:371
AutoPilot::m_polynomMinimumPointsAmount
int m_polynomMinimumPointsAmount
Definition: AutoPilot.hpp:108
AutoPilot::m_rightPolyMax
double m_rightPolyMax
Definition: AutoPilot.hpp:94
galaxis::autopilot::lookupLookBehindCarCM
constexpr int lookupLookBehindCarCM
Definition: AutopilotSettings.hpp:38
Decision::get_chosen_lane
bool get_chosen_lane() const
Definition: DecisionStateMachine.cpp:330
AutoPilot::m_linePolynomEvaluationStepSizeCM
int m_linePolynomEvaluationStepSizeCM
Definition: AutoPilot.hpp:117
galaxis::utils::log_warning
void log_warning(const Args &... args)
Definition: logger.hpp:41
Decision::update
void update(std::shared_ptr< PositionTimepoint > positionTimepoint, std::tuple< float, float, float, float > laneBlocked)
Definition: DecisionStateMachine.cpp:48
AutoPilot::m_centerLineXYTmpVecSPtr
std::shared_ptr< std::map< int16_t, int16_t > > m_centerLineXYTmpVecSPtr
Definition: AutoPilot.hpp:70
MapDataLayer::getLineObject
std::shared_ptr< LinesObject< int16_t > > getLineObject(Vector2f absolutePositionCM, float lookBehindPosOffsetCM, double absoluteOrientation, Vector2i windowSize)
Definition: MapDataLayer.cpp:250
AutoPilot::m_rightPolyMin
double m_rightPolyMin
Definition: AutoPilot.hpp:95
Decision::get_indicator_right
bool get_indicator_right() const
Definition: DecisionStateMachine.cpp:327
AutoPilot::m_lastDriveInformationSPtr
std::shared_ptr< DriveInformation_t > m_lastDriveInformationSPtr
Definition: AutoPilot.hpp:57
AutoPilot::m_centerLinePoly
std::shared_ptr< std::vector< double > > m_centerLinePoly
Definition: AutoPilot.hpp:93
AutoPilot::m_polynomPointsXVector
std::vector< double > m_polynomPointsXVector
Definition: AutoPilot.hpp:59
AutoPilot::m_polynomDegree
int m_polynomDegree
Definition: AutoPilot.hpp:107
AutoPilot::m_centerPolyMin
double m_centerPolyMin
Definition: AutoPilot.hpp:92
AutoPilot::m_obstacleLookupDistanceCM
int m_obstacleLookupDistanceCM
Definition: AutoPilot.hpp:103
ParkingZone
@ ParkingZone
Definition: Decision.hpp:15
AutoPilot::m_linesObject
std::shared_ptr< LinesObject< int16_t > > m_linesObject
Definition: AutoPilot.hpp:53
Decision::get_indicator_left
bool get_indicator_left() const
Definition: DecisionStateMachine.cpp:324
Parking
@ Parking
Definition: Decision.hpp:16
AutoPilot::m_leftLinePolynomXVectorSPtr
std::shared_ptr< std::vector< double > > m_leftLinePolynomXVectorSPtr
Definition: AutoPilot.hpp:77
AutoPilot::m_linePolynomEvaluationStepCM
int m_linePolynomEvaluationStepCM
Definition: AutoPilot.hpp:116
AutoPilot::m_localizer
Localizer m_localizer
Definition: AutoPilot.hpp:50
AutoPilot::m_lineClusterMinPts
int m_lineClusterMinPts
Definition: AutoPilot.hpp:114
AutoPilot::m_lanePolynom
std::pair< DynamicPolynom, DynamicPolynom > m_lanePolynom
Definition: AutoPilot.hpp:55
AutoPilot::insert_lane_point
void insert_lane_point(std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_mutVecPointerSPtr, float p_x, float p_y, Eigen::Rotation2Df const &p_rotationMat, bool p_reverseInsertion)
Definition: AutoPilot.cpp:558
AutoPilot::m_minNumberOfClusteredLinePoints
int m_minNumberOfClusteredLinePoints
Definition: AutoPilot.hpp:118
AutoPilot::m_laneBlocked
std::tuple< float, float, float, float > m_laneBlocked
Definition: AutoPilot.hpp:86
AutoPilot::get_lane_blocked
std::tuple< float, float, float, float > get_lane_blocked(std::pair< DynamicPolynom, DynamicPolynom > &lanePolynom)
Definition: AutoPilot.cpp:581
AutoPilot::m_leftLinePolynomPointsVecSPtr
std::shared_ptr< std::vector< Vector2f > > m_leftLinePolynomPointsVecSPtr
Definition: AutoPilot.hpp:122
AutoPilot::m_leftLineXYTmpVecSPtr
std::shared_ptr< std::map< int16_t, int16_t > > m_leftLineXYTmpVecSPtr
Definition: AutoPilot.hpp:69
AutoPilot::m_leftLineYXTmpVecSPtr
std::shared_ptr< std::map< int16_t, int16_t > > m_leftLineYXTmpVecSPtr
Definition: AutoPilot.hpp:72
AutoPilot::get_lane_centers_thread_helper
void get_lane_centers_thread_helper(Eigen::Rotation2Df p_reverseRotationMat, std::shared_ptr< std::map< int16_t, int16_t >> p_leftLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_centerLinePointsMapSPtr, std::shared_ptr< std::map< int16_t, int16_t >> p_rightLinePointsMapSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_leftLaneMutexedVecSPtr, std::shared_ptr< MutexedVectorPointer< galaxis::lina::Vector2f >> p_rightLaneMutexedVecSPtr, bool p_yxMapping)
Definition: AutoPilot.cpp:329
AutoPilot::m_rightLinePoly
std::shared_ptr< std::vector< double > > m_rightLinePoly
Definition: AutoPilot.hpp:96
AutoPilot::m_sharedThreadMutex
std::shared_mutex m_sharedThreadMutex
Definition: AutoPilot.hpp:66
AutoPilot::m_polynomPointsYVector
std::vector< double > m_polynomPointsYVector
Definition: AutoPilot.hpp:60
galaxis::lina::Vector2f
Eigen::Vector2f Vector2f
Definition: linatypes.hpp:14
AutoPilot::m_leftLinePoly
std::shared_ptr< std::vector< double > > m_leftLinePoly
Definition: AutoPilot.hpp:90
AutoPilot::m_leftLinePolynomYVectorSPtr
std::shared_ptr< std::vector< double > > m_leftLinePolynomYVectorSPtr
Definition: AutoPilot.hpp:78
MATH_PI_DOUBLE
constexpr double MATH_PI_DOUBLE
Definition: AutoPilot.hpp:22
AutoPilot::m_centerLinePolynomYVectorSPtr
std::shared_ptr< std::vector< double > > m_centerLinePolynomYVectorSPtr
Definition: AutoPilot.hpp:81
AutoPilot::m_trajPointsToAppendAmount
int m_trajPointsToAppendAmount
Definition: AutoPilot.hpp:110
AutoPilot::m_leftPolyMin
double m_leftPolyMin
Definition: AutoPilot.hpp:89
MapDataLayer::m_lookupWindowSizeCMHeight
int m_lookupWindowSizeCMHeight
Definition: MapDataLayer.hpp:79
AutoPilot::m_gNodePtr
GalaxisNode * m_gNodePtr
Definition: AutoPilot.hpp:63
galaxis::lina::Vector2i
Eigen::Vector2i Vector2i
Definition: linatypes.hpp:13
AutoPilot::m_laneCentersPairVecUPtr
std::unique_ptr< std::pair< std::vector< galaxis::lina::Vector2f >, std::vector< galaxis::lina::Vector2f > > > m_laneCentersPairVecUPtr
Definition: AutoPilot.hpp:54
AutoPilot::m_decision
Decision m_decision
Definition: AutoPilot.hpp:51
AutoPilot::m_rightLineYXTmpVecSPtr
std::shared_ptr< std::map< int16_t, int16_t > > m_rightLineYXTmpVecSPtr
Definition: AutoPilot.hpp:74
AutoPilot::m_centerLineYXTmpVecSPtr
std::shared_ptr< std::map< int16_t, int16_t > > m_centerLineYXTmpVecSPtr
Definition: AutoPilot.hpp:73
AutoPilot::m_centerLinePolynomXVectorSPtr
std::shared_ptr< std::vector< double > > m_centerLinePolynomXVectorSPtr
Definition: AutoPilot.hpp:80
AutoPilot::m_rightLinePolynomYVectorSPtr
std::shared_ptr< std::vector< double > > m_rightLinePolynomYVectorSPtr
Definition: AutoPilot.hpp:84
AutoPilot::m_rightLineXYTmpVecSPtr
std::shared_ptr< std::map< int16_t, int16_t > > m_rightLineXYTmpVecSPtr
Definition: AutoPilot.hpp:71
MapDataLayer::m_lookupWindowSizeCMWidth
int m_lookupWindowSizeCMWidth
Definition: MapDataLayer.hpp:78
galaxis::utils::calculate_gradient
float calculate_gradient(std::vector< float > const &p_polynomRef, float p_x)
Definition: poly.cpp:60
AutoPilot::get_lane_centers
std::unique_ptr< std::pair< std::vector< galaxis::lina::Vector2f >, std::vector< galaxis::lina::Vector2f > > > get_lane_centers(std::shared_ptr< PositionTimepoint > positionTimepoint)
Definition: AutoPilot.cpp:231
AutoPilot::m_leftPolyMax
double m_leftPolyMax
Definition: AutoPilot.hpp:88
AutoPilot::m_rightLinePolynomXVectorSPtr
std::shared_ptr< std::vector< double > > m_rightLinePolynomXVectorSPtr
Definition: AutoPilot.hpp:83
AutoPilot::m_mapDataLayer
MapDataLayer m_mapDataLayer
Definition: AutoPilot.hpp:49
AutoPilot::m_trajPointsStartAppendingOffset
int m_trajPointsStartAppendingOffset
Definition: AutoPilot.hpp:111