26#include <unordered_map>
29#include "modules/common_msgs/config_msgs/vehicle_config.pb.h"
30#include "modules/common_msgs/perception_msgs/perception_obstacle.pb.h"
31#include "modules/common_msgs/planning_msgs/decision.pb.h"
32#include "modules/common_msgs/planning_msgs/sl_boundary.pb.h"
33#include "modules/common_msgs/prediction_msgs/prediction_obstacle.pb.h"
68 const bool is_static);
73 const bool is_static);
75 const std::string&
Id()
const {
return id_; }
76 void SetId(
const std::string&
id) { id_ = id; }
78 double speed()
const {
return speed_; }
91 return perception_bounding_box_;
94 return perception_polygon_;
103 return perception_obstacle_;
125 return is_caution_level_obstacle_;
154 const std::vector<ObjectDecisionType>&
decisions()
const;
157 const ObjectDecisionType& decision);
160 const ObjectDecisionType& decision);
166 return path_st_boundary_initialized_;
202 const double adc_start_s);
230 FRIEND_TEST(MergeLongitudinalDecision, AllDecisions);
231 static ObjectDecisionType MergeLongitudinalDecision(
232 const ObjectDecisionType& lhs,
const ObjectDecisionType& rhs);
233 FRIEND_TEST(MergeLateralDecision, AllDecisions);
234 static ObjectDecisionType MergeLateralDecision(
const ObjectDecisionType& lhs,
235 const ObjectDecisionType& rhs);
237 bool BuildTrajectoryStBoundary(
const ReferenceLine& reference_line,
238 const double adc_start_s,
240 bool IsValidObstacle(
245 int32_t perception_id_ = 0;
246 bool is_static_ =
false;
247 bool is_virtual_ =
false;
250 bool path_st_boundary_initialized_ =
false;
257 std::vector<ObjectDecisionType> decisions_;
258 std::vector<std::string> decider_tags_;
264 ObjectDecisionType lateral_decision_;
265 ObjectDecisionType longitudinal_decision_;
268 bool is_blocking_obstacle_ =
false;
270 bool is_lane_blocking_ =
false;
272 bool is_lane_change_blocking_ =
false;
274 bool is_caution_level_obstacle_ =
false;
276 double min_radius_stop_distance_ = -1.0;
278 struct ObjectTagCaseHash {
280 const planning::ObjectDecisionType::ObjectTagCase tag)
const {
281 return static_cast<size_t>(tag);
285 static const std::unordered_map<ObjectDecisionType::ObjectTagCase, int,
287 s_lateral_decision_safety_sorter_;
288 static const std::unordered_map<ObjectDecisionType::ObjectTagCase, int,
290 s_longitudinal_decision_safety_sorter_;
Rectangular (undirected) bounding box in 2-D.
The class of polygon in 2-D.
This is the class that associates an Obstacle with its path properties.
static bool IsLongitudinalDecision(const ObjectDecisionType &decision)
check if an ObjectDecisionType is a longitudinal decision.
std::string DebugString() const
const std::vector< std::string > & decider_tags() const
const STBoundary & path_st_boundary() const
const STBoundary & reference_line_st_boundary() const
static bool IsLateralDecision(const ObjectDecisionType &decision)
check if an ObjectDecisionType is a lateral decision.
void SetReferenceLineStBoundaryType(const STBoundary::BoundaryType type)
bool IsLongitudinalIgnore() const
const std::vector< ObjectDecisionType > & decisions() const
const perception::PerceptionObstacle & Perception() const
void AddLongitudinalDecision(const std::string &decider_tag, const ObjectDecisionType &decision)
const ObjectDecisionType & LateralDecision() const
return the merged lateral decision Lateral decision is one of {Nudge, Ignore}
common::TrajectoryPoint GetPointAtTime(const double time) const
bool HasTrajectory() const
void SetId(const std::string &id)
static bool IsValidTrajectoryPoint(const common::TrajectoryPoint &point)
double MinRadiusStopDistance(const common::VehicleParam &vehicle_param) const
Calculate stop distance with the obstacle using the ADC's minimum turning radius
void EraseReferenceLineStBoundary()
void PrintPolygonCurve() const
bool IsLaneBlocking() const
void SetReferenceLineStBoundary(const STBoundary &boundary)
void SetBlockingObstacle(bool blocking)
void AddLateralDecision(const std::string &decider_tag, const ObjectDecisionType &decision)
void CheckLaneBlocking(const ReferenceLine &reference_line)
bool HasLongitudinalDecision() const
const ObjectDecisionType & LongitudinalDecision() const
return the merged longitudinal decision Longitudinal decision is one of {Stop, Yield,...
void SetLaneChangeBlocking(const bool is_distance_clear)
const prediction::Trajectory & Trajectory() const
const std::string & Id() const
int32_t PerceptionId() const
bool IsCautionLevelObstacle() const
common::math::Box2d GetBoundingBox(const common::TrajectoryPoint &point) const
void SetStBoundaryType(const STBoundary::BoundaryType type)
bool IsLaneChangeBlocking() const
bool IsLateralIgnore() const
bool IsBlockingObstacle() const
bool HasLateralDecision() const
static std::unique_ptr< Obstacle > CreateStaticVirtualObstacles(const std::string &id, const common::math::Box2d &obstacle_box)
static bool IsValidPerceptionObstacle(const perception::PerceptionObstacle &obstacle)
bool HasNonIgnoreDecision() const
void BuildReferenceLineStBoundary(const ReferenceLine &reference_line, const double adc_start_s)
void set_path_st_boundary(const STBoundary &boundary)
const SLBoundary & PerceptionSLBoundary() const
bool is_path_st_boundary_initialized() const
const common::math::Polygon2d & PerceptionPolygon() const
static std::list< std::unique_ptr< Obstacle > > CreateObstacles(const prediction::PredictionObstacles &predictions)
This is a helper function that can create obstacles from prediction data.
void SetPerceptionSlBoundary(const SLBoundary &sl_boundary)
common::math::Polygon2d GetObstacleTrajectoryPolygon(const common::TrajectoryPoint &point) const
const common::math::Box2d & PerceptionBoundingBox() const
bool IsIgnore() const
Check if this object can be safely ignored.
Planning module main class.
ThreadSafeIndexedList< std::string, Obstacle > ThreadSafeIndexedObstacles
IndexedList< std::string, Obstacle > IndexedObstacles
repeated apollo::common::TrajectoryPoint trajectory_point