Apollo 11.0
自动驾驶开放平台
apollo::perception::lidar::GroundServiceDetector类 参考

#include <ground_service_detector.h>

类 apollo::perception::lidar::GroundServiceDetector 继承关系图:
apollo::perception::lidar::GroundServiceDetector 的协作图:

Public 成员函数

 GroundServiceDetector ()=default
 
 ~GroundServiceDetector ()=default
 
bool Init (const GroundDetectorInitOptions &options=GroundDetectorInitOptions()) override
 Init ground service detector
 
bool Detect (const GroundDetectorOptions &options, LidarFrame *frame) override
 Ground service detect
 
std::string Name () const override
 Get class name
 
- Public 成员函数 继承自 apollo::perception::lidar::BaseGroundDetector
 BaseGroundDetector ()=default
 
virtual ~BaseGroundDetector ()=default
 

详细描述

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

构造及析构函数说明

◆ GroundServiceDetector()

apollo::perception::lidar::GroundServiceDetector::GroundServiceDetector ( )
default

◆ ~GroundServiceDetector()

apollo::perception::lidar::GroundServiceDetector::~GroundServiceDetector ( )
default

成员函数说明

◆ Detect()

bool apollo::perception::lidar::GroundServiceDetector::Detect ( const GroundDetectorOptions &  options,
LidarFrame *  frame 
)
overridevirtual

Ground service detect

参数
options
frameloacation to save point height
返回
true
false

实现了 apollo::perception::lidar::BaseGroundDetector.

在文件 ground_service_detector.cc 第 45 行定义.

46 {
47 if (frame == nullptr || frame->world_cloud == nullptr) {
48 AERROR << "Frame is nullptr.";
49 return false;
50 }
51 ground_service_->GetServiceContentCopy(&ground_service_content_);
52 if (!ground_service_content_.IsServiceReady()) {
53 AERROR << "service is not ready.";
54 return false;
55 }
56 auto& cloud = frame->world_cloud;
57 auto& non_ground_indices = frame->non_ground_indices;
58 non_ground_indices.indices.clear();
59 non_ground_indices.indices.reserve(cloud->size());
60 for (size_t i = 0; i < cloud->size(); ++i) {
61 auto& pt = cloud->at(i);
62 Eigen::Vector3d world_point(pt.x, pt.y, pt.z);
63 float dist = ground_service_->QueryPointToGroundDistance(
64 world_point, ground_service_content_);
65 frame->cloud->mutable_points_height()->at(i) = dist;
66 frame->world_cloud->mutable_points_height()->at(i) = dist;
67 if (dist > ground_threshold_) {
68 non_ground_indices.indices.push_back(static_cast<int>(i));
69 } else {
70 frame->cloud->mutable_points_label()->at(i) =
71 static_cast<uint8_t>(LidarPointLabel::GROUND);
72 }
73 }
74 return true;
75}
#define AERROR
Definition log.h:44

◆ Init()

bool apollo::perception::lidar::GroundServiceDetector::Init ( const GroundDetectorInitOptions &  options = GroundDetectorInitOptions())
overridevirtual

Init ground service detector

参数
options
返回
true
false

实现了 apollo::perception::lidar::BaseGroundDetector.

在文件 ground_service_detector.cc 第 29 行定义.

29 {
30 std::string config_file =
31 GetConfigFile(options.config_path, options.config_file);
32 GroundServiceDetectorConfig config;
33 ACHECK(cyber::common::GetProtoFromFile(config_file, &config));
34 ground_threshold_ = config.ground_threshold();
35
36 ground_service_ = std::dynamic_pointer_cast<GroundService>(
37 SceneManager::Instance().Service("GroundService"));
38 if (ground_service_ == nullptr) {
39 AERROR << "Ground service is nullptr, Init scene manager first !";
40 return false;
41 }
42 return true;
43}
#define ACHECK(cond)
Definition log.h:80
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
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
Definition util.cc:80

◆ Name()

std::string apollo::perception::lidar::GroundServiceDetector::Name ( ) const
inlineoverridevirtual

Get class name

返回
std::string

实现了 apollo::perception::lidar::BaseGroundDetector.

在文件 ground_service_detector.h 第 56 行定义.

56{ return "GroundServiceDetector"; }

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