Robot won't spawn in gazebo
Hey, I try to launch different packages in gazebo and rviz, but always only the world loads in gazebo, but the robot won't spawn. I then did the nav 2 tutorial (turtlebot3) again, where you also spawn a robot, but the same problem here. Only the world loads, but no robot.
(tutorial: https://navigation.ros.org/getting_started/index.html)
I followed the nav2 tutorial step by step.
When I try to launch the robot via this command:
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
this occurs:
[component_container_isolated-6] [INFO] [1679503062.403570150] [local_costmap.local_costmap]: Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
When I try to launch the robot via this command:
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
this occurs:
[ERROR] [spawn_entity.py-4]: process has died [pid 62901, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -entity waffle -file /opt/ros/humble/share/turtlebot3_gazebo/models/turtlebot3_waffle/model.sdf -x -2.0 -y -0.5 -z 0.01 --ros-args'].
I think the problem lies in gazebo, this is why I deleted and reinstalled it with this command: gs
sudo apt install ros-humble-gazebo-ros-pkgs
Any idea what I did wrong, or what I might have forgotten to install?
Asked by vico on 2023-03-22 11:59:48 UTC
Answers
Hello @vico, this could be because of a missing transform, this link which has a similar problem might help - https://answers.ros.org/question/343800/nav2_planner-not-working/
Asked by Robo_guy on 2023-03-25 15:15:57 UTC
Comments
I could solve the problem. It was caused by the python version. I have Python 3.9(Anaconda) and Python 3.10(ROS) on my PC. Somehow there was a mismatch and ROS used Anaconda but needed a python 3.10 version. By creating a new environment with only Python 3.10 running, all worked fine. (I think updating python3 to 3.10 should solve the problem)
The terminal doesn't exactly explain this in its error message, it rather could say :
[spawn_entity.py-5] The C extension '/opt/ros/humble/lib/python3.10/site-packages/_rclpy_pybind11.cpython-39-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
The key word here is rclpy
which is then explained in the provide debug link :
https://docs.ros.org/en/humble/How-To-Guides/Installation-Troubleshooting.html
However, the link doesn't provide a good explanation on how to fix it.
Tips for the new environment: I tried to build it with "conda", but this didn't work flawless, so instead I used "venv". For me:
sudo apt update
sudo apt install python3.10 python3.10-venv python3.10-dev
python3.10 -m venv my_ros_env_py310
source my_ros_env_py310/bin/activate
Maybe you need some packages afterwords but you do not have to reinstall whole ROS just source it in the new environment.
Asked by vico on 2023-03-29 05:32:06 UTC
Comments
Can you start Gazebo with
gazebo --verbose
? Do you have Gazebo model path updated for TB3? Can you put a TB3 robot with lidar etc. in the empty world by hand?Asked by ljaniec on 2023-03-28 05:09:26 UTC
I can start gazebo with
gazebo --verbose
and I can place the world by hand as well as the robot. In my.bashrc
file I have this included:Asked by vico on 2023-03-28 07:05:27 UTC
When i try to run
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
gazebo starts with the loaded world but without a robot. And in rviz only the map appears, and it shows in the GUI "Global Status : Error". After i place the robot by hand in gazebo and manually locate it in rviz with "2D Pose Estimate". The GUI shows "Global Status: Ok".Asked by vico on 2023-03-28 07:15:45 UTC
Can you see any new errors during start with
gazebo --verbose
? Can you change the view to "Collisions" in the Gazebo simulation? Perhaps textures loaded incorrectly. I had similar problem with a Neobotix robot model in the simulation - no textures, but the collision boxes were there.Asked by ljaniec on 2023-03-28 07:39:30 UTC