Rtabmap visual odometry getting lost too often using d435i
I need some help with tuning rtabmap parameters regarding visual odometry (or maybe its something else, I am not really sure at this point). My ultimate goal is to use grid_map produced by rtabmap for 2d navigation stack. And I stuck on problem that visual odometry getting lost too often. And if for mapping its not that big of a problem (after some more circle around space I generally can get somewhat accurate map), for localization process and for navigation it is really a problem, cause robot lost its location on map and cannot went to desired goal. I tried various solution regarding this issue (like setting "Odom/Strategy" to 1, setting 2d optimization options to true, set lower camera resolution and higher framerate). I also tried to use odometry from robot wheels, but its not reliable. I am currently using d435i camera (librealsense v2.43 compiled from source, linux kernel 5.4.0-58-generic, ros-realsense latest version also complied from source), rtabmap complied from source (cause for some reason it didn't worked initially on Ubuntu 20.04). Or maybe its just problem with my environment - its somewhat narrow office space with single straight hallway, so while moving robot I cannot really make a full circle for loop closure detection (but then, why odometry getting lost when I just slowly spinning around on place, that is totally not expected behavior for me).
robot_bare.launch (robot controls, sensors and transformations):
<launch>
<include file="$(find odrv_ros)/launch/ros_test.launch"/>
<node name="rplidarNode" pkg="rplidar_ros" type="rplidarNode" output="log">
<param name="serial_port" type="string" value="/dev/RPLIDAR"/>
<param name="serial_baudrate" type="int" value="256000"/>
<param name="frame_id" type="string" value="rplidar_laser"/>
<param name="inverted" type="bool" value="false"/>
<param name="angle_compensate" type="bool" value="false"/>
</node>
<node pkg="laser_filters" type="scan_to_scan_filter_chain" name="rplidar_laser_filter" output="log">
<rosparam command="load" file="$(find odrive_robot)/src/rplidar_laser_filter_params.yaml" />
<remap from="scan" to="rplidar_scan" />
<remap from="scan_filtered" to="rplidar_scan_filtered" />
</node>
<include file="$(find odrive_robot)/src/chip_robotics_imu.launch"/>
<node pkg="tf" type="static_transform_publisher" name="base_to_laser" args="0.1 0.0 0.0 3.14 0.0 3.14 base_link rplidar_laser 100" required="true" output="log"/>
<node pkg="tf" type="static_transform_publisher" name="base_to_imu" args="-0.25 0.0 0.0 0.0 3.14 0.0 base_link imu_link 100" required="true" output="log"/>
<node pkg="tf" type="static_transform_publisher" name="base_to_camera" args="0.0 0.0 0.0 0.0 0,0 0.0 base_link camera_link 100" required="true" output="log"/>
<node pkg="robot_localization" type="ekf_localization_node" name="ukf_odom" clear_params="true" output="log">
<rosparam command="load" file="$(find odrive_robot)/src/ekf_params.yaml" />
</node >
<include file="$(find realsense2_camera)/launch/rs_camera.launch">
<arg name="output" value="log"/>
<arg name="align_depth" value="true"/>
<arg name="linear_accel_cov" value="1.0"/>
<arg name="unite_imu_method" value="linear_interpolation"/>
<arg name="initial_reset" value="true"/>
<arg name="enable_pointcloud" value="true"/>
<arg name="enable_sync" value="false"/>
<arg name="enable_gyro" value="true"/>
<arg name="enable_accel" value="true"/>
<arg name="depth_width" default="640" />
<arg name="depth_height" default="480" />
<arg name="color_width" default="640" />
<arg name="color_height" default="480" />
<arg name="color_fps" value="60"/>
<arg name="depth_fps" value="60"/>
</include>
<node pkg="imu_filter_madgwick" type="imu_filter_node" name="ImuFilter">
<param name="use_mag" type="bool" value="false" />
<param name="use_magnetic_field_msg" value="false"/>
<param name="publish_tf" type="bool" value="false" />
<param name="world_frame" type="string" value="enu" />
<param name="fixed_frame" type="string" value="base_link" />
<remap from="/imu/data_raw" to="/camera/imu"/>
<remap from="/imu/data" to="/rtabmap/imu"/>
</node>
</launch>
Part of rtabmap.launch file (I modified it a bit, and yet didn't move change to main launch file, currently posting only changed part):
<node unless="$(arg stereo)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="$(arg output)" args="$(arg rtabmap_args) $(arg odom_args)" launch-prefix="$(arg launch_prefix)">
<remap from="rgb/image" to="$(arg rgb_topic_relay)"/>
<remap from="depth/image" to="$(arg depth_topic_relay)"/>
<remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
<remap from="rgbd_image" to="$(arg rgbd_topic_relay)"/>
<remap from="odom" to="$(arg odom_topic)"/>
<remap from="imu" to="$(arg imu_topic)"/>
<param name="Odom/ResetCountdown" value="1"/>
<param name="Rtabmap/StartNewMapOnLoopClosure" type="string" value="true"/>
<param name="Reg/Force3DoF" value="true"/>
<param name="Optimizer/Slam2D" value="true"/>
<param name="Odom/Strategy" value="1"/>
<param name="Odom/GuessMotion" value="true"/>
<param name="Vis/EstimationType" value="1"/>
<param name="Vis/CorType" value="1"/>
<param name="cloud_noise_filtering_radius" value="0.1"/>
<param name="cloud_noise_filtering_min_neighbors" value="50"/>
<param name="proj_min_cluster_size" value="10"/>
<param name="frame_id" type="string" value="$(arg frame_id)"/>
<param name="odom_frame_id" type="string" value="$(arg vo_frame_id)"/>
<param name="publish_tf" type="bool" value="$(arg publish_tf_odom)"/>
<param name="ground_truth_frame_id" type="string" value="$(arg ground_truth_frame_id)"/>
<param name="ground_truth_base_frame_id" type="string" value="$(arg ground_truth_base_frame_id)"/>
<param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
<param name="wait_imu_to_init" type="bool" value="$(arg wait_imu_to_init)"/>
<param name="approx_sync" type="bool" value="$(arg approx_sync)"/>
<param name="config_path" type="string" value="$(arg cfg)"/>
<param name="queue_size" type="int" value="$(arg queue_size)"/>
<param name="subscribe_rgbd" type="bool" value="$(arg subscribe_rgbd)"/>
<param name="guess_frame_id" type="string" value="$(arg odom_guess_frame_id)"/>
<param name="guess_min_translation" type="double" value="$(arg odom_guess_min_translation)"/>
<param name="guess_min_rotation" type="double" value="$(arg odom_guess_min_rotation)"/>
<param name="expected_update_rate" type="double" value="$(arg odom_expected_rate)"/>
<param name="max_update_rate" type="double" value="$(arg odom_max_rate)"/>
<param name="keep_color" type="bool" value="$(arg use_odom_features)"/>
</node>
main launch file:
<launch>
<arg name="db_name" default="/home/install/test_fst_floor.db"/>
<include file="$(find odrive_robot)/src/robot_bare.launch"/>
<include file="$(find odrive_robot)/src/rtabmap.launch">
<arg name="database_path" value="$(arg db_name)"/>
<arg name="args" value="--delete_db_on_start --Optimizer/GravitySigma 0.3 --Grid/RangeMax 5.0 --Grid/MinGroundHeight 0.05 --Grid/RayTracing true --Grid/MaxObstacleHeight 0.75
--Grid/NoiseFilteringMinNeighbors 20 --Grid/NoiseFilteringRadius 0.15 --Grid/FootprintLength 0.55
--Grid/FootprintWidth 0.6 --Grid/DepthRoiRatios '0.0 0.0 0.0 0.0' --RGBD/OptimizeFromGraphEnd true
--RGBD/LoopClosureReextractFeatures true --Vis/MinInliers 10 --Mem/ImagePostDecimation 2
--Odom/GuessMotion true"/>
<arg name="rgb_topic" value="/camera/color/image_raw"/>
<arg name="depth_topic" value="/camera/aligned_depth_to_color/image_raw"/>
<arg name="camera_info_topic" value="/camera/color/camera_info"/>
<arg name="depth_camera_info_topic" value="/camera/depth/camera_info"/>
<arg name="imu_topic" value="/rtabmap/imu"/>
<arg name="wait_imu_to_init" value="true"/>
<arg name="scan_topic" value="/rplidar_scan_filtered"/>
<arg name="scan_cloud_topic" value="/camera/depth/color/points"/>
<arg name="frame_id" value="base_link"/>
<arg name="approx_sync" value="false"/>
<arg name="rtabmapviz" value="false"/>
<arg name="rviz" value="false"/>
</include>
Asked by luckydemon on 2021-04-20 04:27:29 UTC
Answers
I'm having the same installation on PC ROS noetic. My last step is to lock rtabmap to the realsense witch is on my robot (Jetson nano - Ros melodic).
I can use the images, depthclouds and the topics of rtapmap come up in RVIZ. only when selecting them i loose the image. So i think this is a small step. i'll be sure to follow and get back to it when more experienced.
Asked by bartvanderhaagen on 2021-04-20 10:11:56 UTC
Comments
You can also try icp_odometry
with the rplidar, in particular with wheel odometry as guess.
For visual odometry, if you are using rtabmap prior to 0.20.9, add --GFTT/MinDistance 7 --Vis/CorGuessWinSize 40
parameters. For D435 camera, to get the best visual odometry, use the IR left and right images with stereo_odometry
instead of rgbd_odometry
. IR cameras have larger field of view and almost no motion blur, thus a lot more robut visual odometry. See stereo realsense example here: http://wiki.ros.org/rtabmap_ros/Tutorials/StereoHandHeldMapping
Asked by matlabbe on 2021-05-03 23:08:01 UTC
Comments