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

43次阅读
没有评论

共计 1753 个字符,预计需要花费 5 分钟才能阅读完成。

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

简介

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

添加预测器的步骤

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

定义一个继承基类  Predictor  的类

实现新类  NewPredictor

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

更新 prediction_conf

更新预测器管理器(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()  如下:

1
RegisterPredictor(ObstacleConf::NEW_PREDICTOR);

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

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-16发表,共计1753字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)