Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

ROS time for message headers

Discussion in 'Robotics' started by Domi47, Jun 18, 2021.

  1. Domi47

    Domi47

    Joined:
    Feb 4, 2021
    Posts:
    10
    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:
    Code (CSharp):
    1. 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.
     
  2. LaurieUnity

    LaurieUnity

    Unity Technologies

    Joined:
    Oct 23, 2020
    Posts:
    77
    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.
     
    Domi47 likes this.
  3. Domi47

    Domi47

    Joined:
    Feb 4, 2021
    Posts:
    10
  4. imlara

    imlara

    Joined:
    Jun 22, 2022
    Posts:
    1
    Hello! I'm really interested in this approach too. Does exist any implementation for this now?