ROS time for message headers

Hello everyone,

I’m trying to replicate a previous ROS-Gazebo simulation in Unity. By now things are going well, but I found this problem when publishing stamped messages from Unity. I don’t know how to set the header.stamp for using ROS time. Specifically I want to send a Marker and do something as the following in ROS:

marker.header.stamp = ros::Time::now();

Is it possible to do this from Unity? if so, what’s the best way?

Please let me know if it is somewhere in the documentation or tutorials.

Thank you very much.

Unfortunately we don’t yet have good support for ros time, but it’s definitely on the roadmap.
For now the simplest solution is probably to make your own subscriber that listens on the /clock topic, and remembers the last time it received.

1 Like

I, see. Thank you for the advice @LaurieUnity

Hello! I’m really interested in this approach too. Does exist any implementation for this now?