Apollo 11.0
自动驾驶开放平台
apollo::planning::AutotuningSpeedFeatureBuilder类 参考

: build the mlp cost functional for speed profile based on trajectory raw feature 更多...

#include <autotuning_speed_feature_builder.h>

类 apollo::planning::AutotuningSpeedFeatureBuilder 继承关系图:
apollo::planning::AutotuningSpeedFeatureBuilder 的协作图:

Public 成员函数

 AutotuningSpeedFeatureBuilder ()=default
 
virtual ~AutotuningSpeedFeatureBuilder ()=default
 
common::Status BuildFeature (const autotuning::TrajectoryRawFeature &raw_feature, autotuning::TrajectoryFeature *const input_feature) const override
 
common::Status BuildPointFeature (const autotuning::TrajectoryPointRawFeature &raw_point_feature, autotuning::TrajectoryPointwiseFeature *const point_feature) const override
 
- Public 成员函数 继承自 apollo::planning::AutotuningFeatureBuilder
 AutotuningFeatureBuilder ()=default
 : constructor
 
virtual ~AutotuningFeatureBuilder ()=default
 

详细描述

: build the mlp cost functional for speed profile based on trajectory raw feature

在文件 autotuning_speed_feature_builder.h 第 28 行定义.

构造及析构函数说明

◆ AutotuningSpeedFeatureBuilder()

apollo::planning::AutotuningSpeedFeatureBuilder::AutotuningSpeedFeatureBuilder ( )
default

◆ ~AutotuningSpeedFeatureBuilder()

virtual apollo::planning::AutotuningSpeedFeatureBuilder::~AutotuningSpeedFeatureBuilder ( )
virtualdefault

成员函数说明

◆ BuildFeature()

Status apollo::planning::AutotuningSpeedFeatureBuilder::BuildFeature ( const autotuning::TrajectoryRawFeature &  raw_feature,
autotuning::TrajectoryFeature *const  input_feature 
) const
overridevirtual
参数
raw feature function input
generated model input feature from raw feature, function output

实现了 apollo::planning::AutotuningFeatureBuilder.

在文件 autotuning_speed_feature_builder.cc 第 34 行定义.

36 {
37 if (input_feature == nullptr) {
38 const std::string msg = "input trajectory feature is empty";
39 AERROR << msg;
40 return Status(ErrorCode::PLANNING_ERROR, msg);
41 }
42
43 // number of input trajectory point
44 int n = input_feature->point_feature_size();
45 if (n != raw_feature.point_feature_size()) {
46 const std::string msg =
47 absl::StrCat("raw and input feature size mismatch. raw: ",
48 raw_feature.point_feature_size(), "; input: ", n);
49 AERROR << msg;
50 return Status(ErrorCode::PLANNING_ERROR, msg);
51 }
52
53 for (int i = 0; i < n; ++i) {
54 const auto& raw_point_feature = raw_feature.point_feature(i);
55 auto* point_feature = input_feature->mutable_point_feature(i);
56 auto status = BuildPointFeature(raw_point_feature, point_feature);
57 if (status != Status::OK()) {
58 const std::string msg = "pointwise feature adding incorrect";
59 return Status(ErrorCode::PLANNING_ERROR, msg);
60 }
61 }
62 return Status::OK();
63}
A general class to denote the return status of an API call.
Definition status.h:43
static Status OK()
generate a success status.
Definition status.h:60
common::Status BuildPointFeature(const autotuning::TrajectoryPointRawFeature &raw_point_feature, autotuning::TrajectoryPointwiseFeature *const point_feature) const override
#define AERROR
Definition log.h:44

◆ BuildPointFeature()

Status apollo::planning::AutotuningSpeedFeatureBuilder::BuildPointFeature ( const autotuning::TrajectoryPointRawFeature &  raw_point_feature,
autotuning::TrajectoryPointwiseFeature *const  point_feature 
) const
overridevirtual
参数
pointwise raw feature, function input
generated model input feature, function output

实现了 apollo::planning::AutotuningFeatureBuilder.

在文件 autotuning_speed_feature_builder.cc 第 65 行定义.

67 {
68 // set up basic feature:
69 double v = raw_point_feature.speed_feature().v();
70 auto* speed_feature = point_feature->mutable_speed_input_feature();
71 speed_feature->set_s(raw_point_feature.speed_feature().s());
72 speed_feature->set_t(raw_point_feature.speed_feature().t());
73 speed_feature->set_v(v);
74 speed_feature->set_acc(raw_point_feature.speed_feature().a());
75 speed_feature->set_jerk(raw_point_feature.speed_feature().j());
76 speed_feature->set_speed_limit(
77 raw_point_feature.speed_feature().speed_limit());
78
79 double kappa = raw_point_feature.path_feature().cartesian_coord().kappa();
80 double lateral_acc = v * v * kappa;
81
82 speed_feature->set_path_curvature_abs(std::fabs(kappa));
83 speed_feature->set_lateral_acc(lateral_acc);
84
85 // boundary feature, virtual obstacle , e.g. routing end
86 for (int i = 0; i < raw_point_feature.speed_feature().virtual_decision_size();
87 ++i) {
88 const auto& obj_decision =
89 raw_point_feature.speed_feature().virtual_decision(i);
90 auto* input_decision = speed_feature->add_virtual_obs_feature();
91 map_obstacle_feature(obj_decision, input_decision);
92 }
93
94 // boundary feature, stop obstacle, based on stop decision
95 for (int i = 0; i < raw_point_feature.speed_feature().stop_size(); ++i) {
96 const auto& obj_decision = raw_point_feature.speed_feature().stop(i);
97 auto* input_decision = speed_feature->add_stop_obs_feature();
98 map_obstacle_feature(obj_decision, input_decision);
99 }
100
101 // boundary feature, overtake obstacle, based on overtake obstacle decision
102 for (int i = 0; i < raw_point_feature.speed_feature().overtake_size(); ++i) {
103 const auto& obj_decision = raw_point_feature.speed_feature().overtake(i);
104 auto* input_decision = speed_feature->add_overtake_obs_feature();
105 map_obstacle_feature(obj_decision, input_decision);
106 }
107
108 // boundary feature, yield/follow obstacle, based on yield/follow obstacle
109 // decision
110 for (int i = 0; i < raw_point_feature.speed_feature().follow_size(); ++i) {
111 const auto& obj_decision = raw_point_feature.speed_feature().follow(i);
112 auto* input_decision = speed_feature->add_follow_obs_feature();
113 map_obstacle_feature(obj_decision, input_decision);
114 }
115
116 // boundary feature, nudge obstacle feature
117 for (int i = 0; i < raw_point_feature.speed_feature().nudge_size(); ++i) {
118 const auto& obj_decision = raw_point_feature.speed_feature().nudge(i);
119 auto* input_decision = speed_feature->add_nudge_obs_feature();
120 map_nudge_obs_feature(obj_decision, input_decision);
121 }
122
123 // boundary feature, side pass feature
124 for (int i = 0; i < raw_point_feature.speed_feature().sidepass_front_size();
125 ++i) {
126 const auto& obj_decision =
127 raw_point_feature.speed_feature().sidepass_front(i);
128 auto* input_decision = speed_feature->add_sidepass_front_obs_feature();
129 map_sidepass_obs_feature(obj_decision, input_decision);
130 }
131 for (int i = 0; i < raw_point_feature.speed_feature().sidepass_rear_size();
132 ++i) {
133 const auto& obj_decision =
134 raw_point_feature.speed_feature().sidepass_rear(i);
135 auto* input_decision = speed_feature->add_sidepass_rear_obs_feature();
136 map_sidepass_obs_feature(obj_decision, input_decision);
137 }
138 return Status::OK();
139}

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