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

#include <speed_setting.h>

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

Public 成员函数

 SpeedSetting ()
 
virtual ~SpeedSetting ()=default
 
common::Status ApplyRule (Frame *const frame, ReferenceLineInfo *const reference_line_info)
 
void Reset () override
 
- Public 成员函数 继承自 apollo::planning::TrafficRule
 TrafficRule ()
 
virtual ~TrafficRule ()=default
 
virtual bool Init (const std::string &name, const std::shared_ptr< DependencyInjector > &injector)
 
std::string Getname ()
 

额外继承的成员函数

- Protected 成员函数 继承自 apollo::planning::TrafficRule
template<typename T >
bool LoadConfig (T *config)
 
- Protected 属性 继承自 apollo::planning::TrafficRule
std::shared_ptr< DependencyInjector > injector_
 
std::string config_path_
 
std::string name_
 

详细描述

在文件 speed_setting.h 第 29 行定义.

构造及析构函数说明

◆ SpeedSetting()

apollo::planning::SpeedSetting::SpeedSetting ( )

在文件 speed_setting.cc 第 30 行定义.

30 : last_cruise_speed_(-1.0), last_sequence_num_(-1) {
31 // hook: Apollo License Verification: v_apollo_park
32}

◆ ~SpeedSetting()

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

成员函数说明

◆ ApplyRule()

Status apollo::planning::SpeedSetting::ApplyRule ( Frame *const  frame,
ReferenceLineInfo *const  reference_line_info 
)
virtual

实现了 apollo::planning::TrafficRule.

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

34 {
35 const auto& planning_command = frame->local_view().planning_command;
36 // If there is new planning command, use the last set cruise speed.
37 if (!planning_command->has_header() || !planning_command->header().has_sequence_num()
38 || planning_command->header().sequence_num() == last_sequence_num_) {
39 // Set the cruise speed with last speed limit.
40 if (last_cruise_speed_ > 0.0) {
41 reference_line_info->SetCruiseSpeed(last_cruise_speed_);
42 }
43 return Status::OK();
44 }
45 // Update the new cruise speed when new motion command comes. The first time
46 // received new motion command, use the new cruise speed.
47 if (planning_command->is_motion_command()) {
48 last_cruise_speed_ = reference_line_info->GetBaseCruiseSpeed();
49 return Status::OK();
50 }
51
52 // Only deal with planning command which has "SpeedCommand" as custom command.
53 if (!planning_command->has_custom_command()
54 || !planning_command->custom_command().Is<external_command::SpeedCommand>()) {
55 // Set the cruise speed with last speed limit.
56 if (last_cruise_speed_ > 0.0) {
57 reference_line_info->SetCruiseSpeed(last_cruise_speed_);
58 }
59 return Status::OK();
60 }
61 const auto& custom_command = planning_command->custom_command();
62 external_command::SpeedCommand speed_command;
63 if (!custom_command.UnpackTo(&speed_command)) {
64 // Set the cruise speed with last speed limit.
65 if (last_cruise_speed_ > 0.0) {
66 reference_line_info->SetCruiseSpeed(last_cruise_speed_);
67 }
68 AERROR << "Unpack speed command failed!";
70 }
71 // If command is to restore the target speed, don't modify it in
72 // "reference_line_info".
73 if (speed_command.has_is_restore_target_speed() && speed_command.is_restore_target_speed()) {
74 last_cruise_speed_ = reference_line_info->GetBaseCruiseSpeed();
75 return Status::OK();
76 }
77 last_sequence_num_ = planning_command->header().sequence_num();
78 // Get the cruise speed for the first time.
79 if (last_cruise_speed_ < 0.0) {
80 last_cruise_speed_ = reference_line_info->GetBaseCruiseSpeed();
81 }
82 // Deal with the command for adjusting target speed.
83 if (speed_command.has_target_speed()) {
84 reference_line_info->SetCruiseSpeed(speed_command.target_speed());
85 } else if (speed_command.has_target_speed_factor()) {
86 // Calculate the target speed with speed_factor.
87 double target_speed = last_cruise_speed_ * speed_command.target_speed_factor();
88 reference_line_info->SetCruiseSpeed(target_speed);
89 }
90 last_cruise_speed_ = reference_line_info->GetBaseCruiseSpeed();
91 return Status::OK();
92}
static Status OK()
generate a success status.
Definition status.h:60
#define AERROR
Definition log.h:44

◆ Reset()

void apollo::planning::SpeedSetting::Reset ( )
inlineoverridevirtual

实现了 apollo::planning::TrafficRule.

在文件 speed_setting.h 第 37 行定义.

37{}

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