ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Unable to move turtlebot or create map when using custom world in Gazebo.

asked 2019-07-01 11:17:54 -0500

MalarJN gravatar image

updated 2019-07-25 13:17:48 -0500

jayess gravatar image


I am new to using ROS (and Ubuntu) and am reaching out as I've hit a snag. I am trying to use the rtabmap_ros tutorial for mapping and navigation using turtlebot (the simulation portion) and am able to successfully create a map when using:

$roslaunch turtlebot_gazebo turtlebot_world.launch

$ roslaunch rtabmap_ros demo_turtlebot_mapping.launch simulation:=true

$ roslaunch rtabmap_ros demo_turtlebot_rviz.launch

However, when trying the same with a custom world that I've created, the world launches in Gazebo but

roslaunch rtabmap_ros demo_turtlebot_mapping.launch simulation:=true g

throws the following error:

Could not get transform from odom to base_footprint after 0.200000 seconds (for stamp=1466.802000)! Error="Could not find a connection between 'odom' and 'base_footprint' because they are not part of the same tree.Tf has two or more unconnected trees.. canTransform returned after 0.2 timeout was 0.2.

I used

rosrun tf view_frames

and see that odom is not connected to base_footprint. I am not sure how to rectify this.

I am essentially trying to simulate a turtlebot and make it autonomously (without having to use any manual intervention) move around an unknown location and create a map (SLAM) using Gazebo. If there are existing packages or codes that could help me with this please point me in the right direction. I use ROS Kinetic and Ubuntu 16.04 LTS.

Best regards, Malar.

edit retag flag offensive close merge delete


You forgot to include your error message, can you add it now?

kurshakuz gravatar image kurshakuz  ( 2019-07-01 11:33:52 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-07-10 20:06:30 -0500

MalarJN gravatar image

updated 2019-07-25 12:18:28 -0500


So, I tried this with a different custom world and it worked. The issue seems to occur when you add a standing person when creating the world in Gazebo. Also, as @matlabbe suggested here, I used frontier_exploration to make the process autonomous. Giving the setup more time to execute builds a map of the Gazebo world. Thank you @matlabbe for all your help. Best regards, Malar.

edit flag offensive delete link more

answered 2019-07-03 12:59:25 -0500

matlabbe gravatar image


The problem is that TF odom -> base_footprint is not published by the robot, normally it should! I had the same problem on my computer. Here is what I did to solve the problem:

1) Make sure you have latest packages (it is recommended to clean/rebuild your catkin_ws afterwards):

$ sudo apt-get upgrade
$ rm -rf ~/catkin_ws/build/*
$ cd ~/catkin_ws
$ catkin_make

2) Make sure you installed ros-kinetic-kobuki-desktop (if you have environment variable TURTLEBOT_BASE=kobuki) so that is available (used here), otherwise odometry won't be published.

$ sudo apt-get install ros-kinetic-kobuki-desktop

3) If you installed gazebo8 or gazebo9 on Kinetic, you have to rebuild ros-kinetic-kobuki-desktop from source (well the command 2 will fail because of incompatible gazebo versions)

4) When launching turtlebot_world.launch alone, you should have already /odom topic published:

$ roslaunch turtlebot_gazebo turtlebot_world.launch

$ rostopic hz /odom
subscribed to [/odom]
WARNING: may be using simulated time
average rate: 100.000
    min: 0.010s max: 0.010s std dev: 0.00000s window: 97
average rate: 100.000
    min: 0.010s max: 0.010s std dev: 0.00000s window: 197
average rate: 100.000
    min: 0.000s max: 0.050s std dev: 0.00944s window: 295


edit flag offensive delete link more


Thank you for helping me out Mathieu. However, I get the following error when running 'catkin_make': /home/malar/catkin_ws/src/navigation_2d/nav2d_operator/src/RobotOperator.cpp:11:66: error: no matching function for call to ‘costmap_2d::Costmap2DROS::Costmap2DROS(const char [10], tf2_ros::Buffer&)’ mLocalMap = new costmap_2d::Costmap2DROS("local_map", mTf2Buffer); ^ In file included from /home/malar/catkin_ws/src/navigation_2d/nav2d_operator/include/nav2d_operator/RobotOperator.h:12:0, from /home/malar/catkin_ws/src/navigation_2d/nav2d_operator/src/RobotOperator.cpp:4: /opt/ros/kinetic/include/costmap_2d/costmap_2d_ros.h:80:3: note: candidate: costmap_2d::Costmap2DROS::Costmap2DROS(std::__cxx11::string, tf::TransformListener&) Costmap2DROS(std::string name, tf::TransformListener& tf); ^ /opt/ros/kinetic/include/costmap_2d/costmap_2d_ros.h:80:3: note: no known conversion for argument 2 from ‘tf

MalarJN gravatar image MalarJN  ( 2019-07-06 09:36:17 -0500 )edit

2_ros::Buffer’ to ‘tf::TransformListener&’ /opt/ros/kinetic/include/costmap_2d/costmap_2d_ros.h:72:7: note: candidate: costmap_2d::Costmap2DROS::Costmap2DROS(costmap_2d::Costmap2DROS&) class Costmap2DROS ^ /opt/ros/kinetic/include/costmap_2d/costmap_2d_ros.h:72:7: note: candidate expects 1 argument, 2 provided navigation_2d/nav2d_operator/CMakeFiles/RobotOperator.dir/build.make:62: recipe for target 'navigation_2d/nav2d_operator/CMakeFiles/RobotOperator.dir/src/RobotOperator.cpp.o' failed make[2]: * [navigation_2d/nav2d_operator/CMakeFiles/RobotOperator.dir/src/RobotOperator.cpp.o] Error 1 CMakeFiles/Makefile2:3158: recipe for target 'navigation_2d/nav2d_operator/CMakeFiles/RobotOperator.dir/all' failed make[1]: [navigation_2d/nav2d_operator/CMakeFiles/RobotOperator.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: ** [all] Error 2 Invoking "make -j1 -l1" failed

MalarJN gravatar image MalarJN  ( 2019-07-06 09:36:57 -0500 )edit

Looks like more a navigation_2dbuild problem. They have binaries:, you may try them instead of recompiling it.

matlabbe gravatar image matlabbe  ( 2019-07-08 09:41:28 -0500 )edit

Hi Matlabbe, I get multiple errors like the one below: Err:1 xenial/main amd64 ros-kinetic-nav2d-msgs amd64 0.3.2-0xenial-20190320-174220-0800 404 Not Found [IP: 80] E: Failed to fetch 404 Not Found [IP: 80] E: Unable to fetch some archives, try running apt-get update or apt-get --fix-missing.

MalarJN gravatar image MalarJN  ( 2019-07-08 16:26:18 -0500 )edit

I tried both sudo apt-get update and sudo apt update. Both failed with: W: Signature by key 630239CC130E1A7FD81A27B140976EAF437D05B5 uses weak digest algorithm (SHA1) W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 W: Failed to fetch The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 W: Some index files failed to download. They have been ignored, or old ones used instead.

sudo apt-get upgrade seems to have worked though. But installing nav2d package still fails.

MalarJN gravatar image MalarJN  ( 2019-07-08 16:27:49 -0500 )edit
matlabbe gravatar image matlabbe  ( 2019-07-08 22:11:08 -0500 )edit

Thank you Matlabbe. That worked. I was able to follow nav2d and install the nav2d package and launch the tutorial. However, the catkin_make process still fails with the same error and I tried this suggestion. find_package fails with the following error:

bash: syntax error near unexpected token `catkin'

MalarJN gravatar image MalarJN  ( 2019-07-09 15:27:37 -0500 )edit

Question Tools


Asked: 2019-07-01 11:17:54 -0500

Seen: 703 times

Last updated: Jul 25 '19