Clock/Time Syncronisation

The flight controller and companion computer clocks can be syncronised using MAVLink’s SYSTEM_TIME and TIMESYNC messages. This is important so that each side can blend data from the other side into its EKF.

Mavros Configuration

Mavros’s apm_config.yaml file can be modified to configure the rate of the SYSTEM_TIME and TIMESYNC messages. Below are the recommended settings.

  timesync_rate: 10.0
  system_time_rate: 1.0

  timesync_mode: MAVLINK

ArduPilot Configuration

The flight controller’s time is set from the GPS by default but can be set from one of three sources(GPS, MAVLINK, onboard HW clock) using the BRD_RTC_TYPES parameter as a bit mask for the time syncronisation source. When using mavros set BRD_RTC_TYPES = 2 to only allow the “MAVLINK_SYSTEM_TIME” source which uses the SYSTEM_TIME MAVLINK message.

For Rover or Plane, the SCHED_LOOP_RATE parameter should be increased to 200 because mavros ignores TIMESYNC messages if the round trip time is more than 10ms. It may also be necessary to increase the update rate of the gcs related tasks in the scheduler.

For rover, open Rover.cpp and within the scheduler_tasks[] array ensure the gcs entries have their update rate set to 200 like below:

SCHED_TASK(gcs_retry_deferred,    200,    500),
SCHED_TASK(gcs_update,            200,    500),
SCHED_TASK(gcs_data_stream_send,  200,   1000),

After making this change you will need to compile rover and upload the new binary to the flight controller. Hopefully this will not be necessary in future versions of Plane or Rover.


A MAVLink inspector (available using QGC or MissionPlanner) can be used to check that the system times are syncronised. If using Mission Planner, press Ctrl-F and push the “MAVLink Inspector” button.