RobustFieldAutonomyLab / LeGO-LOAM

LeGO-LOAM: Lightweight and Ground-Optimized Lidar Odometry and Mapping on Variable Terrain
BSD 3-Clause "New" or "Revised" License
2.35k stars 1.11k forks source link

Problem about gtsam update & resize in mapOptimization.cpp #145

Closed heroacool closed 4 years ago

heroacool commented 4 years ago

image

Hi @TixiaoShan , when reading the mapOptimization.cpp, I am confusion with the gtsam update operation. What's the purpose of isam->update(), and why need to gtSAMgraph.resize(0) ?

It seems to reset the pose graph instance. If so, it may not take the most advantage of gtsam.

I try to comment these 3 lines, it will lead to error "key already exists".

image

So could you please explain the operation? Great appreciation to your response.

TixiaoShan commented 4 years ago

Hi @heroacool I think that's the way to use isam2 in GTSAM, it clears the values for next optimization. One example can be found here. https://github.com/devbharat/gtsam/blob/master/examples/VisualISAM2Example.cpp

heroacool commented 4 years ago

Hi @heroacool I think that's the way to use isam2 in GTSAM, it clears the values for next optimization. One example can be found here. https://github.com/devbharat/gtsam/blob/master/examples/VisualISAM2Example.cpp

Got it. Thanks !