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

Robot won't spawn in gazebo

asked 2023-03-22 11:59:48 -0600

vico gravatar image

updated 2023-03-23 04:50:18 -0600

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_st...)

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?

edit retag flag offensive close merge delete

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?

ljaniec gravatar image ljaniec  ( 2023-03-28 05:09:26 -0600 )edit

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:

export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models
vico gravatar image vico  ( 2023-03-28 07:05:27 -0600 )edit

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".

vico gravatar image vico  ( 2023-03-28 07:15:45 -0600 )edit

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.

ljaniec gravatar image ljaniec  ( 2023-03-28 07:39:30 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2023-03-29 05:32:06 -0600

vico gravatar image

updated 2023-04-18 04:44:05 -0600

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 rclpywhich is then explained in the provide debug link : https://docs.ros.org/en/humble/How-To...

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.

edit flag offensive delete link more
0

answered 2023-03-25 15:15:57 -0600

Robo_guy gravatar image

Hello @vico, this could be because of a missing transform, this link which has a similar problem might help - https://answers.ros.org/question/3438...

edit flag offensive delete link more

Question Tools

Stats

Asked: 2023-03-22 11:59:48 -0600

Seen: 4,587 times

Last updated: Apr 18 '23