You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When replaying a recorded bag (using replay.launch.xml), the deserialized packets will be assigned the current ROS time instead of the simulated time (available in /clock topic). This causes the deserialized points/IMU to be desynchronized from other topics in the bag.
As far as we understand, even with use_sim_time=true, the call to rclcpp::Clock(RCL_ROS_TIME).now()(used here) is not able to subscribe to /clock itself; therefore it always returns the current ROS time. In ROS2 the simulation time (from /clock) is only accessible from a node, e.g. using node->now().
Screenshots
Desynchronization example between GPS (with recorded time), clock (simulated time) and deserialized ouster points (using current ROS time)
We've coded a workaround that passes the node from os_cloud_node.cpp to the LidarPacketHandler and ImuPacketHandler classes, but we're wondering if this issue has been identified or addressed before. Otherwise we're happy to share it.
Platform:
Ouster Sensor: OS-1
ROS version/distro: Humble
Operating System: Linux
Machine Architecture: x64
The text was updated successfully, but these errors were encountered:
Hi @JulioPlaced, Although I have previously thought about this issue I have never looked in depth into replaying bag files storing raw sensor packets. Your question definitely sheds light on the issue. This is probably why I kept the timestamp_mode parameter available to users even within replay. Have you actually tried to replay the bag file with timestamp_mode set to TIME_FROM_ROS_TIME?
Hello @Samahu. Yes, timestamp_mode is set to TIME_FROM_ROS_TIME, and it is in fact retrieving ROS time (using rclcpp::Clock(RCL_ROS_TIME).now()). The problem with this time is that it is the current ROS time, not the ROS time at the time of recording.
As far as I understand, the only way to access the simulation time in ROS2 is from within a node, since you have to subscribe to /clock.
Therefore, instead of using rclcpp::Clock(RCL_ROS_TIME).now()here and here, we'd need to call node->now(). The first retrieves current ROS time whereas the second one subscribes to /clock and gets sim time.
Let me know if that makes sense.
Hello @Samahu. Yes, timestamp_mode is set to TIME_FROM_ROS_TIME, and it is in fact retrieving ROS time (using rclcpp::Clock(RCL_ROS_TIME).now()). The problem with this time is that it is the current ROS time, not the ROS time at the time of recording. As far as I understand, the only way to access the simulation time in ROS2 is from within a node, since you have to subscribe to /clock. Therefore, instead of using rclcpp::Clock(RCL_ROS_TIME).now()here and here, we'd need to call node->now(). The first retrieves current ROS time whereas the second one subscribes to /clock and gets sim time. Let me know if that makes sense.
When replaying a recorded bag (using
replay.launch.xml
), the deserialized packets will be assigned the current ROS time instead of the simulated time (available in/clock
topic). This causes the deserialized points/IMU to be desynchronized from other topics in the bag.As far as we understand, even with
use_sim_time=true
, the call torclcpp::Clock(RCL_ROS_TIME).now()
(used here) is not able to subscribe to/clock
itself; therefore it always returns the current ROS time. In ROS2 the simulation time (from/clock
) is only accessible from a node, e.g. usingnode->now()
.Screenshots
Desynchronization example between GPS (with recorded time), clock (simulated time) and deserialized ouster points (using current ROS time)
We've coded a workaround that passes the node from
os_cloud_node.cpp
to theLidarPacketHandler
andImuPacketHandler
classes, but we're wondering if this issue has been identified or addressed before. Otherwise we're happy to share it.Platform:
The text was updated successfully, but these errors were encountered: