ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hello,
I used this tutorial to prepare a YAML configuration files to my launchfiles:
I think it could help you too :)
The most important things:
- self.declare_parameters(...)
in the code of your (Python) node
- then, in the launch file:
config = os.path.join(
get_package_share_directory('ros2_tutorials'),
'config',
'params.yaml'
)
node=Node(
package = 'your_ros2_package',
name = 'your_amazing_node',
executable = 'test_yaml_params',
parameters = [config]
)
additionally, in the setup.py
in the package there should be something like this:
data_files=[('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), (os.path.join('share', package_name, 'launch'), glob('launch/*.launch.py')), (os.path.join('share', package_name, 'config'), glob('config/*.yaml'))],