Home | Tutorials | Wiki | Issues
Ask Your Question
0

[Newbie] How to spawn the old Xacro or urdf file?

asked 2013-07-03 11:21:05 -0600

gazer gravatar image

updated 2013-07-03 13:06:10 -0600

nkoenig gravatar image

Hello all.

I know already how to use the sdf by following the tutorials here. However, most models offered online sources are still in .xacro or .urdf file.

With sdf, we put "model.sdf" file under ~/.gazebo/model directory, then create model.config file also. I am wondering is this still applies to .xacro or .urdf file? (I tried rosrun xacro xacro.py to convert .xacro file to urdf, but it fails in converting it.)

Thus, I don't know how to spawn them in gazebo.

I am using the ros_gazebo_simulator ( gazebo version 1.5), but I don't think it makes any difference between this and the standalone version.

So I have 2 questions:

1) how to spawn the .xacro model

2) how to spawn the .urdf model

without doing any conversion to sdf. Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-07-03 13:08:55 -0600

nkoenig gravatar image

You have to run a xacro file through xacro.py in order to first create a urdf file. Then you can pass the urdf file directly into Gazebo, just as you would an sdf file. Gazebo will handle the conversion for you.

edit flag offensive delete link more

Comments

Hello, I am working on the same thing and I got xacro to convert to urdf, and have been getting compile errors like: https://gist.github.com/ftalex/5961582 Has the formats changed? I am not clear when the urdf I am working with was made but I am also using the integrated gazebo with ros

FiliusFortunae gravatar imageFiliusFortunae ( 2013-07-09 16:47:38 -0600 )edit

When I got rid of the joint:hinge element and the controller:ackermann_plugin it loaded. So I am going to look if there is a new version of these elements. I wonder if the plugin code will need to change as well.

FiliusFortunae gravatar imageFiliusFortunae ( 2013-07-09 17:33:46 -0600 )edit

Filius, I've had similar problems before. Some element of the URDF isn't parsed properly and breaks the conversion. I deal with it in the same way: try to find and remove the offending element.

Ben B gravatar imageBen B ( 2013-07-11 18:22:43 -0600 )edit
0

answered 2013-07-11 11:07:43 -0600

Mrit91 gravatar image

In your launch file, just add:

arg name="model" default="$(find yourpackage)/urdf/yourfile.urdf.xacro"/

param name="robot_description" command="$(find xacro)/xacro.py '$(arg model)'" /

This should work.

Or if you have just urdf file and not a xacro, add:

param name="robotdescription" textfile="$(find yourpackage)/urdf/your_file.urdf" /

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-07-03 11:21:05 -0600

Seen: 848 times

Last updated: Jul 11 '13