-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PPS capture driver (not PPS clock synchronization) #18849
Conversation
int _channel{-1}; | ||
uint32_t _pps_capture_gpio{0}; | ||
uORB::Publication<pps_capture_s> _pps_capture_pub{ORB_ID(pps_capture)}; | ||
uORB::Subscription _sensor_gps_sub{ORB_ID(sensor_gps)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having multiple GPS units is becoming common.
#include <board_config.h> | ||
#include <parameters/param.h> | ||
|
||
#ifdef BOARD_WITH_IO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you apply #18860?
src/modules/logger/logged_topics.cpp
Outdated
@@ -172,6 +172,7 @@ void LoggedTopics::add_default_topics() | |||
add_optional_topic_multi("sensor_accel", 1000, 4); | |||
add_optional_topic_multi("sensor_baro", 1000, 4); | |||
add_topic_multi("sensor_gps", 1000, 2); | |||
add_topic("pps_capture", 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_topic("pps_capture", 1000); | |
add_optional_topic("pps_capture", 1000); |
|
||
PPSCapture::PPSCapture() : | ||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_pps_capture_pub.advertise();
(for logging)
- start pps_capture before pwm_out
… is important, since it takes over an FMU pin which can no longer be used for actuator output.
When using an FMU channel as PPS capture GPIO, the rtc_edge_time is now set as well. The delay between actual capture and callback is compensated with the elapsed time of the rtc clock.
- camera_trigger module always publishes the camera_trigger msg (independent of the camera feedback) - Use camera_trigger msg and set the feedback flag - Subscribing modules determine if the message is relevant based on the feedback message
The existing implementation has about 100ms difference to a reference clock. With the changes this error less than 25us. - Use sensor_gps messages with hrt timestamps as RTC reference and not the system realtime clock. The PPS interrupt can then be aligned with the GPS clock system. - Keep fallback based on system RTC when no PPS pulse was captured
25207a9
to
cd40816
Compare
PPS - pulse per second
RTC - real-time clock
EXTI - external interrupt
HRT - high-resolution timer
This is a driver that uses PPS from GNSS module to calculate time correction separately from the RTC. It uses GPIO EXTI as it is intended to be used at boards where is not possible to connect PPS to a pin that can capture HRT timestamp.
For boards that have an RTC clock synchronized with PPS, this driver is not needed.
This PR also brings improvements for camera capture and camera trigger.