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

ROS2: using xacro in launch file - passing parameters [closed]

asked 2020-04-17 20:20:23 -0500

relffok gravatar image

updated 2020-04-17 20:20:38 -0500

Hi there,

I've been using xacro.process_file(<file_name>)to convert from xacro to urdf, it works just fine. Now I have implemented a xacro argument in my file and I want to pass that from my launch file. It just doesn't get read with my current implementation.


<xacro:arg name="simulate_obstacles" default="true"/>
<xacro:if value="$(arg simulate_obstacles)">


doc = xacro.process_file(xacro_file, simulate_obstacles='false')

When running the xacro from the commandline I don't have any problem passing arguments. What am I doing wrong here? Or is there even a more simple way to use xacro in launch files in ROS2?

Thank you!

Working with eloquent.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by relffok
close date 2021-09-30 06:39:26.079969

1 Answer

Sort by ยป oldest newest most voted

answered 2020-04-20 13:56:20 -0500

relffok gravatar image

Hi, it seems like this fixes the issue:

doc = xacro.process_file(xacro_file, mappings={'simulate_obstacles' : 'false'})

In case there is or will be a better way to include xacro in ros2 launch files at some point, feel free to let me know!

edit flag offensive delete link more

Question Tools



Asked: 2020-04-17 20:20:23 -0500

Seen: 1,655 times

Last updated: Apr 20 '20