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

Attaching a sdf model onto a existing urdf model?

asked 2019-03-23 16:32:37 -0500

steradiant gravatar image

I have a existing urdf-model of a robot and I want to attach different things onto the robot arm. Is there a way to combine the existing urdf-model with new sdf models?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-03-26 04:02:00 -0500

Reamees gravatar image

updated 2019-03-26 16:58:38 -0500

You can do it. There are some differences in URDF and SDF so you will probably need to modify the SDF to be compatible with the URDF and then just make a link in the place you want to attach the new model to. need to convert the SDF and include it in your existing URDF.

This outlines some of the differences in URDF and SDF http://gazebosim.org/tutorials?tut=ros_urdf

If you are making complex URDFs you proably should look into xacro a bit as well. Once you have it set up properly it is easier to understand and modify. xacro

One example of a project that is using xacros Clearpath Jackal

There are lots more tutorials and examples of xacro just some googling away.

Some things to help verify the process. You can run:

rosrun xacro xacro --inorder -o model.urdf model.urdf.xacro

to verify that the xacro would be converted to a valid URDF.

To easily visualize the model you could install the package urdf_tutorial mentioned in the beginning of this tutorial and then launch roslaunch urdf_tutorial display.launch model:=your_model.urdf.xacro in the folder where you have the urdf/xacro files. If you don't want to install the package you can grab the launch files and rviz config from the package and put them in some other package of your choice.


As gvdhoorn said SDF to URDF conversion is lossy. There are atributes in SDF that can not be used in URDF.

Aslo, it seems there is a package for converting SDF to URDF. Link found from this youtube video

I have not tested that package.

edit flag offensive delete link more

Comments

You can do it. There are some differences in URDF and SDF so you will probably need to modify the SDF to be compatible with the URDF

So technically the answer is: you can't, if I understand what you write correctly.

You cannot merge a URDF with an SDF. You'd have to convert the URDF to SDF, or the SDF to URDF. The latter is a lossy conversion as well.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-26 11:46:44 -0500 )edit

Technically correct is the best kind of correct. Although I'm not sure the phrase "You can do it" would be the most technically incorrect part of my answer in the context of the question. Instead of focusing on the technical differences between the two, I mentioned the tools I could use if I would need to port SDF to URDF.

If running the URDF fails. Run it with rosrun xacro .... If there are errors, comment stuff out until it passes cleanly. Look at it in Rviz, see if it resembles something. Add stuff back in, rinse and repeat. This is what I remeber dealing with URDFs was like when I first touched ROS. Other than a better understanding of what might break an URDF, not much has changed about that process for me.

Could I have been more clear that SDF and URDF are not directly compatible? Yes, will ...(more)

Reamees gravatar image Reamees  ( 2019-03-26 16:54:40 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-03-23 16:32:37 -0500

Seen: 2,534 times

Last updated: Mar 26 '19