Apollo 11.0
自动驾驶开放平台
apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType > 模板类 参考abstract

#include <lidar_component_base_impl.h>

类 apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType > 继承关系图:
apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType > 的协作图:

Public 成员函数

virtual ~LidarComponentBaseImpl ()=default
 
bool Init () override=0
 
virtual bool InitBase (const LidarConfigBase &lidar_config_base)=0
 
virtual void ReadScanCallback (const std::shared_ptr< ScanType > &scan_message)=0
 
std::shared_ptr< ScanType > AcquireScanMessage ()
 
- Public 成员函数 继承自 apollo::cyber::Component< M0, M1, M2, M3 >
 Component ()
 
 ~Component () override
 
bool Initialize (const ComponentConfig &config) override
 init the component by protobuf object.
 
bool Process (const std::shared_ptr< M0 > &msg0, const std::shared_ptr< M1 > &msg1, const std::shared_ptr< M2 > &msg2, const std::shared_ptr< M3 > &msg3)
 
- Public 成员函数 继承自 apollo::cyber::ComponentBase
virtual ~ComponentBase ()
 
virtual bool Initialize (const TimerComponentConfig &config)
 
virtual void Shutdown ()
 
template<typename T >
bool GetProtoConfig (T *config) const
 

Protected 成员函数

bool InitConverter (const LidarConfigBase &lidar_config_base)
 
bool InitPacket (const LidarConfigBase &lidar_config_base)
 
virtual bool WriteScan (const std::shared_ptr< ScanType > &scan_message)
 
virtual std::shared_ptr< PointCloud > AllocatePointCloud ()
 
virtual bool WritePointCloud (const std::shared_ptr< PointCloud > &point_cloud)
 
virtual std::shared_ptr< apollo::cyber::base::ArenaQueue< PointXYZIT > > GetPointQueue ()
 
- Protected 成员函数 继承自 apollo::cyber::ComponentBase
virtual void Clear ()
 
const std::string & ConfigFilePath () const
 
void LoadConfigFiles (const ComponentConfig &config)
 
void LoadConfigFiles (const TimerComponentConfig &config)
 

静态 Protected 成员函数

static void PcdDefaultCleaner (std::shared_ptr< PointCloud > &unused_pcd_frame)
 

Protected 属性

std::string frame_id_
 
bool write_scan_
 
uint32_t default_reserved_points_num_
 
- Protected 属性 继承自 apollo::cyber::ComponentBase
std::atomic< bool > is_shutdown_ = {false}
 
std::shared_ptr< Node > node_ = nullptr
 
std::string config_file_path_ = ""
 
std::vector< std::shared_ptr< ReaderBase > > readers_
 

额外继承的成员函数

- Public 类型 继承自 apollo::cyber::ComponentBase
template<typename M >
using Reader = cyber::Reader< M >
 

详细描述

template<typename ScanType, typename ComponentType = apollo::cyber::NullType>
class apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >

在文件 lidar_component_base_impl.h 第 35 行定义.

构造及析构函数说明

◆ ~LidarComponentBaseImpl()

template<typename ScanType , typename ComponentType = apollo::cyber::NullType>
virtual apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::~LidarComponentBaseImpl ( )
virtualdefault

成员函数说明

◆ AcquireScanMessage()

template<typename ScanType , typename ComponentType >
std::shared_ptr< ScanType > apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::AcquireScanMessage ( )

在文件 lidar_component_base_impl.h 第 123 行定义.

123 {
124 if (scan_writer_ == nullptr) {
125 return std::make_shared<ScanType>();
126 }
127 return scan_writer_->AcquireMessage();
128}

◆ AllocatePointCloud()

template<typename ScanType , typename ComponentType >
std::shared_ptr< PointCloud > apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::AllocatePointCloud ( )
protectedvirtual

◆ GetPointQueue()

template<typename ScanType , typename ComponentType >
std::shared_ptr< apollo::cyber::base::ArenaQueue< PointXYZIT > > apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::GetPointQueue ( )
protectedvirtual

在文件 lidar_component_base_impl.h 第 141 行定义.

141 {
142 std::shared_ptr<apollo::cyber::base::ArenaQueue<PointXYZIT>> ret;
143 auto channel_id = pcd_writer_->GetChannelId();
144
145 auto arena_manager =
146 apollo::cyber::transport::ProtobufArenaManager::Instance();
147 if (!arena_manager->Enable()) {
148 ADEBUG << "arena manager enable failed.";
149 } else {
151 arena_manager->RegisterQueue<apollo::drivers::PointXYZIT>(channel_id,
152 170000);
153 ret = std::shared_ptr<apollo::cyber::base::ArenaQueue<PointXYZIT>>(
154 reinterpret_cast<
156 arena_manager->GetAvailableBuffer(channel_id)),
158 }
159 return ret;
160}
#define ADEBUG
Definition log.h:41

◆ Init()

◆ InitBase()

◆ InitConverter()

template<typename ScanType , typename ComponentType >
bool apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::InitConverter ( const LidarConfigBase &  lidar_config_base)
protected

在文件 lidar_component_base_impl.h 第 78 行定义.

79 {
80 pcd_writer_ = this->node_->template CreateWriter<PointCloud>(
81 lidar_config_base.point_cloud_channel());
82 RETURN_VAL_IF(pcd_writer_ == nullptr, false);
83
84 if (lidar_config_base.source_type() ==
85 LidarConfigBase_SourceType_RAW_PACKET) {
86 scan_reader_ = this->node_->template CreateReader<ScanType>(
87 lidar_config_base.scan_channel(),
89 std::placeholders::_1));
90 RETURN_VAL_IF(scan_reader_ == nullptr, false);
91 }
92
93 frame_id_ = lidar_config_base.frame_id();
94 write_scan_ = lidar_config_base.write_scan();
96 lidar_config_base.default_reserved_points_num();
97
98 // pcd_buffer_ = std::make_shared<SyncBuffering<PointCloud>>(
99 // [this](){
100 // return LidarComponentBaseImpl::PcdDefaultAllocator(
101 // this->pcd_writer_);
102 // },
103 // LidarComponentBaseImpl::PcdDefaultCleaner);
104 // pcd_buffer_->SetBufferSize(lidar_config_base.buffer_size());
105 // pcd_buffer_->Init();
106 return true;
107}
std::shared_ptr< Node > node_
virtual void ReadScanCallback(const std::shared_ptr< ScanType > &scan_message)=0
#define RETURN_VAL_IF(condition, val)
Definition log.h:114

◆ InitPacket()

template<typename ScanType , typename ComponentType >
bool apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::InitPacket ( const LidarConfigBase &  lidar_config_base)
protected

在文件 lidar_component_base_impl.h 第 110 行定义.

111 {
112 if (lidar_config_base.source_type() ==
113 LidarConfigBase_SourceType_ONLINE_LIDAR) {
114 scan_writer_ = this->node_->template CreateWriter<ScanType>(
115 lidar_config_base.scan_channel());
116 RETURN_VAL_IF(scan_writer_ == nullptr, false);
117 }
118 return true;
119}

◆ PcdDefaultCleaner()

template<typename ScanType , typename ComponentType >
void apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::PcdDefaultCleaner ( std::shared_ptr< PointCloud > &  unused_pcd_frame)
staticprotected

在文件 lidar_component_base_impl.h 第 197 行定义.

198 {
199 unused_pcd_frame->clear_point();
200}

◆ ReadScanCallback()

template<typename ScanType , typename ComponentType = apollo::cyber::NullType>
virtual void apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::ReadScanCallback ( const std::shared_ptr< ScanType > &  scan_message)
pure virtual

◆ WritePointCloud()

template<typename ScanType , typename ComponentType >
bool apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::WritePointCloud ( const std::shared_ptr< PointCloud > &  point_cloud)
protectedvirtual

被 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< vanjee::VanjeeScanPacket > 重载.

在文件 lidar_component_base_impl.h 第 172 行定义.

173 {
174 point_cloud->mutable_header()->set_frame_id(frame_id_);
175 point_cloud->mutable_header()->set_sequence_num(
176 pcd_sequence_num_.fetch_add(1));
177 point_cloud->mutable_header()->set_timestamp_sec(
178 cyber::Time().Now().ToSecond());
179 RETURN_VAL_IF(!pcd_writer_->Write(point_cloud), false);
180 return true;
181}

◆ WriteScan()

template<typename ScanType , typename ComponentType >
bool apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::WriteScan ( const std::shared_ptr< ScanType > &  scan_message)
protectedvirtual

被 apollo::drivers::lidar::LidarComponentBase< ScanType > 重载.

在文件 lidar_component_base_impl.h 第 131 行定义.

132 {
133 if (write_scan_) {
134 return scan_writer_->Write(scan_message);
135 }
136 return true;
137}

类成员变量说明

◆ default_reserved_points_num_

template<typename ScanType , typename ComponentType = apollo::cyber::NullType>
uint32_t apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::default_reserved_points_num_
protected

在文件 lidar_component_base_impl.h 第 66 行定义.

◆ frame_id_

template<typename ScanType , typename ComponentType = apollo::cyber::NullType>
std::string apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::frame_id_
protected

在文件 lidar_component_base_impl.h 第 64 行定义.

◆ write_scan_

template<typename ScanType , typename ComponentType = apollo::cyber::NullType>
bool apollo::drivers::lidar::LidarComponentBaseImpl< ScanType, ComponentType >::write_scan_
protected

在文件 lidar_component_base_impl.h 第 65 行定义.


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