ros2 foxy setting parameters from a YAML file in a launch file
On Ubuntu, I am attempting to write a python launch file for a node that sets some parameters on the node from a YAML configuration file. This is the launch file:
import os
from launch import LaunchDescription
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import Node
def generate_launch_description():
ld = LaunchDescription()
bridge_config = os.path.join(get_package_share_directory("simulator_launch"),
"config",
"eca_a9_bridge_params.yaml")
ros1ros2_bridge = Node(
package="uuv_ros_bridges",
executable="eca_a9_bridge",
name="ros2_bridge",
parameters=[bridge_config])
ld.add_action(ros1ros2_bridge)
return ld
and this is the configuration file:
ros2_bridge:
ros__parameters:
topics: ['visualization_marker_array','/eca_a9/attitude_goal', '/eca_a9/pose_gt', '/eca_a9/time_to_target', '/eca_a9/sss_left', '/eca_a9/sss_right', '/eca_a9/dvl', '/eca_a9/gps', '/eca_a9/particle_concentration', '/eca_a9/pressure', '/eca_a9/salinity']
ros1_topic_types: ['visualization_msgs/MarkerArray','nav_msgs/Odometry' ,'nav_msgs/Odometry', 'std_msgs/Float64', 'sensor_msgs/LaserScan', 'sensor_msgs/LaserScan', 'uuv_sensor_ros_plugins_msgs/DVL', 'sensor_msgs/NavSatFix', 'uuv_sensor_ros_plugins_msgs/ChemicalParticleConcentration', 'sensor_msgs/FluidPressure', 'uuv_sensor_ros_plugins_msgs/Salinity']
ros2_topic_types: ['visualization_msgs/msg/MarkerArray','nav_msgs/msg/Odometry', 'nav_msgs/msg/Odometry', 'std_msgs/msg/Float64', 'sensor_msgs/msg/LaserScan', 'sensor_msgs/msg/LaserScan', 'uuv_helm_ros_interfaces/msg/DVL', 'sensor_msgs/msg/NavSatFix', 'uuv_helm_ros_interfaces/msg/ChemicalParticleConcentration', 'sensor_msgs/msg/FluidPressure', 'uuv_helm_ros_interfaces/msg/Salinity']
queue_sizes: [100,10,10,10,10,10,10,10,10,10,10]
services_1_to_2: ['NONE']
services_1_to_2_types: ['NONE']
services_2_to_1: ['/eca_a9/go_to']
services_2_to_1_types: ['uuv_control_msgs/GoTo']
When I run ros2 launch simulator_launch bridge_launch.launch.py, I get:
[INFO] [launch]: All log files can be found below /home/kednie/.ros/log/2021-01-27-18-46-35-913434-opt3-540078
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [eca_a9_bridge-1]: process started with pid [540080]
[eca_a9_bridge-1] [ERROR] [1611791196.020546158] [rcl]: Failed to parse global arguments
[eca_a9_bridge-1] terminate called after throwing an instance of 'rclcpp::exceptions::RCLInvalidROSArgsError'
[eca_a9_bridge-1] what(): failed to initialize rcl: Couldn't parse remap rule: '-r --params-file'. Error: Expecting token or wildcard, at /tmp/binarydeb/ros-foxy-rcl-1.1.10/src/rcl/arguments.c:1138, at /tmp/binarydeb/ros-foxy-rcl-1.1.10/src/rcl/arguments.c:353
[ERROR] [eca_a9_bridge-1]: process has died [pid 540080, exit code -6, cmd '/home/kednie/Projects/trustedFrogman/code-core/build-ROS/ros2/install/uuv_ros_bridges/lib/uuv_ros_bridges/eca_a9_bridge --ros-args -r __node:=ros2_bridge --params-file /home/kednie/Projects/trustedFrogman/code-core/build-ROS/ros2/install/simulator_launch/share/simulator_launch/config/eca_a9_bridge_params.yaml'].
I followed this tutorial: https://roboticsbackend.com/ros2-laun... and this tutorial: https://roboticsbackend.com/ros2-yaml...
Any explanation of what Im doing wrong is greatly appreciated.