Ask Your Question
1

[ros2] Prefix in launch file

asked 2020-02-05 02:22:42 -0600

hdino gravatar image

ROS 1 launch files allowed to run nodes in a debugger, e.g. using launch_prefix="gdb --args". I tried to use it with ROS 2 by adding this parameter to launch_ros.actions.Node, but it just caused parsing errors. Is there still a way to specify such a prefix in ROS 2 launch files?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-02-05 10:45:50 -0600

sloretz gravatar image

launch_ros.actions.Node inherits from launch.actions.ExecuteProcess, and it passes extra arguments given to __init__ to it. I think you're looking for prefix.

Save this file as gdb_pub_launch.py

from launch import LaunchDescription
from launch import LaunchService

import launch_ros.actions


def generate_launch_description():
    """Run demo nodes via launch."""
    ld = LaunchDescription([
        launch_ros.actions.Node(
            package='demo_nodes_cpp', node_executable='talker', output='screen',
            remappings=[('chatter', 'my_chatter')],
            prefix=['gdb -ex=r --args'],
        )
    ])
    return ld

And run with

ros2 launch gdb_pub_launch.py
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-02-05 02:22:42 -0600

Seen: 18 times

Last updated: Feb 05