28 #include <unordered_set> 37 #include "modules/prediction/proto/feature.pb.h" 38 #include "modules/prediction/proto/prediction_conf.pb.h" 39 #include "modules/prediction/proto/prediction_obstacle.pb.h" 46 namespace prediction {
57 static std::unique_ptr<Obstacle>
Create(
58 const perception::PerceptionObstacle& perception_obstacle,
59 const double timestamp,
const int prediction_id,
62 static std::unique_ptr<Obstacle>
Create(
const Feature&
feature,
73 junction_analyzer_ = junction_analyzer;
81 bool Insert(
const perception::PerceptionObstacle& perception_obstacle,
82 const double timestamp,
const int prediction_id);
98 perception::PerceptionObstacle::Type
type()
const;
121 const Feature&
feature(
const size_t i)
const;
194 bool IsInJunction(
const std::string& junction_id)
const;
240 void SetStatus(
const perception::PerceptionObstacle& perception_obstacle,
241 double timestamp, Feature* feature);
243 bool SetId(
const perception::PerceptionObstacle& perception_obstacle,
244 Feature* feature,
const int prediction_id = -1);
246 void SetType(
const perception::PerceptionObstacle& perception_obstacle,
249 void SetIsNearJunction(
250 const perception::PerceptionObstacle& perception_obstacle,
253 void SetTimestamp(
const perception::PerceptionObstacle& perception_obstacle,
254 const double timestamp, Feature* feature);
256 void SetPolygonPoints(
257 const perception::PerceptionObstacle& perception_obstacle,
260 void SetPosition(
const perception::PerceptionObstacle& perception_obstacle,
263 void SetVelocity(
const perception::PerceptionObstacle& perception_obstacle,
266 void AdjustHeadingByLane(Feature* feature);
268 void UpdateVelocity(
const double theta,
double* velocity_x,
269 double* velocity_y,
double* velocity_heading,
272 void SetAcceleration(Feature* feature);
274 void SetTheta(
const perception::PerceptionObstacle& perception_obstacle,
277 void SetLengthWidthHeight(
278 const perception::PerceptionObstacle& perception_obstacle,
281 void UpdateLaneBelief(Feature* feature);
283 void SetCurrentLanes(Feature* feature);
285 void SetNearbyLanes(Feature* feature);
287 void SetSurroundingLaneIds(Feature* feature,
const double radius);
289 void SetLaneSequenceStopSign(LaneSequence* lane_sequence_ptr);
294 void SetLanePoints(Feature* feature);
295 void SetLanePoints(
const Feature* feature,
const double lane_point_spacing,
296 const uint64_t max_num_lane_point,
297 const bool is_bidirection, LaneGraph*
const lane_graph);
301 void SetLaneSequencePath(LaneGraph*
const lane_graph);
303 void SetMotionStatus();
305 void SetMotionStatusBySpeed();
307 void InsertFeatureToHistory(
const Feature& feature);
309 void SetJunctionFeatureWithEnterLane(
const std::string& enter_lane_id,
310 Feature*
const feature_ptr);
312 void SetJunctionFeatureWithoutEnterLane(Feature*
const feature_ptr);
314 void DiscardOutdatedHistory();
316 void GetNeighborLaneSegments(
317 std::shared_ptr<const apollo::hdmap::LaneInfo> center_lane_info,
318 bool is_left,
int recursion_depth,
319 std::list<std::string>*
const lane_ids_ordered,
320 std::unordered_set<std::string>*
const existing_lane_ids);
322 bool HasJunctionExitLane(
323 const LaneSequence& lane_sequence,
324 const std::unordered_set<std::string>& exit_lane_id_set);
329 int id_ = FLAGS_ego_vehicle_id;
331 perception::PerceptionObstacle::Type type_ =
334 std::deque<Feature> feature_history_;
336 std::vector<std::shared_ptr<const hdmap::LaneInfo>> current_lanes_;
338 ObstacleConf obstacle_conf_;
bool IsOnLane() const
Check if the obstacle is on any lane.
bool ReceivedOlderMessage(const double timestamp) const
Prediction obstacle.
Definition: obstacle.h:52
int id() const
Get the obstacle's ID.
Feature * mutable_latest_feature()
Get a pointer to the latest feature.
const ObstacleConf & obstacle_conf()
Definition: obstacle.h:235
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool IsInJunction(const std::string &junction_id) const
Check if the obstacle is a junction.
bool IsSlow()
Check if the obstacle is slow.
size_t history_size() const
Get the number of historical features.
void SetPredictorType(const ObstacleConf::PredictorType &predictor_type)
PredictionObstacle GeneratePredictionObstacle()
virtual ~Obstacle()=default
Destructor.
bool InsertFeature(const Feature &feature)
Insert a feature proto message.
void SetNearbyObstacles()
Set nearby obstacles.
Feature * mutable_feature(const size_t i)
Get a pointer to the ith feature from latest to earliest.
const Feature & earliest_feature() const
Get the earliest feature.
double timestamp() const
Get the obstacle's timestamp.
const Feature & feature(const size_t i) const
Get the ith feature from latest to earliest.
Definition: obstacle_clusters.h:33
void TrimHistory(const size_t remain_size)
Defines the DigitalFilter class.
void BuildLaneGraph()
Build obstacle's lane graph.
void SetEvaluatorType(const ObstacleConf::EvaluatorType &evaluator_type)
bool IsPedestrian() const
bool IsNearJunction()
Check if the obstacle is near a junction.
void BuildLaneGraphFromLeftToRight()
Build obstacle's lane graph with lanes being ordered. This would be useful for lane-scanning algorith...
Definition: junction_analyzer.h:30
bool Insert(const perception::PerceptionObstacle &perception_obstacle, const double timestamp, const int prediction_id)
Insert a perception obstacle with its timestamp.
bool IsStill()
Check if the obstacle is still.
void SetCaution()
Set the obstacle as caution level.
Defines the templated KalmanFilter class.
bool IsCloseToJunctionExit() const
Check if the obstacle is close to a junction exit.
perception::PerceptionObstacle::Type type() const
Get the type of perception obstacle's type.
void ClearOldInformation()
void BuildJunctionFeature()
Build junction feature.
bool ToIgnore()
Check if the obstacle can be ignored.
static std::unique_ptr< Obstacle > Create(const perception::PerceptionObstacle &perception_obstacle, const double timestamp, const int prediction_id, ObstacleClusters *clusters_ptr)
Constructor.
void SetJunctionAnalyzer(JunctionAnalyzer *junction_analyzer)
Definition: obstacle.h:72
bool HasJunctionFeatureWithExits() const
Check if the obstacle has junction feature.
const Feature & latest_feature() const
Get the latest feature.