docs/07_Prediction/prediction_predictor.md
The prediction module comprises 4 main functionalities: Container, Scenario, Evaluator and Predictor.
Predictor generates predicted trajectories for obstacles. Currently, the supported predictors include:
Here, we mainly introduce three typical predictors,extrapolation predictor, move sequence predictor and interaction predictor,other predictors are similar to them.
Please refer prediction predictor.
This predictor is used to extend the Semantic LSTM evaluator's results to creat a long-term trajectroy(which is 8 sec).
There are two main kinds of extrapolation, extrapolate by lane and extrapolate by free move.
LaneSearchResult SearchExtrapolationLane(const Trajectory& trajectory,
const int num_tail_point);
static bool GetProjection(
const Eigen::Vector2d& position,
const std::shared_ptr<const hdmap::LaneInfo> lane_info, double* s,double* l);
static bool SmoothPointFromLane(const std::string& id, const double s,
const double l, Eigen::Vector2d* point,
double* heading);
ComputeExtraplationSpeed. void ExtrapolateByLane(const LaneSearchResult& lane_search_result,
const double extrapolation_speed,
Trajectory* trajectory_ptr,
ObstacleClusters* clusters_ptr);
double ComputeExtraplationSpeed(const int num_tail_point,
const Trajectory& trajectory);
Otherwise we use free move module to extend.
void ExtrapolateByFreeMove(const int num_tail_point,
const double extrapolation_speed,
Trajectory* trajectory_ptr);
Obstacle moves along the lanes by its kinetic pattern.
Ingore those lane sequences with lower probability.
void FilterLaneSequences(
const Feature& feature, const std::string& lane_id,
const Obstacle* ego_vehicle_ptr,
const ADCTrajectoryContainer* adc_trajectory_container,
std::vector<bool>* enable_lane_sequence);
bool SupposedToStop(const Feature& feature, const double stop_distance,
double* acceleration);
void DrawConstantAccelerationTrajectory(
const Obstacle& obstacle, const LaneSequence& lane_sequence,
const double total_time, const double period, const double acceleration,
std::vector<apollo::common::TrajectoryPoint>* points);
bool DrawMoveSequenceTrajectoryPoints(
const Obstacle& obstacle, const LaneSequence& lane_sequence,
const double total_time, const double period,
std::vector<apollo::common::TrajectoryPoint>* points);
Compute the likelihood to create posterier prediction results after all evaluators have run. This predictor was created for caution level obstacles.
Sampling ADC trajectory at a fixed interval(which can be changed in prediction gflag file).
void BuildADCTrajectory(
const ADCTrajectoryContainer* adc_trajectory_container,
const double time_resolution);
total_cost = w_acc * cost_acc + w_centri * cost_centri + w_collision * cost_collision
Note that, the collsion cost is calucalated by the distance between ADC and obstacles.
double ComputeTrajectoryCost(
const Obstacle& obstacle, const LaneSequence& lane_sequence,
const double acceleration,
const ADCTrajectoryContainer* adc_trajectory_container);
likelihood = exp (-alpha * total_cost), the alpha can be changed in prediction gflag file.
double ComputeLikelihood(const double cost);
double ComputePosterior(const double prior, const double likelihood);