Ask Your Question
1

[ROS2] Can I launch nodes using yaml file?

asked 2019-08-19 22:23:25 -0500

J-pcy gravatar image

If yes, what is the format and key words of yaml file? Could somebody give an example? Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-08-20 02:14:19 -0500

xhuan28 gravatar image

Here is a discussion on this.

Below is my implementation for your reference:

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
import launch_ros.actions

def generate_launch_description():
  default_yaml = os.path.join(get_package_share_directory('my_package'), 'param',
                            'param.yaml')
  return LaunchDescription([
    launch_ros.actions.Node(
        package='my_package', node_executable='my_executable',
        arguments=['-config', default_yaml],
        output='screen'),
])
edit flag offensive delete link more

Comments

I'm not sure this is an answer to the question of the OP: he appears to be asking whether it'd be possible to launch nodes merely using a .yaml file. The linked issue and the code snippet appear to show how to pass parameters to a node. Those would seem to be two different things.

gvdhoorn gravatar imagegvdhoorn ( 2019-08-20 02:20:48 -0500 )edit

Your Answer

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

Add Answer

Question Tools

3 followers

Stats

Asked: 2019-08-19 22:23:25 -0500

Seen: 22 times

Last updated: Aug 20