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

[Solved] How to convert urdf to sdf (gz not working)

asked 2022-05-09 02:19:19 -0500

Bastian2909 gravatar image

updated 2022-05-09 04:38:27 -0500

For a little bit of context, I'm using ros Foxy with Ubuntu 20.04 My initial goal was to use the gazebo_ros_p3d plugin in gazebo by adding :

<gazebo>
<plugin filename="libgazebo_ros_p3d.so" name="gazebo_ros_p3d">
  <bodyName>bannane</bodyName>
  <topicName>ground_truth_odom</topicName>
  <alwaysOn>true</alwaysOn>
  <updateRate>100.0</updateRate>
</plugin>

</gazebo> into my .urdf description of the robot. Everything seem to work fine, the robot spawn in gazebo however i get this error :

[gazebo-4] [ERROR] [1651828364.494524675] [gazebo_ros_p3d]: Missing <body_name>, cannot proceed

This led me to look here : http://docs.ros.org/en/melodic/api/ga.... Apparently my .sdf file does not contains a body_name which is weird as it seems present in my urdf file.

I then tried to look at what the sdf file looked like, and found an issue :

$ gz sdf -p bot_description.urdf > test
Error: SDF parsing the xml failed

I believe the issue comes from here, gazebo don't need .sdf file to work so the simulation work fine but as the conversion fail i can't get the plugin to work. Is there a way to get more information on why does the conversion is failing ? How can i add my .urdf to this post if needed ? Thank you everyone for taking time to read my question !

edit retag flag offensive close merge delete

Comments

Please post your last edit as an answers instead, then accept your own answer.

gvdhoorn gravatar image gvdhoorn  ( 2022-05-09 03:40:03 -0500 )edit

done, thank you for the advice, will do that from now on. however I can't accept my own answer as I don't have enough points.

Bastian2909 gravatar image Bastian2909  ( 2022-05-09 04:42:05 -0500 )edit

I've already accepted it for you.

gvdhoorn gravatar image gvdhoorn  ( 2022-05-09 04:43:15 -0500 )edit

Thank you !

Bastian2909 gravatar image Bastian2909  ( 2022-05-09 06:45:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-05-09 04:38:34 -0500

Bastian2909 gravatar image

Found the issue ! I followed a tutorial telling me to create a .urdf file and calling it a urdf file even though there was some xacro prensent in the code. This led me to beleive my file was a .urdf file but it was a .xacro file. So i first converted my .urdf file to a true .urdf file using the xacro -> urdf converter. Then i was able to convert my true .urdf file into an sdf without any issue.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2022-05-09 02:19:19 -0500

Seen: 1,366 times

Last updated: May 09 '22