Robotics StackExchange | Archived questions

How to spawn a URDF robot into a Ignition Gazebo world from ROS2?

I've had a nightmare of a time trying to figure out how to do this. The confusing name change from Ignition to Gazebo Sim has made it almost impossible to tell the difference between the vast majority of tutorials and posts about the latest versions of Gazebo (I'm using Fortress because Garden doesn't seem quite ready yet) and the vast majority which are about Gazebo Classic since they have the same name.

There doesn't seem to be a spawn_entity script or anything like that for importing robots yet. At least not one that I've found. The only way I've managed to do it is through the command line using the ign service, but that seems to be quite a pain to implement into a ROS2 (Humble) python launch file. Is that really the only way to do it at the moment?

Any input would be much appreciated, Cheers

Asked by TaykoTech on 2023-02-25 07:49:32 UTC

Comments

Answers

Ahh never mind, I managed to find another example file from someone that had the easy solution.

The create executable appears to be the new entity_spawner for Ignition.

spawn = Node( package='ros_gz_sim', executable='create', arguments=[ '-name', 'ROBOT_NAME', '-topic', 'robot_description', ], output='screen', )

This successfully spawns my robot into my world while gazebo is running. seems so simple and yet I only managed to find it by fluke. If anyone else is stuck on this, hopefully this post helps clarify things.

Asked by TaykoTech on 2023-02-25 08:12:01 UTC

Comments

it's been a while, but... can I ask where did you found that? thanks!

Asked by slim71 on 2023-05-04 15:59:42 UTC