Robotics StackExchange | Archived questions

ros2 bag launch

Hi ROS2 enthusiasts,

I would like to use ros2bag from a launch file. How do I realize it? Non of the ros2bag or rosbag2 packages seems to have a launch configuration yet.

Any idea?

Sebastian

Asked by Poseidonius on 2019-12-06 13:34:17 UTC

Comments

Are you talking about something like this:

Node(
        package='rosbag2',
        node_executable=' ',
        node_name='rosbag2_node ',
        arguments=[' ', ' '],
        parameters=[{ ' ': }],
        output='screen'),

If you know how to start a node from terminal then you can also launch it in a launchfile. You can simply add the Node(), to the other launch_descriptions inside:

return LaunchDescription([
...
])

You will just have to import

from launch_ros.actions import Node

I left the fields blank, because I haven't used rosbag2 and don't know the name of the executables or parameters etc., but hopefully this helps. If I misunderstood your question please let me know.

Asked by MCornelis on 2019-12-09 09:43:07 UTC

Answers

I missed this question earlier, but I've answered a duplicate question here: https://answers.ros.org/question/341710/ros2-start-rosbag2-recording-from-launch-file/?answer=341955#post-id-341955

I'm not sure it's the ideal approach for rosbag2, but you can launch an ExecuteProcess for any ros2 CLI.

Asked by jacobperron on 2020-01-17 18:46:37 UTC

Comments

So far this is the suggested way to do it (via executing as executable not as node action): https://github.com/ros2/rosbag2#using-in-launch

Asked by khaiyichin on 2021-02-22 17:27:55 UTC