Apollo 10.0
自动驾驶开放平台
apollo::control::LatLonControllerSubmodule类 参考final

#include <lat_lon_controller_submodule.h>

类 apollo::control::LatLonControllerSubmodule 继承关系图:
apollo::control::LatLonControllerSubmodule 的协作图:

Public 成员函数

 LatLonControllerSubmodule ()
 Construct a new PID+LQR ControllerSubmodule object
 
 ~LatLonControllerSubmodule ()
 Destructor
 
std::string Name () const
 Get name of the node
 
bool Init () override
 Initialize the node
 
bool Proc (const std::shared_ptr< Preprocessor > &preprocessor_status) override
 generate control command
 
- Public 成员函数 继承自 apollo::cyber::Component< Preprocessor >
 Component ()
 
 ~Component () override
 
bool Initialize (const ComponentConfig &config) override
 init the component by protobuf object.
 
bool Process (const std::shared_ptr< Preprocessor > &msg0, const std::shared_ptr< NullType > &msg1, const std::shared_ptr< NullType > &msg2, const std::shared_ptr< NullType > &msg3)
 
- Public 成员函数 继承自 apollo::cyber::ComponentBase
virtual ~ComponentBase ()
 
virtual bool Initialize (const TimerComponentConfig &config)
 
virtual void Shutdown ()
 
template<typename T >
bool GetProtoConfig (T *config) const
 

额外继承的成员函数

- Public 类型 继承自 apollo::cyber::ComponentBase
template<typename M >
using Reader = cyber::Reader< M >
 
- Protected 成员函数 继承自 apollo::cyber::ComponentBase
virtual void Clear ()
 
const std::string & ConfigFilePath () const
 
void LoadConfigFiles (const ComponentConfig &config)
 
void LoadConfigFiles (const TimerComponentConfig &config)
 
- Protected 属性 继承自 apollo::cyber::ComponentBase
std::atomic< bool > is_shutdown_ = {false}
 
std::shared_ptr< Nodenode_ = nullptr
 
std::string config_file_path_ = ""
 
std::vector< std::shared_ptr< ReaderBase > > readers_
 

详细描述

在文件 lat_lon_controller_submodule.h38 行定义.

构造及析构函数说明

◆ LatLonControllerSubmodule()

apollo::control::LatLonControllerSubmodule::LatLonControllerSubmodule ( )

Construct a new PID+LQR ControllerSubmodule object

在文件 lat_lon_controller_submodule.cc36 行定义.

◆ ~LatLonControllerSubmodule()

apollo::control::LatLonControllerSubmodule::~LatLonControllerSubmodule ( )

Destructor

在文件 lat_lon_controller_submodule.cc39 行定义.

39{}

成员函数说明

◆ Init()

bool apollo::control::LatLonControllerSubmodule::Init ( )
overridevirtual

Initialize the node

返回
If initialized

实现了 apollo::cyber::ComponentBase.

在文件 lat_lon_controller_submodule.cc45 行定义.

45 {
46 injector_ = std::make_shared<DependencyInjector>();
47
48 lateral_controller_ = PluginManager::Instance()->CreateInstance<ControlTask>(
49 "apollo::control::LatController");
50 if (!lateral_controller_->Init(injector_).ok()) {
51 monitor_logger_buffer_.ERROR(
52 "Control init LAT controller failed! Stopping...");
53 return false;
54 }
55
56 longitudinal_controller_ =
58 "apollo::control::LonController");
59 if (!longitudinal_controller_->Init(injector_).ok()) {
60 monitor_logger_buffer_.ERROR(
61 "Control init LON controller failed! Stopping...");
62 return false;
63 }
64
65 control_core_writer_ =
66 node_->CreateWriter<ControlCommand>(FLAGS_control_core_command_topic);
67
68 ACHECK(control_core_writer_ != nullptr);
69
70 return true;
71}
std::shared_ptr< Node > node_
static PluginManager * Instance()
get singleton instance of PluginManager
std::shared_ptr< Base > CreateInstance(const std::string &derived_class)
create plugin instance of derived class based on Base
#define ACHECK(cond)
Definition log.h:80

◆ Name()

std::string apollo::control::LatLonControllerSubmodule::Name ( ) const

Get name of the node

返回
Name of the node

在文件 lat_lon_controller_submodule.cc41 行定义.

41 {
42 return FLAGS_lat_lon_controller_submodule_name;
43}

◆ Proc()

bool apollo::control::LatLonControllerSubmodule::Proc ( const std::shared_ptr< Preprocessor > &  preprocessor_status)
override

generate control command

返回
true control command is successfully generated
false fail to generate control command

在文件 lat_lon_controller_submodule.cc73 行定义.

74 {
75 const auto start_time = Clock::Now();
76 ControlCommand control_core_command;
77
78 // recording pad msg
79 if (preprocessor_status->received_pad_msg()) {
80 control_core_command.mutable_pad_msg()->CopyFrom(
81 preprocessor_status->local_view().pad_msg());
82 }
83 ADEBUG << "Lat+Lon controller submodule started ....";
84
85 // skip produce control command when estop for lat+lon controller
86 StatusPb pre_status = preprocessor_status->header().status();
87 if (pre_status.error_code() != ErrorCode::OK) {
88 control_core_command.mutable_header()->mutable_status()->CopyFrom(
89 pre_status);
90 AERROR << "Error in preprocessor submodule.";
91 return false;
92 }
93
94 Status status = ProduceControlCoreCommand(preprocessor_status->local_view(),
95 &control_core_command);
96 AERROR_IF(!status.ok()) << "Failed to produce control command:"
97 << status.error_message();
98
99 control_core_command.mutable_header()->set_lidar_timestamp(
100 preprocessor_status->header().lidar_timestamp());
101 control_core_command.mutable_header()->set_camera_timestamp(
102 preprocessor_status->header().camera_timestamp());
103 control_core_command.mutable_header()->set_radar_timestamp(
104 preprocessor_status->header().radar_timestamp());
105 common::util::FillHeader(Name(), &control_core_command);
106
107 const auto end_time = Clock::Now();
108
109 static apollo::common::LatencyRecorder latency_recorder(
110 FLAGS_control_core_command_topic);
111 latency_recorder.AppendLatencyRecord(
112 control_core_command.header().lidar_timestamp(), start_time, end_time);
113
114 control_core_command.mutable_header()->mutable_status()->set_error_code(
115 status.code());
116 control_core_command.mutable_header()->mutable_status()->set_msg(
117 status.error_message());
118
119 control_core_writer_->Write(control_core_command);
120 return status.ok();
121}
std::string Name() const
Get name of the node
static Time Now()
PRECISION >= 1000000 means the precision is at least 1us.
Definition clock.cc:40
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44
#define AERROR_IF(cond)
Definition log.h:74

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