千家信息网

apollo怎么在预测模块中添加一个预测器

发表于:2025-02-04 作者:千家信息网编辑
千家信息网最后更新 2025年02月04日,这篇文章给大家分享的是有关apollo怎么在预测模块中添加一个预测器的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。简介预测器为每个障碍物生成预测轨迹。在这里,假设我们想给我
千家信息网最后更新 2025年02月04日apollo怎么在预测模块中添加一个预测器

这篇文章给大家分享的是有关apollo怎么在预测模块中添加一个预测器的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

简介

预测器为每个障碍物生成预测轨迹。在这里,假设我们想给我们的车辆增加一个新的预测器,用于其他类型的障碍。

添加预测器的步骤

如下步骤将会指导您在预测器中添加一个 NewPredictor

  1. 定义一个继承基类 Predictor 的类

  2. 实现新类 NewPredictor

  3. prediction_conf.proto中添加一个新的预测器类型

  4. 更新 prediction_conf

  5. 更新预测器管理器(Predictor manager)

下面让我们用上面的方法来添加新的预测器。

一、定义一个继承基类 Predictor的类

在文件夹 modules/prediction/predictor/vehicle中创建一个名为new_predictor.h的文件,文件内容如下:

#include "modules/prediction/predictor/predictor.h"namespace apollo {namespace prediction {class NewPredictor : public Predictor { public:  void Predict(Obstacle* obstacle) override;  // Other useful functions and fields.};}  // namespace prediction}  // namespace apollo

二、Implement the class NewPredictor

在创建了 new_predictor.h的文件夹中创建文件 new_predictor.cc。 文件内容如下:

#include "modules/prediction/predictor/vehicle/new_predictor.h"namespace apollo {namespace prediction {NewPredictor::Predict(Obstacle* obstacle)() {  // Get the results from evaluator  // Generate the predicted trajectory}// Other functions}  // namespace prediction}  // namespace apollo

三、添加新的预测器类型

prediction_conf.proto中添加新预测器类型:

enum PredictorType {   LANE_SEQUENCE_PREDICTOR = 0;   FREE_MOVE_PREDICTOR = 1;   REGIONAL_PREDICTOR = 2;   MOVE_SEQUENCE_PREDICTOR = 3;   NEW_PREDICTOR = 4; }

四、更新prediction_conf

modules/prediction/conf/prediction_conf.pb.txt中, 更新predictor_type部分如下:

obstacle_conf {  obstacle_type: VEHICLE  obstacle_status: ON_LANE  evaluator_type: NEW_EVALUATOR  predictor_type: NEW_PREDICTOR}

五、更新预测器管理器(Predictor manager)

更新 CreateEvluator( ... ) 如下:

case ObstacleConf::NEW_PREDICTOR: {    predictor_ptr.reset(new NewPredictor());    break;  }

更新 RegisterPredictors() 如下:

1RegisterPredictor(ObstacleConf::NEW_PREDICTOR);

感谢各位的阅读!关于"apollo怎么在预测模块中添加一个预测器"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

0