Gazebo | Ignition | Community
Ask Your Question

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

asked 2023-02-25 06:49:32 -0600

TaykoTech gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-02-25 07:12:01 -0600

TaykoTech gravatar image

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.

edit flag offensive delete link more


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

slim71 gravatar imageslim71 ( 2023-05-04 15:59:42 -0600 )edit

Question Tools

1 follower


Asked: 2023-02-25 06:49:32 -0600

Seen: 886 times

Last updated: Feb 25