Apollo  6.0
Open source self driving car software
compensator.h
Go to the documentation of this file.
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 
17 #pragma once
18 
19 #include <memory>
20 #include <string>
21 
22 #include "Eigen/Eigen"
23 
24 // Eigen 3.3.7: #define ALIVE (0)
25 // fastrtps: enum ChangeKind_t { ALIVE, ... };
26 #if defined(ALIVE)
27 #undef ALIVE
28 #endif
29 
30 #include "modules/drivers/lidar/proto/velodyne_config.pb.h"
31 #include "modules/drivers/proto/pointcloud.pb.h"
32 
34 
35 namespace apollo {
36 namespace drivers {
37 namespace velodyne {
38 
40 
41 class Compensator {
42  public:
43  explicit Compensator(const CompensatorConfig& config) : config_(config) {}
44  virtual ~Compensator() {}
45 
46  bool MotionCompensation(const std::shared_ptr<const PointCloud>& msg,
47  std::shared_ptr<PointCloud> msg_compensated);
48 
49  private:
54  bool QueryPoseAffineFromTF2(const uint64_t& timestamp, void* pose,
55  const std::string& child_frame_id);
56 
60  void MotionCompensation(const std::shared_ptr<const PointCloud>& msg,
61  std::shared_ptr<PointCloud> msg_compensated,
62  const uint64_t timestamp_min,
63  const uint64_t timestamp_max,
64  const Eigen::Affine3d& pose_min_time,
65  const Eigen::Affine3d& pose_max_time);
69  inline void GetTimestampInterval(const std::shared_ptr<const PointCloud>& msg,
70  uint64_t* timestamp_min,
71  uint64_t* timestamp_max);
72 
73  bool IsValid(const Eigen::Vector3d& point);
74 
76  CompensatorConfig config_;
77 };
78 
79 } // namespace velodyne
80 } // namespace drivers
81 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool MotionCompensation(const std::shared_ptr< const PointCloud > &msg, std::shared_ptr< PointCloud > msg_compensated)
pcl::PointCloud< Point > PointCloud
Definition: types.h:64
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
Compensator(const CompensatorConfig &config)
Definition: compensator.h:43
Definition: buffer.h:33
Definition: compensator.h:41
virtual ~Compensator()
Definition: compensator.h:44
Eigen::Affine3d Affine3d
Definition: base_map_fwd.h:34