Robotics StackExchange | Archived questions

[ROS2] How do you set verbosity of a Composable Node?

Using ROS2 Foxy, and I want to set the verbosity (log level) of a composable node in the launch file. The code below shows the options I've tried:

container = ComposableNodeContainer(
    name='ExampleContainer',
    namespace='',
    package='rclcpp_components',
    executable='component_container',
    composable_node_descriptions=[
        ComposableNode(
            package='package_name',
            plugin='namespace::node_class', 
            name='node_name',
            extra_arguments=[{'LOG_LEVEL': 'INFO'}]   # Option 1, compiles but doesn't work
        )
    ],
    output='screen',
    arguments=['--ros-args', '--log-level', 'INFO']   # Option 2, compiles and works but causes the error below if the verbosity is set to 'DEBUG'
)

So far I haven't found anything that works properly. Does anyone know the correct syntax?

Option 2 does seem to work for WARN, INFO, and ERROR, but causes this run-time error with DEBUG:

[ERROR] [component_container-1]: process has died [pid 4137, exit code -11, cmd '/opt/ros/foxy/lib/rclcpp_components/component_container --ros-args --log-level DEBUG --ros-args -r __node:=ExampleContainer -r __ns:=/'].

Asked by M@t on 2021-01-25 20:52:16 UTC

Comments

M@t did you ever get this working for DEBUG?

Asked by msmcconnell on 2021-11-24 09:35:21 UTC

Answers

Missing colon after output='screen'

output='screen', arguments=['--ros-args', '--log-level', 'INFO']

Created an issue for that: https://github.com/ros2/ros2/issues/1091

Asked by ralwing on 2021-01-27 03:58:41 UTC

Comments

Good catch with my syntax! After fixing that typo, it seems that Option 2 works for everything except DEBUG.

Asked by M@t on 2021-01-27 14:58:15 UTC