Add PPS capture message to logged topics, simplify timestamp logic and small cleanup

This commit is contained in:
Michael Schaeuble
2021-12-17 07:56:08 +01:00
committed by Beat Küng
parent 5ad8b84dec
commit 064a602962
6 changed files with 12 additions and 18 deletions
@@ -193,10 +193,8 @@ CameraCapture::publish_trigger()
if (_pps_hrt_timestamp > 0) {
// Current RTC time (RTC time captured by the PPS module + elapsed time since capture)
uint64_t gps_utc_time = _pps_rtc_timestamp + hrt_elapsed_time(&_pps_hrt_timestamp);
// Current RTC time - elapsed time since capture interrupt event
trigger.timestamp_utc = gps_utc_time - hrt_elapsed_time(&trigger.timestamp);
// Last PPS RTC time + elapsed time to the camera capture interrupt
trigger.timestamp_utc = _pps_rtc_timestamp + (trigger.timestamp - _pps_hrt_timestamp);
} else {
// No PPS capture received, use RTC clock as fallback
@@ -132,8 +132,8 @@ private:
hrt_abstime _last_trig_time{0};
uint32_t _capture_overflows{0};
uint64_t _pps_hrt_timestamp{0};
uint64_t _pps_rtc_timestamp{0};
hrt_abstime _pps_hrt_timestamp{0};
uint64_t _pps_rtc_timestamp{0};
// Signal capture callback
void capture_callback(uint32_t chan_index, hrt_abstime edge_time, uint32_t edge_state, uint32_t overflow);