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

How to use xacro for ROS2

asked 2020-09-08 21:37:09 -0600

atahackaton gravatar image

I'm working with ROS2 dashing and following this thread: https://answers.ros.org/question/3543..., I cloned the dashing branch and built xacro. However, I do not know how to use it; is anyone familiar with using xacro in ROS2?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-08-06 12:37:14 -0600

RDaneelOlivaw gravatar image

Hi,

To use XACRO in ROS2 you need to process the XACRO and convert it to xml:

import xacro

xacro_file = os.path.join(get_package_share_directory('box_car_description'), 'robot/', 'box_bot.xacro')    
assert os.path.exists(xacro_file), "The box_bot.xacro doesnt exist in "+str(xacro_file)

robot_description_config = xacro.process_file(xacro_file)
robot_desc = robot_description_config.toxml()

I'll leave a git as an example for this of how to spawn a simple box robot that uses xacro, have a look at the spawning scripts:

GIT with EXAMPLE

SPAWN 1

SPAWN 2

ROSject Plug and play example

YOUTUBE VIDEO

Hope this helps

You should get something like this in the example:

image description

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-09-08 21:37:09 -0600

Seen: 1,212 times

Last updated: Aug 06 '21