Apollo 10.0
自动驾驶开放平台
apollo::prediction::ObstaclesPrioritizer类 参考

#include <obstacles_prioritizer.h>

apollo::prediction::ObstaclesPrioritizer 的协作图:

Public 成员函数

 ObstaclesPrioritizer ()=delete
 
 ObstaclesPrioritizer (const std::shared_ptr< ContainerManager > &container_manager)
 
void AssignIgnoreLevel ()
 
void AssignCautionLevel ()
 

详细描述

在文件 obstacles_prioritizer.h34 行定义.

构造及析构函数说明

◆ ObstaclesPrioritizer() [1/2]

apollo::prediction::ObstaclesPrioritizer::ObstaclesPrioritizer ( )
delete

◆ ObstaclesPrioritizer() [2/2]

apollo::prediction::ObstaclesPrioritizer::ObstaclesPrioritizer ( const std::shared_ptr< ContainerManager > &  container_manager)
explicit

在文件 obstacles_prioritizer.cc91 行定义.

93 : container_manager_(container_manager) {}

成员函数说明

◆ AssignCautionLevel()

void apollo::prediction::ObstaclesPrioritizer::AssignCautionLevel ( )

在文件 obstacles_prioritizer.cc172 行定义.

172 {
173 auto obstacles_container =
174 container_manager_->GetContainer<ObstaclesContainer>(
176 if (obstacles_container == nullptr) {
177 AERROR << "Obstacles container pointer is a null pointer.";
178 return;
179 }
180 Obstacle* ego_vehicle =
181 obstacles_container->GetObstacle(FLAGS_ego_vehicle_id);
182 if (ego_vehicle == nullptr) {
183 AERROR << "Ego vehicle not found";
184 return;
185 }
186 if (ego_vehicle->history_size() == 0) {
187 AERROR << "Ego vehicle has no history";
188 return;
189 }
190 auto storytelling_container =
191 container_manager_->GetContainer<StoryTellingContainer>(
193 if (storytelling_container->ADCDistanceToJunction() <
194 FLAGS_junction_distance_threshold) {
195 AssignCautionLevelInJunction(*ego_vehicle, obstacles_container,
196 storytelling_container->ADCJunctionId());
197 }
198 AssignCautionLevelCruiseKeepLane(*ego_vehicle, obstacles_container);
199 AssignCautionLevelCruiseChangeLane(*ego_vehicle, obstacles_container);
200 AssignCautionLevelByEgoReferenceLine(*ego_vehicle, obstacles_container);
201 AssignCautionLevelPedestrianByEgoReferenceLine(*ego_vehicle,
202 obstacles_container);
203 if (FLAGS_enable_all_pedestrian_caution_in_front) {
204 AssignCautionLevelPedestrianInFront(*ego_vehicle, obstacles_container);
205 }
206 if (FLAGS_enable_rank_caution_obstacles) {
207 RankingCautionLevelObstacles(*ego_vehicle, obstacles_container);
208 }
209}
#define AERROR
Definition log.h:44

◆ AssignIgnoreLevel()

void apollo::prediction::ObstaclesPrioritizer::AssignIgnoreLevel ( )

在文件 obstacles_prioritizer.cc95 行定义.

95 {
96 auto obstacles_container =
97 container_manager_->GetContainer<ObstaclesContainer>(
99 if (obstacles_container == nullptr) {
100 AERROR << "Obstacles container pointer is a null pointer.";
101 return;
102 }
103
104 Obstacle* ego_obstacle_ptr =
105 obstacles_container->GetObstacle(FLAGS_ego_vehicle_id);
106 if (ego_obstacle_ptr == nullptr) {
107 AERROR << "Ego obstacle nullptr found";
108 return;
109 }
110
111 const Feature& ego_feature = ego_obstacle_ptr->latest_feature();
112 double ego_theta = ego_feature.theta();
113 double ego_x = ego_feature.position().x();
114 double ego_y = ego_feature.position().y();
115 ADEBUG << "Get pose (" << ego_x << ", " << ego_y << ", " << ego_theta << ")";
116
117 // Build rectangular scan_area
118 Box2d scan_box({ego_x + FLAGS_scan_length / 2.0 * std::cos(ego_theta),
119 ego_y + FLAGS_scan_length / 2.0 * std::sin(ego_theta)},
120 ego_theta, FLAGS_scan_length, FLAGS_scan_width);
121
122 const auto& obstacle_ids =
123 obstacles_container->curr_frame_movable_obstacle_ids();
124 for (const int obstacle_id : obstacle_ids) {
125 Obstacle* obstacle_ptr = obstacles_container->GetObstacle(obstacle_id);
126 if (obstacle_ptr == nullptr) {
127 AERROR << "Null obstacle pointer found.";
128 continue;
129 }
130 if (obstacle_ptr->history_size() == 0) {
131 AERROR << "Obstacle [" << obstacle_ptr->id() << "] has no feature.";
132 continue;
133 }
134 Feature* latest_feature_ptr = obstacle_ptr->mutable_latest_feature();
135 double obstacle_x = latest_feature_ptr->position().x();
136 double obstacle_y = latest_feature_ptr->position().y();
137 Vec2d ego_to_obstacle_vec(obstacle_x - ego_x, obstacle_y - ego_y);
138 Vec2d ego_vec = Vec2d::CreateUnitVec2d(ego_theta);
139 double s = ego_to_obstacle_vec.InnerProd(ego_vec);
140
141 double pedestrian_like_nearby_lane_radius =
142 FLAGS_pedestrian_nearby_lane_search_radius;
143 bool is_near_lane = PredictionMap::HasNearbyLane(
144 obstacle_x, obstacle_y, pedestrian_like_nearby_lane_radius);
145
146 // Decide if we need consider this obstacle
147 bool is_in_scan_area = scan_box.IsPointIn({obstacle_x, obstacle_y});
148 bool is_on_lane = obstacle_ptr->IsOnLane();
149 bool is_pedestrian_like_in_front_near_lanes =
150 s > FLAGS_back_dist_ignore_ped &&
151 (latest_feature_ptr->type() == PerceptionObstacle::PEDESTRIAN ||
152 latest_feature_ptr->type() == PerceptionObstacle::BICYCLE ||
153 latest_feature_ptr->type() == PerceptionObstacle::UNKNOWN ||
154 latest_feature_ptr->type() == PerceptionObstacle::UNKNOWN_MOVABLE) &&
155 is_near_lane;
156 bool is_near_junction = obstacle_ptr->IsNearJunction();
157
158 bool need_consider = is_in_scan_area || is_on_lane || is_near_junction ||
159 is_pedestrian_like_in_front_near_lanes;
160
161 if (!need_consider) {
162 latest_feature_ptr->mutable_priority()->set_priority(
164 } else {
165 latest_feature_ptr->mutable_priority()->set_priority(
167 }
168 }
169 obstacles_container->SetConsideredObstacleIds();
170}
static Vec2d CreateUnitVec2d(const double angle)
Creates a unit-vector with a given angle to the positive x semi-axis
Definition vec2d.cc:29
static bool HasNearbyLane(const double x, const double y, const double radius)
If there is a lane in the range with radius
#define ADEBUG
Definition log.h:41

该类的文档由以下文件生成: