Apollo 11.0
自动驾驶开放平台
convert.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
19namespace apollo {
20namespace drivers {
21namespace lslidar {
22namespace parser {
23
26
27void Convert::init(const Config& lslidar_config) {
28 config_ = lslidar_config;
29 // we use Beijing time by default
30
31 AERROR << "Convert::init";
32 parser_.reset(LslidarParserFactory::CreateParser(config_));
33 if (parser_.get() == nullptr) {
34 AFATAL << "Create parser failed.";
35 return;
36 }
37 parser_->setup();
38}
39
42 const std::shared_ptr<apollo::drivers::lslidar::LslidarScan>& scan_msg,
43 std::shared_ptr<apollo::drivers::PointCloud> point_cloud) {
44 AINFO_EVERY(100) << "Converting scan msg seq "
45 << scan_msg->header().sequence_num();
46
47 parser_->GeneratePointcloud(scan_msg, point_cloud);
48
49 if (point_cloud == nullptr || point_cloud->point().empty()) {
50 AERROR << "point cloud has no point";
51 return;
52 }
53
54 parser_->Order(point_cloud);
55 point_cloud->set_is_dense(false);
56}
57
58} // namespace parser
59} // namespace lslidar
60} // namespace drivers
61} // namespace apollo
void ConvertPacketsToPointcloud(const std::shared_ptr< apollo::drivers::lslidar::LslidarScan > &scan_msg, std::shared_ptr< apollo::drivers::PointCloud > point_cloud_out)
Callback for raw scan messages.
Definition convert.cc:41
void init(const Config &lslidar_config)
Definition convert.cc:27
static LslidarParser * CreateParser(Config config)
#define AINFO_EVERY(freq)
Definition log.h:82
#define AERROR
Definition log.h:44
#define AFATAL
Definition log.h:45
class register implement
Definition arena_queue.h:37