ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

how to pass parameters to URDF in ros2 launch file?

asked 2021-07-02 08:40:57 -0500

pmuthu2s gravatar image

I know we can do this in ROS-1, but I'm not exactly sure with the syntax in ROS2.

Just a small try I had given:

start_robot_state_publisher_cmd = Node(
    parameters=[{'use_sim_time': use_sim_time, 'frame_prefix': 'robot1/', 'robot_description': Command([robot_desc,'tfpre:=', 'robot1/'])}],

tf pre is the parameter I'm trying to pass. But, I'm certainly sure there is some mistake with this ,method.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-07-02 10:04:39 -0500

jafar_abdi gravatar image

One way to do it is as follow

import xacro
urdf = xacro.process_file(file_path, mappings={'tfpre': 'robot1/'}).toxml()
# Use urdf
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-07-02 08:40:57 -0500

Seen: 319 times

Last updated: Jul 02 '21