Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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?