[ROS][feat] Click to get loop closure indices
Goal
Before, loop closure indices are provided by a csv file. It's difficult to know loop closure indices before a slam map is built. This MR aims to give a simple way to obtain loop indices for users:
- In rviz, click a point on the trajectory which is considered as the loop frame of the current frame.
- Play slam and stop the bag when a loop closure is observed.
- Click the position where forms a loop with current position
- the current pose and the closest pose to clicked point are added into LoopDetections
Changes
- Some refacts and fixes
- Add ClickedPointCallback function
Results
Reproduce
- demo 1: hesai_car.
- demo 2: acquisition_sido
Data
- data 1: car(hesai)
- data 2: Acquisition_SIDO/outdoor
Build
catkin_make -j --cmake-args -DCMAKE_BUILD_TYPE=Release -DENABLE_g2o=ON
Launch file
- Use `slam_velodyne.launch' but comment velodyne points conversion part.
- change "velodyne" to "hesai" in tf_base_to_velo_node
Parameters
- change the parameters:
- loop_closure.enable_offset: true
- n_threads: 4
- distance_threshold: 0.1
- leaf_size.edges: 0.1
- leaf_size.planes: 0.1
- decaying_threshold: 900
- min_frames_per_voxel: 0
- voxel_grid_resolution: 1.
- neighbors_radius: 0.05
- edge_depth_gap_threshold: 2.
- edge_nb_gap_points: 20
Run
rosrun lidar_conversions generic_conversion_node \
roslaunch lidar_slam slam_velodyne.launch \
rosbag play --clock path/to/bag /hesai/pandar:=/generic_points
What remains to solve
- Parse CSV, see MR !364 (merged)
- Bring features in ros2_wrapping
Checklist
-
Camel case everywhere except for ROS variables/parameters -
Lower case for local variables and lambda functions -
Upper case for pour members, methods and tool functions (in Utils) -
Precise namespace when calling a function (or this->X or classe.X) -
Align code (for multiline if and while, "&&" or "||" go in upper line to ensure alignement) -
Space between if, while, for and parenthesis -
Space between operators and variables: e.g. a + b -
Space after "," -
Mind your commit titles/desc (plurals, he/she + "s", correct tags, title should begin by a verb...) -
Function names should start with a verb, variable names should start with a name -
Macros should be between {} -
Do not use negative boolean (i.e. noJoe) -
Check minimal size of the types (double -> float -> int -> uint) -
Check const and ref in functions arguments -
References should be written "type& name", not "type &name" -
Update documentation if needed -
Add MR labels [ROS]/[ROS2]/[PV] -
If ros/ros2, update task table here -
Add a comment over each non trivial function in header files -
Adda header to each new file
Edited by Tong Fu