Apollo 10.0
自动驾驶开放平台
apollo::cyber::ComponentBase类 参考abstract

#include <component_base.h>

类 apollo::cyber::ComponentBase 继承关系图:
apollo::cyber::ComponentBase 的协作图:

Public 类型

template<typename M >
using Reader = cyber::Reader< M >
 

Public 成员函数

virtual ~ComponentBase ()
 
virtual bool Initialize (const ComponentConfig &config)
 
virtual bool Initialize (const TimerComponentConfig &config)
 
virtual void Shutdown ()
 
template<typename T >
bool GetProtoConfig (T *config) const
 

Protected 成员函数

virtual bool Init ()=0
 
virtual void Clear ()
 
const std::string & ConfigFilePath () const
 
void LoadConfigFiles (const ComponentConfig &config)
 
void LoadConfigFiles (const TimerComponentConfig &config)
 

Protected 属性

std::atomic< bool > is_shutdown_ = {false}
 
std::shared_ptr< Nodenode_ = nullptr
 
std::string config_file_path_ = ""
 
std::vector< std::shared_ptr< ReaderBase > > readers_
 

详细描述

在文件 component_base.h41 行定义.

成员类型定义说明

◆ Reader

template<typename M >
using apollo::cyber::ComponentBase::Reader = cyber::Reader<M>

在文件 component_base.h44 行定义.

构造及析构函数说明

◆ ~ComponentBase()

virtual apollo::cyber::ComponentBase::~ComponentBase ( )
inlinevirtual

在文件 component_base.h46 行定义.

46{}

成员函数说明

◆ Clear()

virtual void apollo::cyber::ComponentBase::Clear ( )
inlineprotectedvirtual

apollo::cyber::TimerComponent 重载.

在文件 component_base.h69 行定义.

69{ return; }

◆ ConfigFilePath()

const std::string & apollo::cyber::ComponentBase::ConfigFilePath ( ) const
inlineprotected

在文件 component_base.h70 行定义.

70{ return config_file_path_; }

◆ GetProtoConfig()

template<typename T >
bool apollo::cyber::ComponentBase::GetProtoConfig ( T *  config) const
inline

在文件 component_base.h63 行定义.

63 {
65 }
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132

◆ Init()

virtual bool apollo::cyber::ComponentBase::Init ( )
protectedpure virtual

apollo::drivers::video::CompCameraH265Compressed, ManualTrafficLight, CommonComponentSample, TimerComponentSample, apollo::audio::AudioComponent, apollo::bridge::UDPBridgeMultiReceiverComponent, apollo::bridge::UDPBridgeReceiverComponent< T >, apollo::bridge::UDPBridgeSenderComponent< T >, apollo::control::ControlComponent, apollo::control::LatLonControllerSubmodule, apollo::control::MPCControllerSubmodule, apollo::control::PostprocessorSubmodule, apollo::control::PreprocessorSubmodule, apollo::drivers::camera::CameraComponent, apollo::drivers::camera::CompressComponent, apollo::drivers::SensorCanbus< SensorType >, apollo::drivers::gnss::GnssDriverComponent, apollo::drivers::compensator::CompensatorComponent, apollo::drivers::fusion::PriSecFusionComponent, apollo::drivers::lidar::HesaiComponent2, apollo::drivers::lidar::LidarDriverComponent, apollo::drivers::lidar::LivoxLidarComponent, apollo::drivers::lslidar::LslidarComponent, apollo::drivers::lidar::RslidarComponent, apollo::drivers::lidar::SeyondComponent, apollo::drivers::lidar::VanjeelidarComponent, apollo::drivers::velodyne::CompensatorComponent, apollo::drivers::velodyne::VelodyneDriverComponent, apollo::drivers::velodyne::PriSecFusionComponent, apollo::drivers::velodyne::VelodyneConvertComponent, apollo::drivers::microphone::MicrophoneComponent, apollo::drivers::conti_radar::ContiRadarCanbusComponent, apollo::drivers::nano_radar::NanoRadarCanbusComponent, apollo::drivers::radar::OculiiRadarComponent, apollo::drivers::racobit_radar::RacobitRadarCanbusComponent, apollo::drivers::ultrasonic_radar::UltrasonicRadarCanbusComponent, apollo::drivers::smartereye::CompressComponent, apollo::drivers::smartereye::SmartereyeComponent, apollo::image_decompress::ImageDecompressComponent, ExternalCommandDemo, ExternalCommandWrapperDemo, apollo::old_routing_adapter::OldRoutingAdapter, apollo::external_command::ExternalCommandProcessComponent, apollo::guardian::GuardianComponent, apollo::localization::msf::OnlineVisualizerComponent, apollo::localization::MSFLocalizationComponent, apollo::localization::ndt::NDTLocalizationComponent, apollo::localization::RTKLocalizationComponent, apollo::relative_map::RelativeMapComponent, apollo::monitor::Monitor, apollo::perception::camera::CameraDetectionBevComponent, apollo::perception::camera::CameraDetectionMultiStageComponent, apollo::perception::camera::CameraDetectionOccComponent, apollo::perception::camera::CameraDetectionSingleStageComponent, apollo::perception::camera::CameraLocationEstimationComponent, apollo::perception::camera::CameraLocationRefinementComponent, apollo::perception::camera::CameraTrackingComponent, apollo::perception::onboard::LaneDetectionComponent, apollo::perception::lidar::LidarDetectionComponent, apollo::perception::lidar::LidarDetectionFilterComponent, apollo::perception::lidar::LidarOutputComponent, apollo::perception::lidar::LidarTrackingComponent, apollo::perception::camera::MotionServiceComponent, apollo::perception::MsgAdapterComponent, apollo::perception::fusion::MultiSensorFusionComponent, apollo::perception::lidar::PointCloudGroundDetectComponent, apollo::perception::lidar::PointCloudMapROIComponent, apollo::perception::lidar::PointCloudPreprocessComponent, apollo::perception::radar4d::Radar4dDetectionComponent, apollo::perception::radar::RadarDetectionComponent, apollo::perception::trafficlight::TrafficLightDetectComponent, apollo::perception::trafficlight::TrafficLightRecognComponent, apollo::perception::trafficlight::TrafficLightsPerceptionComponent, apollo::perception::trafficlight::TrafficLightTrackComponent, apollo::planning::PlanningComponent, apollo::prediction::PredictionComponent, apollo::prediction::EvaluatorSubmodule, apollo::prediction::PredictorSubmodule, apollo::routing::RoutingComponent, apollo::storytelling::Storytelling, apollo::task_manager::TaskManagerComponent, apollo::third_party_perception::ThirdPartyPerceptionComponent, apollo::prediction::FakePredictionComponent, apollo::transform::StaticTransformComponent, apollo::v2x::ft::V2XFusionComponent, apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >, apollo::drivers::lidar::LidarComponentBaseImpl< HesaiUdpFrame >, apollo::drivers::lidar::LidarComponentBaseImpl< livox::LivoxScan >, apollo::drivers::lidar::LidarComponentBaseImpl< LslidarScan >, apollo::drivers::lidar::LidarComponentBaseImpl< robosense::RobosenseScanPacket >, apollo::drivers::lidar::LidarComponentBaseImpl< seyond::SeyondScan >, apollo::drivers::lidar::LidarComponentBaseImpl< vanjee::VanjeeScanPacket >, apollo::drivers::lidar::LidarComponentBase< ScanType >, apollo::drivers::lidar::LidarComponentBase< HesaiUdpFrame >, apollo::drivers::lidar::LidarComponentBase< livox::LivoxScan >, apollo::drivers::lidar::LidarComponentBase< LslidarScan >, apollo::drivers::lidar::LidarComponentBase< robosense::RobosenseScanPacket >, apollo::drivers::lidar::LidarComponentBase< seyond::SeyondScan > , 以及 apollo::drivers::lidar::LidarComponentBase< vanjee::VanjeeScanPacket > 内被实现.

◆ Initialize() [1/2]

virtual bool apollo::cyber::ComponentBase::Initialize ( const ComponentConfig config)
inlinevirtual

apollo::cyber::Component< M0, M1, M2, M3 >, apollo::cyber::Component< ADCTrajectoryContainer, SubmoduleOutput >, apollo::cyber::Component< apollo::cyber::NullType >, apollo::cyber::Component< apollo::drivers::CompressedImage >, apollo::cyber::Component< apollo::drivers::Image >, apollo::cyber::Component< apollo::drivers::microphone::config::AudioData >, apollo::cyber::Component< apollo::perception::PerceptionObstacles, ADCTrajectoryContainer, SubmoduleOutput >, apollo::cyber::Component< ContiRadar >, apollo::cyber::Component< ControlCommand >, apollo::cyber::Component< Driver, Driver >, apollo::cyber::Component< drivers::gnss::Imu >, apollo::cyber::Component< drivers::Image >, apollo::cyber::Component< drivers::OculiiPointCloud >, apollo::cyber::Component< drivers::PointCloud >, apollo::cyber::Component< Image >, apollo::cyber::Component< LidarFrameMessage >, apollo::cyber::Component< localization::Gps >, apollo::cyber::Component< LocalView >, apollo::cyber::Component< onboard::CameraFrame >, apollo::cyber::Component< perception::PerceptionObstacles >, apollo::cyber::Component< PerceptionObstacles >, apollo::cyber::Component< PointCloud >, apollo::cyber::Component< prediction::PredictionObstacles, canbus::Chassis, localization::LocalizationEstimate >, apollo::cyber::Component< Preprocessor >, apollo::cyber::Component< routing::RoutingRequest >, apollo::cyber::Component< SensorFrameMessage >, apollo::cyber::Component< T >, apollo::cyber::Component< task_manager::Task >, apollo::cyber::Component< TrafficDetectMessage >, apollo::cyber::Component< VelodyneScan >, apollo::cyber::Component< NullType, NullType, NullType, NullType >, apollo::cyber::Component< M0, NullType, NullType, NullType >, apollo::cyber::Component< M0, M1, NullType, NullType > , 以及 apollo::cyber::Component< M0, M1, M2, NullType > 重载.

在文件 component_base.h48 行定义.

48{ return false; }

◆ Initialize() [2/2]

virtual bool apollo::cyber::ComponentBase::Initialize ( const TimerComponentConfig config)
inlinevirtual

apollo::cyber::TimerComponent 重载.

在文件 component_base.h49 行定义.

49{ return false; }

◆ LoadConfigFiles() [1/2]

void apollo::cyber::ComponentBase::LoadConfigFiles ( const ComponentConfig config)
inlineprotected

在文件 component_base.h72 行定义.

72 {
73 if (!config.config_file_path().empty()) {
74 if (!common::GetFilePathWithEnv(config.config_file_path(),
75 "APOLLO_CONF_PATH", &config_file_path_)) {
76 AERROR << "conf file [" << config.config_file_path() << "] not found!";
77 config_file_path_ = config.config_file_path();
78 } else {
79 AINFO << "use config file: " << config_file_path_;
80 }
81 }
82
83 if (!config.flag_file_path().empty()) {
84 std::string flag_file_path = config.flag_file_path();
85 if (!common::GetFilePathWithEnv(config.flag_file_path(),
86 "APOLLO_FLAG_PATH", &flag_file_path)) {
87 AERROR << "flag file [" << config.flag_file_path() << "] not found!";
88 } else {
89 AINFO << "use flag file: " << flag_file_path;
90 }
91 google::SetCommandLineOption("flagfile", flag_file_path.c_str());
92 }
93 }
#define AERROR
Definition log.h:44
#define AINFO
Definition log.h:42
bool GetFilePathWithEnv(const std::string &path, const std::string &env_var, std::string *file_path)
get file path, judgement priority:
Definition file.cc:436

◆ LoadConfigFiles() [2/2]

void apollo::cyber::ComponentBase::LoadConfigFiles ( const TimerComponentConfig config)
inlineprotected

在文件 component_base.h95 行定义.

95 {
96 if (!config.config_file_path().empty()) {
97 if (!common::GetFilePathWithEnv(config.config_file_path(),
98 "APOLLO_CONF_PATH", &config_file_path_)) {
99 AERROR << "conf file [" << config.config_file_path() << "] not found!";
100 config_file_path_ = config.config_file_path();
101 } else {
102 AINFO << "use config file: " << config_file_path_;
103 }
104 }
105
106 if (!config.flag_file_path().empty()) {
107 std::string flag_file_path = config.flag_file_path();
108 if (!common::GetFilePathWithEnv(config.flag_file_path(),
109 "APOLLO_FLAG_PATH", &flag_file_path)) {
110 AERROR << "flag file [" << config.flag_file_path() << "] not found!";
111 } else {
112 AINFO << "use flag file: " << flag_file_path;
113 }
114 google::SetCommandLineOption("flagfile", flag_file_path.c_str());
115 }
116 }

◆ Shutdown()

virtual void apollo::cyber::ComponentBase::Shutdown ( )
inlinevirtual

在文件 component_base.h50 行定义.

50 {
51 if (is_shutdown_.exchange(true)) {
52 return;
53 }
54
55 Clear();
56 for (auto& reader : readers_) {
57 reader->Shutdown();
58 }
60 }
std::vector< std::shared_ptr< ReaderBase > > readers_
std::atomic< bool > is_shutdown_
std::shared_ptr< Node > node_
virtual bool RemoveTask(const std::string &name)=0

类成员变量说明

◆ config_file_path_

std::string apollo::cyber::ComponentBase::config_file_path_ = ""
protected

在文件 component_base.h120 行定义.

◆ is_shutdown_

std::atomic<bool> apollo::cyber::ComponentBase::is_shutdown_ = {false}
protected

在文件 component_base.h118 行定义.

118{false};

◆ node_

std::shared_ptr<Node> apollo::cyber::ComponentBase::node_ = nullptr
protected

在文件 component_base.h119 行定义.

◆ readers_

std::vector<std::shared_ptr<ReaderBase> > apollo::cyber::ComponentBase::readers_
protected

在文件 component_base.h121 行定义.


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