How do I import XACRO files as Rigid Body Trees in Robotics System Toolbox?

26 views (last 30 days)
I am trying to import a robot description model from a XACRO file as a Rigid Body Tree from Robotics System Toolbox.
robot = importrobot('myfile.xacro');
However, the XACRO format is not supported. Instead, I need to use a plain URDF file. How can I get around this?

Accepted Answer

Sebastian Castro
Sebastian Castro on 5 Oct 2018
Edited: Sebastian Castro on 5 Oct 2018
You can use the ROS xacro utility to convert your XACRO files to URDF before importing into MATLAB.
In a ROS enabled terminal, you can enter the following command, replacing the paths and names for your input and output files:
rosrun xacro xacro --inorder -o ~/myfile.urdf ~/myfile.xacro
You can then check the generated file to see if it's valid
check_urdf ~/myfile.urdf
If this step is successful, you can copy the URDF file and its dependent meshes somewhere accessible by MATLAB. Then, you can try import your robot as follows
>> robot = importrobot('myfile.urdf');
- Sebastian

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!