Apollo 10.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 velodyne {
22
25
26void Convert::init(const Config& velodyne_config) {
27 config_ = velodyne_config;
28 // we use Beijing time by default
29
30 parser_.reset(VelodyneParserFactory::CreateParser(config_));
31 if (parser_.get() == nullptr) {
32 AFATAL << "Create parser failed.";
33 return;
34 }
35 parser_->setup();
36}
37
40 const std::shared_ptr<VelodyneScan>& scan_msg,
41 std::shared_ptr<PointCloud> point_cloud) {
42 ADEBUG << "Convert scan msg seq " << scan_msg->header().sequence_num();
43
44 parser_->GeneratePointcloud(scan_msg, point_cloud);
45
46 if (point_cloud == nullptr || point_cloud->point().empty()) {
47 AERROR << "point cloud has no point";
48 return;
49 }
50
51 if (config_.organized()) {
52 parser_->Order(point_cloud);
53 point_cloud->set_is_dense(false);
54 } else {
55 point_cloud->set_is_dense(true);
56 }
57}
58
59} // namespace velodyne
60} // namespace drivers
61} // namespace apollo
void init(const Config &velodyne_config)
Definition convert.cc:26
void ConvertPacketsToPointcloud(const std::shared_ptr< VelodyneScan > &scan_msg, std::shared_ptr< PointCloud > point_cloud_out)
Callback for raw scan messages.
Definition convert.cc:39
static VelodyneParser * CreateParser(Config config)
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44
#define AFATAL
Definition log.h:45
class register implement
Definition arena_queue.h:37