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
AP_Baro: Long term correction of Baro based on GPS #6228
Changes from all commits
fec0945
cadd96b
5d7105b
f9c886b
683d361
fe096c9
bcf6f0a
1a44aec
3cb4a1c
5412bea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
#include <AP_Param/AP_Param.h> | ||
#include <Filter/Filter.h> | ||
#include <Filter/DerivativeFilter.h> | ||
#include <AP_GPS/AP_GPS.h> | ||
|
||
// maximum number of sensor instances | ||
#define BARO_MAX_INSTANCES 3 | ||
|
@@ -16,6 +17,13 @@ | |
#define BARO_TIMEOUT_MS 500 // timeout in ms since last successful read | ||
#define BARO_DATA_CHANGE_TIMEOUT_MS 2000 // timeout in ms since last successful read that involved temperature of pressure changing | ||
|
||
// maximum vertical accuracy from GPS that will be accepted as baro correction (meters) | ||
#define BARO_MAX_GPS_ACCURACY 2.0f | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is very tight considering it is beyond the spec for most uncorrected L1 only chips. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange. 3 times more than a simple ublox without any correction gives. |
||
// maximum possible GPS altitude error value (meters) | ||
#define BARO_GPS_MAX_ERR 5.0f | ||
// maximum age limit of GPS fix time | ||
#define BARO_MAX_GPS_DELAY 500 | ||
|
||
class AP_Baro_Backend; | ||
|
||
class AP_Baro | ||
|
@@ -171,6 +179,9 @@ class AP_Baro | |
|
||
// set a pressure correction from AP_TempCalibration | ||
void set_pressure_correction(uint8_t instance, float p_correction); | ||
|
||
// returns GPS offset | ||
float get_gps_offset(uint8_t i) { return _gps_alt_error[i].get(); } | ||
|
||
private: | ||
// singleton | ||
|
@@ -218,6 +229,14 @@ class AP_Baro | |
uint32_t _last_notify_ms; | ||
|
||
bool _add_backend(AP_Baro_Backend *backend); | ||
|
||
bool _gps_calibrated; | ||
float _gps_calibration_altitude; | ||
LowPassFilterFloat _gps_alt_error[BARO_MAX_INSTANCES]; | ||
AP_Float _gps_adj_step; | ||
AP_Int16 _gps_adj_timeconstant; | ||
|
||
void update_gps_calibration(void); | ||
}; | ||
|
||
namespace AP { | ||
|
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 explain why we need this if the rate of change of error is already constrained by line 640? This appears to be constraining the change in error, not the absolute value as suggested by the comment.
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.
First one is actually meant to be spikes prevention and works with predefined constrain. It does limit the value that is fed into IIR.
Second limit is set by user and limits the rate of change of the output of IIR.
From your post on previous PR:
So the first constrain is doing b and second one is doing d.