23#include "modules/common_msgs/perception_msgs/perception_obstacle.pb.h"
32 return obstacles_.
Add(obstacle.
Id(), obstacle);
38 return obstacles_.
Find(object_id);
42 return obstacles_.
Find(object_id);
46 const std::string &perception_obstacle_id)
const {
47 for (
const auto *obstacle : obstacles_.
Items()) {
48 if (std::to_string(obstacle->Perception().id()) == perception_obstacle_id) {
49 return &(obstacle->Perception());
58 auto *obstacle = obstacles_.
Find(
id);
61 AERROR <<
"Failed to find obstacle : " << id;
69 const std::string &object_id,
70 const ObjectDecisionType &decision) {
71 auto *obstacle = obstacles_.
Find(object_id);
73 AERROR <<
"failed to find obstacle";
81 for (
const auto *obstacle : obstacles_.
Items()) {
82 auto *obstacle_ptr = obstacles_.
Find(obstacle->Id());
88 const std::string &object_id,
89 const ObjectDecisionType &decision) {
90 auto *obstacle = obstacles_.
Find(object_id);
92 AERROR <<
"failed to find obstacle";
100 const std::string &obj_id,
105 reference_line.
XYToSL(stop_point, &stop_line_sl);
107 double stop_line_s = stop_line_sl.
s();
108 if (stop_line_s < 0.0 || stop_line_s > reference_line.
Length()) {
109 AERROR <<
"Ignore object:" << obj_id <<
" fence route_s[" << stop_line_s
110 <<
"] not in range[0, " << reference_line.
Length() <<
"]";
116 stop_line_s = std::fmax(
117 stop_line_s, adc_sl_boundary.
end_s() -
118 vehicle_config.vehicle_param().front_edge_to_center());
120 if (stop_line_s >= stop_reference_line_s_) {
121 ADEBUG <<
"stop point is farther than current main stop point.";
126 main_stop_.set_reason_code(obj_stop.reason_code());
127 main_stop_.set_reason(
"stop by " + obj_id);
128 main_stop_.mutable_stop_point()->set_x(obj_stop.stop_point().x());
129 main_stop_.mutable_stop_point()->set_y(obj_stop.stop_point().y());
130 main_stop_.set_stop_heading(obj_stop.stop_heading());
131 stop_reference_line_s_ = stop_line_s;
133 ADEBUG <<
" main stop obstacle id:" << obj_id
134 <<
" stop_line_s:" << stop_line_s <<
" stop_point: ("
135 << obj_stop.stop_point().x() << obj_stop.stop_point().y()
136 <<
" ) stop_heading: " << obj_stop.stop_heading();
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
T * Find(const I id)
Find object by id in the container
T * Add(const I id, const T &object)
copy object into the container.
const std::vector< const T * > & Items() const
List all the items in the container.
This is the class that associates an Obstacle with its path properties.
void AddLongitudinalDecision(const std::string &decider_tag, const ObjectDecisionType &decision)
void AddLateralDecision(const std::string &decider_tag, const ObjectDecisionType &decision)
const std::string & Id() const
void set_path_st_boundary(const STBoundary &boundary)
void SetSTBoundary(const std::string &id, const STBoundary &boundary)
const Obstacle * Find(const std::string &object_id) const
const IndexedList< std::string, Obstacle > & obstacles() const
bool MergeWithMainStop(const ObjectStop &obj_stop, const std::string &obj_id, const ReferenceLine &ref_line, const SLBoundary &adc_sl_boundary)
bool AddLateralDecision(const std::string &tag, const std::string &object_id, const ObjectDecisionType &decision)
bool AddLongitudinalDecision(const std::string &tag, const std::string &object_id, const ObjectDecisionType &decision)
Obstacle * AddObstacle(const Obstacle &obstacle)
const perception::PerceptionObstacle * FindPerceptionObstacle(const std::string &perception_obstacle_id) const
bool XYToSL(const common::math::Vec2d &xy_point, common::SLPoint *const sl_point, double warm_start_s=-1.0) const
Transvert Cartesian coordinates to Frenet.
Planning module main class.