FAQ: How to Synchronize Timing Between Sensors/Topics?
For various sensor fusion application the need may come up to synchronize timing from novatel_oem7_driver ROS topics with other ROS topics.
The timestamp provided in the header of the ROS topics is the time that the topic is published. This will include latency due to factors including the latency introduced from the communication protocol itself.
Synchronize with GPS Time Stamps (Preferred Option)
Important
It is recommended to use the GPS timestamps reported in the topics instead of the timestamp in the ROS Header.
These GPS timestamps are generated by the receiver and are a much closer reflection of the exact moment the data was valid, independent of latency.
Most of the custom NovAtel topics have a gps_week_milliseconds field in Oem7Header with some having additional timing fields.
For example /novatel/oem7/rawimusx
has a GPS timestamp and can be used as an alternative to /novatel/oem7/imu/data_raw
.
Likewise, you may want to use the topic /novatel/oem7/inspva
instead of /novatel/oem7/gps
, /novatel/oem7/fix
or novatel/oem7/odom
. You would then look at the fields:
/novatel/oem7/inspvax/nov_header/gps_week_number
/novatel/oem7/inspvax/nov_header/gps_week_milliseconds
For additional synchronization, consider aligning system time with GNSS time using an event-out pulse or a similar mechanism. Many receiver models offer both a PPS (pulse per second) and PTP (precision timing protocol) options to use for system time synchronization.
Reduce Latency
If using the GPS time stamps are not possible, then minimizing latency is the next best option but it may produce non ideal results.
To minimize latency, using USB or a high serial baud rate is preferred compared to a TCP/UDP connection.
If you are communicating over TCP/UDP, a solution may exist to reduce latency (but not remove it). However, this solution does not apply to all users and when used incorrectly, user may achieve adverse results. Therefore it is not posted online. To see if this solution is applicable, please send a message to support.novatel@hexagon.com and reference ROS GitHub Issue #74.