Re: How to disable visual odometry and use wheel odometry

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/How-to-disable-visual-odometry-and-use-wheel-odometry-tp4687p5243.html

Hi,

The launch file states:
<param if="$(arg visual_odometry)" name="subscribe_odom_info" type="bool" value="true"/>
<param if="$(arg icp_odometry)" name="subscribe_odom_info" type="bool" value="true"/>
By default subscribe_odom_info is false unless visual_odometry or icp_odometry is true. That way of setting the parameter can cause problem if rtabmap.launch is relaunched (without killing the roscore) with visual_odometry set to false. subscribe_odom_info will keep the last value if the roscore is not restarted between the launches.

By doing:
<param name="subscribe_odom_info" type="bool" value="$(arg visual_odometry)"/>
<param if="$(arg icp_odometry)" name="subscribe_odom_info" type="bool" value="true"/>
the parameter is always overwritten if we want to keep roscore alive between different launches. However, it breaks the logic if icp_odometry is set to true.

Here is a small example to reproduce the problem:
$ roscore
$ roslaunch rtabmap_ros rtabmap.launch args:="-d"
// here both rtabmap and rtabmapviz are subscribed to odom_info

// ctrl-c on rtabmap.launch terminal, then relaunch without visual odometry

$ roslaunch rtabmap_ros rtabmap.launch args:="-d" visual_odometry=false
// PROBLEM: rtabmap and rtabmapviz are still subscribed to odom_info

The solution with the current launch file is to kill roscore when we set visual_odometry or icp_odometry argument to false, to make sure all parameters are reinitialized.

For next release, I force now rtabmap and rtabmapviz nodes to delete ros parameters like "subscribe_odom_info" from rosparam server so that when we relaunch them (without killing roscore), the ros parameters are reinitialized.

cheers,
Mathieu