odom_estimation.hpp
Go to the documentation of this file.
1 
3 
4 // Original Author of FLOAM: Wang Han
5 // Email wh200720041@gmail.com
6 // Homepage https://wanghan.pro
7 
8 #ifndef FLOAM__ODOM_ESTIMATION_HPP_
9 #define FLOAM__ODOM_ESTIMATION_HPP_
10 
11 //std lib
12 #include <string>
13 #include <math.h>
14 #include <vector>
15 
16 //PCL
17 #include <pcl/point_cloud.h>
18 #include <pcl/point_types.h>
19 #include <pcl/filters/filter.h>
20 #include <pcl/filters/voxel_grid.h>
21 #include <pcl/filters/passthrough.h>
22 #include <pcl/kdtree/kdtree_flann.h>
23 #include <pcl/filters/statistical_outlier_removal.h>
24 #include <pcl/filters/extract_indices.h>
25 #include <pcl/filters/crop_box.h>
26 
27 //ceres
28 #include <ceres/ceres.h>
29 #include <ceres/rotation.h>
30 
31 //eigen
32 #include <Eigen/Dense>
33 #include <Eigen/Geometry>
34 
35 //LOCAL LIB
37 #include "floam/lidar_utils.hpp"
38 
39 namespace floam
40 {
41 namespace odom
42 {
43 
49 {
50 public:
54 
55  void init(const double & mapResolution);
56  void initMapWithPoints(const pcl::PointCloud<pcl::PointXYZ>::Ptr & edges, const pcl::PointCloud<pcl::PointXYZ>::Ptr & surfaces);
57  void updatePointsToMap(const pcl::PointCloud<pcl::PointXYZ>::Ptr & edges, const pcl::PointCloud<pcl::PointXYZ>::Ptr & surfaces);
58  void getMap(pcl::PointCloud<pcl::PointXYZ>::Ptr & lidarCloudMap);
59 
61  Eigen::Isometry3d m_odom, m_lastOdom;
62 
64  double m_parameters[7] = {0, 0, 0, 1, 0, 0, 0};
65 
66  Eigen::Map<Eigen::Quaterniond> m_currentRotation = Eigen::Map<Eigen::Quaterniond>(m_parameters);
67  Eigen::Map<Eigen::Vector3d> m_currentTranslation = Eigen::Map<Eigen::Vector3d>(m_parameters + 4);
68 
70  pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr m_kdTreeEdgeMap;
71  pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr m_kdTreeSurfMap;
72 
74  pcl::PointCloud<pcl::PointXYZ>::Ptr m_lidarCloudCornerMap;
75  pcl::PointCloud<pcl::PointXYZ>::Ptr m_lidarCloudSurfMap;
76 
78  pcl::VoxelGrid<pcl::PointXYZ> m_downSizeFilterEdge;
79  pcl::VoxelGrid<pcl::PointXYZ> m_downSizeFilterSurf;
80 
82  pcl::CropBox<pcl::PointXYZ> m_cropBoxFilter;
83 
86 
89 
91  void addEdgeCostFactor(
92  const pcl::PointCloud<pcl::PointXYZ>::Ptr & points,
93  const pcl::PointCloud<pcl::PointXYZ>::Ptr & map,
94  ceres::Problem & problem,
95  ceres::LossFunction * lossFunction);
96 
97  void addSurfCostFactor(
98  const pcl::PointCloud<pcl::PointXYZ>::Ptr & points,
99  const pcl::PointCloud<pcl::PointXYZ>::Ptr & map,
100  ceres::Problem & problem,
101  ceres::LossFunction * lossFunction);
102 
103  // TODO(flynneva): are these even used? I think these were moved to the mapping class
104  void addPointsToMap(
105  const pcl::PointCloud<pcl::PointXYZ>::Ptr & downsampledEdgeCloud,
106  const pcl::PointCloud<pcl::PointXYZ>::Ptr & downsampledSurfCloud);
107 
108  // TODO(flynneva): are these even used? I think these were moved to the mapping class
109  void pointAssociateToMap(
110  const std::shared_ptr<pcl::PointXYZ> & pointsIn,
111  std::shared_ptr<pcl::PointXYZ> & pointsOut);
112 
113  // TODO(flynneva): are these even used? I think these were moved to the mapping class
114  void downSamplingToMap(
115  const pcl::PointCloud<pcl::PointXYZ>::Ptr & edgesIn,
116  pcl::PointCloud<pcl::PointXYZ>::Ptr & edgesOut,
117  const pcl::PointCloud<pcl::PointXYZ>::Ptr & surfacesIn,
118  pcl::PointCloud<pcl::PointXYZ>::Ptr & surfacesOut);
119 };
120 } // namespace odom
121 } // namespace floam
122 
123 #endif // FLOAM__ODOM_ESTIMATION_HPP_
124 
void pointAssociateToMap(const std::shared_ptr< pcl::PointXYZ > &pointsIn, std::shared_ptr< pcl::PointXYZ > &pointsOut)
void addSurfCostFactor(const pcl::PointCloud< pcl::PointXYZ >::Ptr &points, const pcl::PointCloud< pcl::PointXYZ >::Ptr &map, ceres::Problem &problem, ceres::LossFunction *lossFunction)
void addPointsToMap(const pcl::PointCloud< pcl::PointXYZ >::Ptr &downsampledEdgeCloud, const pcl::PointCloud< pcl::PointXYZ >::Ptr &downsampledSurfCloud)
void addEdgeCostFactor(const pcl::PointCloud< pcl::PointXYZ >::Ptr &points, const pcl::PointCloud< pcl::PointXYZ >::Ptr &map, ceres::Problem &problem, ceres::LossFunction *lossFunction)
function
double m_parameters[7]
Optimization parameters that ceres solvers update each loop.
void init(const double &mapResolution)
Eigen::Map< Eigen::Quaterniond > m_currentRotation
OdomEstimation()
constructor / destructor
pcl::VoxelGrid< pcl::PointXYZ > m_downSizeFilterSurf
void updatePointsToMap(const pcl::PointCloud< pcl::PointXYZ >::Ptr &edges, const pcl::PointCloud< pcl::PointXYZ >::Ptr &surfaces)
void initMapWithPoints(const pcl::PointCloud< pcl::PointXYZ >::Ptr &edges, const pcl::PointCloud< pcl::PointXYZ >::Ptr &surfaces)
pcl::PointCloud< pcl::PointXYZ >::Ptr m_lidarCloudCornerMap
corner and surface map objects
Eigen::Isometry3d m_odom
Odometry.
int m_optimizationCount
optimization count
pcl::KdTreeFLANN< pcl::PointXYZ >::Ptr m_kdTreeSurfMap
pcl::KdTreeFLANN< pcl::PointXYZ >::Ptr m_kdTreeEdgeMap
kd-tree
floam::lidar::Total m_totals
totals counters (frames, time)
pcl::CropBox< pcl::PointXYZ > m_cropBoxFilter
local map
pcl::VoxelGrid< pcl::PointXYZ > m_downSizeFilterEdge
points downsampling before add to map
pcl::PointCloud< pcl::PointXYZ >::Ptr m_lidarCloudSurfMap
Major rewrite Author: Evan Flynn.
Definition: lidar.hpp:15
void downSamplingToMap(const pcl::PointCloud< pcl::PointXYZ >::Ptr &edgesIn, pcl::PointCloud< pcl::PointXYZ >::Ptr &edgesOut, const pcl::PointCloud< pcl::PointXYZ >::Ptr &surfacesIn, pcl::PointCloud< pcl::PointXYZ >::Ptr &surfacesOut)
Eigen::Map< Eigen::Vector3d > m_currentTranslation
void getMap(pcl::PointCloud< pcl::PointXYZ >::Ptr &lidarCloudMap)


floam
Author(s): Han Wang
autogenerated on Mon Feb 28 2022 22:25:11