How to start ros2 bag play from launch file?
I would like to start a rosbag file from within a python launch file. How would it be possible to start the command line argument
$ ros2 bag play myfile.db3
within a python launch file. Thanks
My launchfile looks as the following:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
ld = LaunchDescription()
# ------------------------- Nodes ------------------------- #
rosbag_play = (
package='rosbag',
executable='play',
arguments= "--loop ~/path/to/myfile.db3",
output='screen'
)
...
# -------------------------------------------------------- #
ld.add_action(rosbag_play)
...
return ld