Robotics StackExchange | Archived questions

Cannot Spawn URDF into gazebo using ros2

I am trying to load a URDF file into gazebo, and do so using a ros2 python launch file. This was easily done in the past with ros1 xml launch files, however I am having trouble doing the same with ros2 python launch files. I am able to launch gazebo from this ros2 launch file, however my robot model is not displaying. There are no errors, and says everything is processed cleanly though the robot does not appear. I am loading the xml data of the urdf to robotstatepublisher, and publishing the xml data on a topic. I then use the spawnentity node to read the xml data from that topic. In my URDF I have built my robot using meshes, and I suspect that when passing the xml data to spawnentity on a topic, the location or file in formation of those meshes are not completed transferred. I suspect this to be the case, because if I build a robot with out meshes and use basic geometries ( box, cylinder..) in the urdf, then everything works fine and I am able to spawn the robot from a urdf into gazebo using ros2.

I am running Ubunut 20.04, gazebo 11, ros2-foxy, and gazeborospackages foxy branch

Here is the code:

image description

Here is the terminal ; image description

Any help would be greatly appreciated.

Here is a portion of the URDF. image description image description

Here is the result in Gazebo image description

Asked by DRO on 2020-11-09 18:10:43 UTC

Comments

Just posting that I see the same behavior with mesh files on Foxy, ROS2, Gazebo11. Looking for answers...

Asked by gy on 2021-03-12 16:08:28 UTC

Answers

In ROS2, the SpawnEntity method let's the SDF library handle the URDF conversion. A urdf model has package:// but the sdf::readString method transforms the package:// urls into model:// . Hence, one of the ways to resolve this issue would be to convert your urdf file into a sdf file. This can be done by using the command, gz sdf -p file_name.urdf > file_name.sdf . Try to launch this sdf file. If it doesn't launch even after this, then try removing model://package_name from the uri and just keep the portion meshes/ur5/visual/bot_part_name.dae and see if this works. You can refer the following links for further information:

Asked by Aryaman on 2021-09-23 15:21:11 UTC

Comments