0
$\begingroup$

Rosanswers logo

Hi everyone

I have a question about spawning model by using spawn_model service. I use .xacro file for descripting the hector_quadrotor model. And I need to dynamically spawning new model by calling spawn_model service. But I feel confused about how to use .xacro file as parameter for the model_xml fild of gazebo_msgs/SpawnModel message type.If conversion is necessary, does anyone know how to conver .xacro to .urdf or .xml in c++ code.

Thanks


Originally posted by [email protected] on ROS Answers with karma: 31 on 2017-04-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Xacro files need to be parsed by the xacro parser before you can load them into Gazebo, rViz, etc.

When you are running things through a launch file, you can do this easily at launch time, like the example below. But if you are using the file from a node, it's easier to run xacro first to produce an output that you save to a file and work with that processed file.

<param name="robot_description" command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/my_robot.urdf.xacro' "/>

Originally posted by Geoff with karma: 4203 on 2017-04-23

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.