How to test SLAM algorithms on a .bag file?
I have tried to execute different SLAM on .bag file, which I have already recorded
I have recorded bag file from simulation environment using the following commands:
roslaunch turtlebot3_gazebo navibot_world.launch
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
rosbag record -o ground /scan /tf /odom
I have used the Turtlebot3 GitHub repository from Robotis https://github.com/ROBOTIS-GIT/turtlebot3
You can download the bag file ground.bag)
After recording bag file I have tried to launch SLAM (gmapping, hector, karto, Cartographer) on this bag file to compare them using the following commands:
roscore
export TURTLEBOT3_MODEL=waffle
roslaunch turtlebot3_bringup turtlebot3_remote.launch
export TURTLEBOT3_MODEL=waffle
rosrun rviz rviz -d `rospack find turtlebot3_slam`/rviz/turtlebot3_slam.rviz
roscd turtlebot3_slam/bag
rosbag play ./ground.bag
roslaunch turtlebot3slam turlebot3slam
<launch>
<!-- Arguments -->
<arg name="model" default="waffle" doc="model type [burger, waffle, waffle_pi]"/>
<arg name="slam_methods" default="$(arg slam_methods)" doc="slam type [gmapping, cartographer, hector, karto, frontier_exploration]"/>
<arg name="configuration_basename" default="turtlebot3_lds_2d.lua"/>
<arg name="open_rviz" default="true"/>
<param name="use_sim_time" value="true"/>
<!-- TurtleBot3 -->
<include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
<arg name="model" value="$(arg model)" />
</include>
<!-- SLAM: Gmapping, Cartographer, Hector, Karto, Frontier_exploration, RTAB-Map -->
<include file="$(find turtlebot3_slam)/launch/turtlebot3_$(arg slam_methods).launch">
<arg name="model" value="$(arg model)"/>
<arg name="configuration_basename" value="$(arg configuration_basename)"/>
</include>
<!-- rviz -->
<group if="$(arg open_rviz)">
<node pkg="rviz" type="rviz" name="rviz" required="true"
args="-d $(find turtlebot3_slam)/rviz/turtlebot3_$(arg slam_methods).rviz"/>
</group>
</launch>
- Copy and Paste your error message on terminal
rosrun rviz rviz -d `rospack find turtlebot3_slam`/rviz/turtlebot3_slam.rviz
[ INFO] [1592939181.850658835]: rviz version 1.12.17
[ INFO] [1592939181.850723068]: compiled against Qt version 5.5.1
[ INFO] [1592939181.850731910]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1592939181.994656277]: Stereo is NOT SUPPORTED
[ INFO] [1592939181.994763535]: OpenGl version: 3 (GLSL 1.3).
Which TurtleBot3 you have?
- [x ] Waffle
Which ROS is working with TurtleBot3?
- [ x] ROS 1 Kinetic Kame
- Which SBC(Single Board Computer) is working on TurtleBot3?
- [ x] Raspberry Pi 3
- Which OS you installed in SBC?
- [x ] Ubuntu MATE 16.04 or later
- Which OS you installed in Remote PC?
- [ x] Ubuntu 16.04 LTS (Xenial Xerus)
I hope you can help me
Asked by dhaour9x on 2020-06-25 08:02:55 UTC
Answers
I replicated your setup and used the gmapping node for SLAM with your ground bag.
Not quite sure what your problem is, but one issue I can see is that to see the results of the SLAM algorithm running on your bag file in RVIZ, you need to add the map message in RVIZ (Add -> rviz/Map), and then select the /map topic. If you do this, you will see that gmapping (for example) is indeed generating a map from your bag file.
Another issue is the message timestamps on your bag are set to the beginning of UNIX time (Jan 1 1970). You can see the bag timestamps by running
rosbag info ground.bag
and looking at the "start" and "end" fields. This is why you cannot see the robot model in RVIZ even after including the "RobotModel" message, as ROS drops old TF messages. You can also see this in effect if you look at your TF frames with
rosrun tf view_frames
Apart from map->odom (provided by gmapping), all other transforms are 1593366155.891 seconds old.
This happens because the Raspberry Pi 3 updates its date and time according to a time server on the internet. If the Pi is not connected to the internet, then it cannot update its own time and thus defaults to the beginning of UNIX time. In that case, you need to set the date and time manually with the "date" command. Note that the "date" command does not persist over reboots (the Pi 3 does not have a battery backup for clock), so you have to do it every reboot.
I am not sure this is really a problem for you since the SLAM map is being generated regardless of the old transforms. Nevertheless, the easiest way to fix this would be to update the date and time on your raspberry and record the bag again. Another slightly less easy way to fix this is to use the ROSBAG API and update the timestamps manually.
Asked by renangm on 2020-06-28 13:04:47 UTC
Comments
Thank you @renangm How can I correct the timestamps? I'm trying to launch the .bag file in the same SLAM launch file, How can I do that in turtlebot3_slam launch file
Asked by dhaour9x on 2020-07-01 15:01:51 UTC
Comments