IntelRealSense / realsense-ros

ROS Wrapper for Intel(R) RealSense(TM) Cameras
http://wiki.ros.org/RealSense
Apache License 2.0
2.6k stars 1.76k forks source link

Add ROS bag loop option #3214

Closed acornaglia closed 5 days ago

acornaglia commented 1 month ago

Scope

The changes in this PR introduce the possibility of looping the playback of a given rosbag file. This can be done by using the added rosbag_loop cmd line argument:

ros2 launch realsense2_camera rs_launch_from_rosbag.py rosbag_filename:="/full/path/to/rosbag/file" rosbag_loop:="true"

Testing

Environment

Docker container running:

Results

The collected output for the (3x) looping playback of an exemplary bag file is:

root@docker-rs:/home/realsense-ros# ros2 launch realsense2_camera rs_launch_from_rosbag.py rosbag_filename:="depth_under_water.bag" rosbag_loop:="true"
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-09-27-13-29-02-825375-docker-rs-124054
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense2_camera_node-1]: process started with pid [124055]
[realsense2_camera_node-1] [INFO] [1727443742.887543307] [camera.camera]: RealSense ROS v4.55.1
[realsense2_camera_node-1] [INFO] [1727443742.887597233] [camera.camera]: Built with LibRealSense v2.56.0
[realsense2_camera_node-1] [INFO] [1727443742.887615853] [camera.camera]: Running with LibRealSense v2.56.0
[realsense2_camera_node-1] [INFO] [1727443742.887728778] [camera.camera]: publish topics from rosbag file: depth_under_water.bag
[realsense2_camera_node-1] [INFO] [1727443742.895847995] [camera.camera]: getParameters...
[realsense2_camera_node-1] [INFO] [1727443742.895923719] [camera.camera]: JSON file is not provided
[realsense2_camera_node-1] [INFO] [1727443742.895929685] [camera.camera]: Device Name: Intel RealSense 415
[realsense2_camera_node-1] [INFO] [1727443742.895933771] [camera.camera]: Device Serial No: 725112060496
[realsense2_camera_node-1] [INFO] [1727443742.895937498] [camera.camera]: Device physical port:
[realsense2_camera_node-1] [INFO] [1727443742.895940867] [camera.camera]: Device FW version: 05.08.05.00
[realsense2_camera_node-1] [INFO] [1727443742.895944160] [camera.camera]: Device Product ID: 0x0AD3
[realsense2_camera_node-1] [INFO] [1727443742.895947370] [camera.camera]: Sync Mode: Off
[realsense2_camera_node-1] [INFO] [1727443742.896153488] [camera.camera]: Set ROS param depth_module.depth_profile to default: 1280x720x30
[realsense2_camera_node-1] [INFO] [1727443742.896371514] [camera.camera]: Set ROS param rgb_camera.color_profile to default: 640x480x30
[realsense2_camera_node-1] [INFO] [1727443742.897165030] [camera.camera]: Stopping Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443742.897178347] [camera.camera]: Stopping Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443742.898582202] [camera.camera]: Starting Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443742.898628425] [camera.camera]: Open profile: stream_type: Depth(0), Format: Z16, Width: 1280, Height: 720, FPS: 30
[realsense2_camera_node-1] [INFO] [1727443742.898887243] [camera.camera]: Starting Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443742.898925613] [camera.camera]: Open profile: stream_type: Color(0), Format: RGB8, Width: 640, Height: 480, FPS: 30
[realsense2_camera_node-1] [INFO] [1727443742.900194401] [camera.camera]: RealSense Node Is Up!
[realsense2_camera_node-1] [WARN] [1727443742.900956940] [camera.camera]: frame's time domain is HARDWARE_CLOCK. Timestamps may reset periodically.
[realsense2_camera_node-1] [INFO] [1727443754.429408667] [camera.camera]: Bag file playback has completed and it is going to be replayed.
[realsense2_camera_node-1] [INFO] [1727443754.429696988] [camera.camera]: Stop Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443754.429718218] [camera.camera]: Close Sensor.
[realsense2_camera_node-1] [INFO] [1727443754.429844879] [camera.camera]: Close Sensor - Done.
[realsense2_camera_node-1] [INFO] [1727443754.429889940] [camera.camera]: Stop Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443754.429894782] [camera.camera]: Close Sensor.
[realsense2_camera_node-1] [INFO] [1727443754.430064496] [camera.camera]: Close Sensor - Done.
[realsense2_camera_node-1] [INFO] [1727443754.431391276] [camera.camera]: getParameters...
[realsense2_camera_node-1] [INFO] [1727443754.431551290] [camera.camera]: JSON file is not provided
[realsense2_camera_node-1] [INFO] [1727443754.431562232] [camera.camera]: Device Name: Intel RealSense 415
[realsense2_camera_node-1] [INFO] [1727443754.431580935] [camera.camera]: Device Serial No: 725112060496
[realsense2_camera_node-1] [INFO] [1727443754.431587878] [camera.camera]: Device physical port:
[realsense2_camera_node-1] [INFO] [1727443754.431593944] [camera.camera]: Device FW version: 05.08.05.00
[realsense2_camera_node-1] [INFO] [1727443754.431600080] [camera.camera]: Device Product ID: 0x0AD3
[realsense2_camera_node-1] [INFO] [1727443754.431606182] [camera.camera]: Sync Mode: Off
[realsense2_camera_node-1] [INFO] [1727443754.431994461] [camera.camera]: Set ROS param depth_module.depth_profile to default: 1280x720x30
[realsense2_camera_node-1] [INFO] [1727443754.432406709] [camera.camera]: Set ROS param rgb_camera.color_profile to default: 640x480x30
[realsense2_camera_node-1] [INFO] [1727443754.434033889] [camera.camera]: Stopping Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443754.434064348] [camera.camera]: Stopping Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443754.434604389] [camera.camera]: Starting Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443754.434674866] [camera.camera]: Open profile: stream_type: Depth(0), Format: Z16, Width: 1280, Height: 720, FPS: 30
[realsense2_camera_node-1] [INFO] [1727443754.435084907] [camera.camera]: Starting Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443754.435142624] [camera.camera]: Open profile: stream_type: Color(0), Format: RGB8, Width: 640, Height: 480, FPS: 30
[realsense2_camera_node-1] [INFO] [1727443754.436038610] [camera.camera]: RealSense Node Is Up!
[realsense2_camera_node-1] [WARN] [1727443754.437696099] [camera.camera]: frame's time domain is HARDWARE_CLOCK. Timestamps may reset periodically.
[realsense2_camera_node-1] [INFO] [1727443765.972511866] [camera.camera]: Bag file playback has completed and it is going to be replayed.
[realsense2_camera_node-1] [INFO] [1727443765.972885994] [camera.camera]: Stop Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443765.972989446] [camera.camera]: Close Sensor.
[realsense2_camera_node-1] [INFO] [1727443765.973248353] [camera.camera]: Close Sensor - Done.
[realsense2_camera_node-1] [INFO] [1727443765.973330778] [camera.camera]: Stop Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443765.973342812] [camera.camera]: Close Sensor.
[realsense2_camera_node-1] [INFO] [1727443765.973584702] [camera.camera]: Close Sensor - Done.
[realsense2_camera_node-1] [INFO] [1727443765.975625715] [camera.camera]: getParameters...
[realsense2_camera_node-1] [INFO] [1727443765.975905152] [camera.camera]: JSON file is not provided
[realsense2_camera_node-1] [INFO] [1727443765.975920626] [camera.camera]: Device Name: Intel RealSense 415
[realsense2_camera_node-1] [INFO] [1727443765.975930690] [camera.camera]: Device Serial No: 725112060496
[realsense2_camera_node-1] [INFO] [1727443765.975939569] [camera.camera]: Device physical port:
[realsense2_camera_node-1] [INFO] [1727443765.975947697] [camera.camera]: Device FW version: 05.08.05.00
[realsense2_camera_node-1] [INFO] [1727443765.975955713] [camera.camera]: Device Product ID: 0x0AD3
[realsense2_camera_node-1] [INFO] [1727443765.975966281] [camera.camera]: Sync Mode: Off
[realsense2_camera_node-1] [INFO] [1727443765.976547444] [camera.camera]: Set ROS param depth_module.depth_profile to default: 1280x720x30
[realsense2_camera_node-1] [INFO] [1727443765.977359283] [camera.camera]: Set ROS param rgb_camera.color_profile to default: 640x480x30
[realsense2_camera_node-1] [INFO] [1727443765.979668566] [camera.camera]: Stopping Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443765.979713154] [camera.camera]: Stopping Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443765.980319867] [camera.camera]: Starting Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443765.980408511] [camera.camera]: Open profile: stream_type: Depth(0), Format: Z16, Width: 1280, Height: 720, FPS: 30
[realsense2_camera_node-1] [INFO] [1727443765.980618635] [camera.camera]: Starting Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443765.980643737] [camera.camera]: Open profile: stream_type: Color(0), Format: RGB8, Width: 640, Height: 480, FPS: 30
[realsense2_camera_node-1] [INFO] [1727443765.981051660] [camera.camera]: RealSense Node Is Up!
[realsense2_camera_node-1] [WARN] [1727443765.982272195] [camera.camera]: frame's time domain is HARDWARE_CLOCK. Timestamps may reset periodically.
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[realsense2_camera_node-1] [INFO] [1727443771.465198146] [rclcpp]: signal_handler(signum=2)
[realsense2_camera_node-1] [INFO] [1727443771.468487304] [camera.camera]: Stop Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1727443771.501105357] [camera.camera]: Close Sensor.
[realsense2_camera_node-1] [INFO] [1727443771.501516575] [camera.camera]: Close Sensor - Done.
[realsense2_camera_node-1] [INFO] [1727443771.501600180] [camera.camera]: Stop Sensor: RGB Camera
[realsense2_camera_node-1] [INFO] [1727443771.538736217] [camera.camera]: Close Sensor.
[realsense2_camera_node-1] [INFO] [1727443771.539086878] [camera.camera]: Close Sensor - Done.
[INFO] [realsense2_camera_node-1]: process has finished cleanly [pid 124055]
sysrsbuild commented 1 month ago

Can one of the admins verify this patch?