fsstudio-team / ZeroSimROSUnity

Robotic simulation in Unity with ROS integration.
https://roboticsimulationservices.com/
MIT License
168 stars 21 forks source link

Timestamp mismatch in RGBDepthPublisher #12

Closed rendellc closed 3 years ago

rendellc commented 3 years ago

Description

The different messages published by OnPublishRGBDepthDelegate in RGBDepthPublisher are given independent timestamps, despite coming from the same simulation time-step. This is because the headers are all updated using the Update method which creates a new timestamp. https://github.com/fsstudio-team/ZeroSimROSUnity/blob/cfa659082a463ae6f8cbf8d62281c04852b9aaa4/Runtime/Scripts/ROS/Unity/Publishers/ZOROSRGBDepthPublisher.cs#L174 https://github.com/fsstudio-team/ZeroSimROSUnity/blob/cfa659082a463ae6f8cbf8d62281c04852b9aaa4/Runtime/Scripts/ROS/Unity/Publishers/ZOROSRGBDepthPublisher.cs#L195 https://github.com/fsstudio-team/ZeroSimROSUnity/blob/cfa659082a463ae6f8cbf8d62281c04852b9aaa4/Runtime/Scripts/ROS/Unity/Publishers/ZOROSRGBDepthPublisher.cs#L197

Problem

This causes issues in packages that expect camera image and camera info to be synchronized exactly, like the image_transport::CameraSubscriber. As a workaround we currently need to use approximate time synchronization to match image and info topics, but since the image and info are generated on the same simulation step, we believe this shouldn't be needed.

Proposed solution

Use the same timestamp for image message and info message. Will add a PR

rendellc commented 3 years ago

Seems like timestamp matching was already implemented in the lines below :sweat_smile: https://github.com/fsstudio-team/ZeroSimROSUnity/blob/cfa659082a463ae6f8cbf8d62281c04852b9aaa4/Runtime/Scripts/ROS/Unity/Publishers/ZOROSRGBDepthPublisher.cs#L196