<!-# [ROS2] How to describe remap and parameter in python format launch->
From ROS2, you can write launch files in python, but I haven't found many examples other than tutorials yet. So, this time, I searched for remapping and how to use parameters from Github (ros2 / launch_ros) of ROS2.
import launch
import launch_ros.actions
def generate_launch_description():
return launch.LaunchDescription([
launch_ros.actions.Node(
package='demo_parameters_cpp',
node_executable='string_talker',
output='screen',
node_name='string_talker',
remappings=[('string_topic', '/talker')],
parameters=[{'string_param':'changed'}]
)
])
remap
Specify remappings
in argument and add tuples to the list. Tuples are described by (topic name before remap, topic name after remap)
.
parameter
Specify parameters
for argument and put the dictionary in the list. To specify multiple parameters, write as [{parameter1: value1, parameter2: value2, ...}]
.
If you want to read as a yaml file
parameters=['parameter_dir/parameter.yaml']
You can set the parameter from the yaml file by writing like.
-[ROS2] How to describe remap and parameters in xml format launch
Recommended Posts