Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
traffic_incident_parser Namespace Reference

Classes

class  TrafficIncidentParserNode
 The class responsible for processing incoming MobilityOperation messages with strategy "carma3/Incident_Use_Case". More...
 
class  TrafficIncidentParserWorker
 

Functions

size_t getNearestPointIndex (const lanelet::ConstLineString3d &points, const lanelet::BasicPoint2d &point)
 Helper method to get the nearest point index of a point and a linestring. More...
 

Function Documentation

◆ getNearestPointIndex()

size_t traffic_incident_parser::getNearestPointIndex ( const lanelet::ConstLineString3d &  points,
const lanelet::BasicPoint2d &  point 
)

Helper method to get the nearest point index of a point and a linestring.

Definition at line 163 of file traffic_incident_parser_worker.cpp.

165 {
166 double min_distance = std::numeric_limits<double>::max();
167 size_t i = 0;
168 size_t best_index = 0;
169 for (const auto& p : points)
170 {
171 double distance = lanelet::geometry::distance2d(p, point);
172 if (distance < min_distance)
173 {
174 best_index = i;
175 min_distance = distance;
176 }
177 i++;
178 }
179
180 return best_index;
181 }

References process_bag::i, and process_traj_logs::point.

Referenced by traffic_incident_parser::TrafficIncidentParserWorker::getAdjacentForwardCenterlines(), and traffic_incident_parser::TrafficIncidentParserWorker::getAdjacentReverseCenterlines().

Here is the caller graph for this function: