43 #include "mavlink_bridge_header.h" 46 #include <uORB/topics/timesync_status.h> 55 static constexpr time_t PX4_EPOCH_SECS = 1234567890ULL;
67 static constexpr
double ALPHA_GAIN_INITIAL = 0.05;
68 static constexpr
double BETA_GAIN_INITIAL = 0.05;
69 static constexpr
double ALPHA_GAIN_FINAL = 0.003;
70 static constexpr
double BETA_GAIN_FINAL = 0.003;
78 static constexpr uint32_t CONVERGENCE_WINDOW = 500;
90 static constexpr uint64_t MAX_RTT_SAMPLE = 10_ms;
91 static constexpr uint64_t MAX_DEVIATION_SAMPLE = 100_ms;
92 static constexpr uint32_t MAX_CONSECUTIVE_HIGH_RTT = 5;
93 static constexpr uint32_t MAX_CONSECUTIVE_HIGH_DEVIATION = 5;
103 void handle_message(
const mavlink_message_t *msg);
109 uint64_t sync_stamp(uint64_t usec);
122 void add_sample(int64_t offset_us);
128 bool sync_converged();
137 uint32_t _sequence{0};
140 double _time_offset{0};
141 double _time_skew{0};
144 double _filter_alpha{ALPHA_GAIN_INITIAL};
145 double _filter_beta{BETA_GAIN_INITIAL};
148 uint32_t _high_deviation_count{0};
149 uint32_t _high_rtt_count{0};
151 Mavlink *
const _mavlink;
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
Definition: uORB.h:134
High-resolution timer with callouts and timekeeping.
Definition: mavlink_timesync.h:97
API for the uORB lightweight object broker.
Mavlink()
Constructor.
Definition: mavlink_main.cpp:163