From 48e7b941620efdac1f73fa7bcdcdd3e136a47cba Mon Sep 17 00:00:00 2001 From: Kabir Mohammed Date: Sun, 8 Jan 2017 23:55:55 +0530 Subject: [PATCH] mavlink : track time offset faster --- src/modules/mavlink/mavlink_receiver.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 6fd944a603..73d3696008 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -146,7 +146,7 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) : _offboard_control_mode{}, _att_sp{}, _rates_sp{}, - _time_offset_avg_alpha(0.6), + _time_offset_avg_alpha(0.8), _time_offset(0), _orb_class_instance(-1), _mom_switch_pos{}, @@ -2503,9 +2503,8 @@ uint64_t MavlinkReceiver::sync_stamp(uint64_t usec) void MavlinkReceiver::smooth_time_offset(int64_t offset_ns) { - /* alpha = 0.6 fixed for now. The closer alpha is to 1.0, - * the faster the moving average updates in response to - * new offset samples. + /* The closer alpha is to 1.0, the faster the moving + * average updates in response to new offset samples. */ _time_offset = (_time_offset_avg_alpha * offset_ns) + (1.0 - _time_offset_avg_alpha) * _time_offset;