Skip to content

Jazzy: rosbag2_transport Player Node does not terminate when playback_duration or playback_until_timestamp is specified. #2383

@balthasarschuess

Description

@balthasarschuess

Description

  • when running ros2 bag play --playback-duration 5s /path/to/bag the command terminates after playback is complete
  • when using rosbag2_transport player node with the playback duration parameter, message publishing terminates at the right time, but the /clock topic continues being published and the node does not shut down

Expected Behavior

  • I expect the node to publish the /clock topic and messages until the specified time
  • I expect the node to terminate, once the playback duration is exceeded

Actual Behavior

  • messages are published until the specified time
  • /clock is being published beyond the specified time until infinity (if termination is not intended, I'd expect at least this.)
  • node does not terminate

To Reproduce

from amr_bringup.logging_utils import add_rosout_support
from launch import LaunchDescription
from launch.actions import (
    DeclareLaunchArgument,
    RegisterEventHandler,
    Shutdown,
    LogInfo,
)
from launch.event_handlers import OnProcessExit
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node, SetParameter

from lv.appconfig import resolve_launch_param_files


def generate_launch_description():  # noqa
    bag_path = LaunchConfiguration("bag_path")

    declare_bag_path = DeclareLaunchArgument(
        "bag_path",
        description="Path to the rosbag to replay",
    )

    player = Node(
        package="rosbag2_transport",
        executable="player",
        name="rosbag_replay",
        output="screen",
        parameters=[
             "path/to/rosbag_play.yaml",
            {"storage.uri": bag_path},
        ],
        respawn=False,
    )

    ld = LaunchDescription(
        [
            SetParameter(
                name="use_sim_time",
                value="true",
            ),
            declare_bag_path,
            player,
            RegisterEventHandler(
                OnProcessExit(
                    target_action=player,
                    on_exit=[
                      LogInfo(msg="Node exited"),
                      Shutdown(reason="Rosbag replay finished"),
                   ],
                )
            ),
        ]
    )
    add_rosout_support(ld)

    return ld
/**:

  ros__parameters:
    play:
      rate: 1.0
      loop: false
      start_paused: false
      disable_keyboard_controls: true
      playback_duration:
        sec: 5
        nsec: 0

System (please complete the following information)

  • OS: Ubuntu 22.04
  • ROS 2 Distro: jazzy
  • Install Method: source + colcon
  • Version: jazzy (2b67d54)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions