main
feixyz10 2020-10-29 21:12:43 +08:00 committed by feixyz
parent 9663294c81
commit 5e2a26e1ab
4 changed files with 27 additions and 27 deletions

View File

@ -30,8 +30,8 @@ include_directories(SYSTEM
${G3LOG_INCLUDE_DIRS} ${G3LOG_INCLUDE_DIRS}
) )
# link_directories(${PCL_LIBRARY_DIRS}) link_directories(${PCL_LIBRARY_DIRS})
# add_definitions(${PCL_DEFINITIONS}) add_definitions(${PCL_DEFINITIONS})
include_directories( include_directories(
src src
@ -51,15 +51,15 @@ add_executable(main main.cc)
target_link_libraries(main target_link_libraries(main
${catkin_LIBRARIES} ${catkin_LIBRARIES}
${PCL_LIBRARIES} ${PCL_LIBRARIES}
${CERES_LIBRARIES}
${G3LOG_LIBRARIES} ${G3LOG_LIBRARIES}
${YAML_CPP_LIBRARIES} ${YAML_CPP_LIBRARIES}
g3log g3log
common common
oh_my_loam
extractor extractor
visualizer visualizer
helper
solver
odometry odometry
oh_my_loam solver
${CERES_LIBRARIES}
helper
) )

View File

@ -19,3 +19,4 @@ extractor_config:
odometry_config: odometry_config:
icp_iter_num : 2 icp_iter_num : 2
dist_sq_thresh: 100

View File

@ -5,7 +5,6 @@ namespace oh_my_loam {
namespace { namespace {
int kNearbyScanNum = 2; int kNearbyScanNum = 2;
double kDistSquareThresh = 25;
size_t kMinMatchNum = 10; size_t kMinMatchNum = 10;
} // namespace } // namespace
@ -23,15 +22,17 @@ void Odometry::Process(const FeaturePoints& feature, Pose3D* const pose) {
*pose = pose_curr2world_; *pose = pose_curr2world_;
return; return;
} }
double match_dist_sq_thresh = config_["match_dist_sq_thresh"].as<double>();
for (int i = 0; i < config_["icp_iter_num"].as<int>(); ++i) { for (int i = 0; i < config_["icp_iter_num"].as<int>(); ++i) {
std::vector<PointLinePair> pl_pairs; std::vector<PointLinePair> pl_pairs;
std::vector<PointPlanePair> pp_pairs; std::vector<PointPlanePair> pp_pairs;
AssociateCornPoints(*feature.sharp_corner_pts, *corn_pts_pre_, &pl_pairs, MatchCornPoints(*feature.sharp_corner_pts, *corn_pts_pre_, &pl_pairs,
kDistSquareThresh); match_dist_sq_thresh);
AssociateSurfPoints(*feature.flat_surf_pts, *surf_pts_pre_, &pp_pairs, MatchSurfPoints(*feature.flat_surf_pts, *surf_pts_pre_, &pp_pairs,
kDistSquareThresh); match_dist_sq_thresh);
if (pl_pairs.size() + pp_pairs.size() < kMinMatchNum) { if (pl_pairs.size() + pp_pairs.size() < kMinMatchNum) {
AWARN << "Too less correspondence"; AWARN << "Too less correspondence: num = "
<< pl_pairs.size() + pp_pairs.size();
} }
double* q = pose_curr2last_.q().coeffs().data(); double* q = pose_curr2last_.q().coeffs().data();
double* p = pose_curr2last_.p().data(); double* p = pose_curr2last_.p().data();
@ -50,8 +51,7 @@ void Odometry::Process(const FeaturePoints& feature, Pose3D* const pose) {
UpdatePre(feature); UpdatePre(feature);
} }
void Odometry::AssociateCornPoints(const TPointCloud& src, void Odometry::MatchCornPoints(const TPointCloud& src, const TPointCloud& tgt,
const TPointCloud& tgt,
std::vector<PointLinePair>* const pairs, std::vector<PointLinePair>* const pairs,
double dist_thresh) const { double dist_thresh) const {
kdtree_corn_pts_->setInputCloud(tgt.makeShared()); kdtree_corn_pts_->setInputCloud(tgt.makeShared());
@ -93,8 +93,7 @@ void Odometry::AssociateCornPoints(const TPointCloud& src,
} }
} }
void Odometry::AssociateSurfPoints(const TPointCloud& src, void Odometry::MatchSurfPoints(const TPointCloud& src, const TPointCloud& tgt,
const TPointCloud& tgt,
std::vector<PointPlanePair>* const pairs, std::vector<PointPlanePair>* const pairs,
double dist_thresh) const { double dist_thresh) const {
kdtree_surf_pts_->setInputCloud(tgt.makeShared()); kdtree_surf_pts_->setInputCloud(tgt.makeShared());

View File

@ -18,11 +18,11 @@ class Odometry {
protected: protected:
void UpdatePre(const FeaturePoints& feature); void UpdatePre(const FeaturePoints& feature);
void AssociateCornPoints(const TPointCloud& src, const TPointCloud& tgt, void MatchCornPoints(const TPointCloud& src, const TPointCloud& tgt,
std::vector<PointLinePair>* const pairs, std::vector<PointLinePair>* const pairs,
double dist_thresh) const; double dist_thresh) const;
void AssociateSurfPoints(const TPointCloud& src, const TPointCloud& tgt, void MatchSurfPoints(const TPointCloud& src, const TPointCloud& tgt,
std::vector<PointPlanePair>* const pairs, std::vector<PointPlanePair>* const pairs,
double dist_thresh) const; double dist_thresh) const;