1
$\begingroup$

I am using a the eProsima Micro-XRCE-DDS agent (https://github.com/eProsima/Micro-XRCE-DDS-Agent) to send messages between my ROS2 application and the PX4 Autopilot (https://github.com/PX4/PX4-Autopilot).

I have a problem with the messages timestamp when I work on the Gazebo simulator. In particular, all the of my nodes use the simulation time provided by Gazebo trough the /clock topic (i.e. I set the use_sim_time parameter to true on all the running nodes), while the Micro-XRCE-DDS Agent publishes the messages read from the Client with the SystemTime timestamps.

Is there a way to set up the Micro-XRCE-DDS Agent so that it publishes the messages using the simulation time too?

P.S. For now, the only solution I came up with was to create an additional nodes that just subscribes to the topics I need to read from the DDS Client and republishes the messages on separate topics with the correct timestamps, but it seems to me an unnecessary additional step.

$\endgroup$

1 Answer 1

1
$\begingroup$

As there is no answer for over 4 months I will provide some approaches:

  • Is it required that use_sim_time is set to true? Why not using SystemTime as well?
  • Otherwise why do you need the timestamps at all? As far as I know manual timestamps and doing time sync is no longer required for Micro-XRCE-DDS
  • However the migration quideline offers the following python command to sync timestamps: msg.timestamp = int(self.get_clock().now().nanoseconds / 1000)
  • Additionally UXRCE-DDS Client Parameter UXRCE_DDS_SYNCT might be interesting for you
$\endgroup$
1
  • $\begingroup$ Hi, thanks for the answer. To answer your questions: I needed the timestamp because I was using a time synchronizer to start a callback (it is a type of message filter). So, when reading topics from the the PX4 trough the MicroDDS bridge, I got timestamps that were not synchronized with the topics of my application and the callback could not be called. Anyway, I am still using the additional node to read topics from the PX4 and "synchronize" them with the time stamps of the external computer whenever I need it. $\endgroup$ Commented Mar 18 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.