How to use xacro for ROS2
I'm working with ROS2 dashing and following this thread: https://answers.ros.org/question/354341/using-xacro-package-in-ros-2/, 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?
Asked by atahackaton on 2020-09-08 21:37:09 UTC
Answers
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:
Hope this helps
You should get something like this in the example:
Asked by RDaneelOlivaw on 2021-08-06 12:37:14 UTC
Comments