mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
AP_NavEKF : Position and Velocity reset bugfix
This commit is contained in:
parent
b22dc706b2
commit
275ef86f86
@ -284,24 +284,39 @@ void NavEKF::SetStaticMode(bool setting) {
|
||||
|
||||
void NavEKF::ResetPosition(void)
|
||||
{
|
||||
// read the GPS
|
||||
readGpsData();
|
||||
// write to state vector
|
||||
states[7] = posNE[0];
|
||||
states[8] = posNE[1];
|
||||
if (staticMode) {
|
||||
states[7] = 0;
|
||||
states[8] = 0;
|
||||
} else if (_ahrs->get_gps()->status() >= GPS::GPS_OK_FIX_3D) {
|
||||
// read the GPS
|
||||
readGpsData();
|
||||
// write to state vector
|
||||
states[7] = posNE[0];
|
||||
states[8] = posNE[1];
|
||||
}
|
||||
}
|
||||
|
||||
void NavEKF::ResetVelocity(void)
|
||||
{
|
||||
// read the GPS
|
||||
readGpsData();
|
||||
// write to state vector
|
||||
if (_fusionModeGPS <= 1) {
|
||||
states[4] = velNED[0];
|
||||
states[5] = velNED[1];
|
||||
}
|
||||
if (_fusionModeGPS <= 0) {
|
||||
states[6] = velNED[2];
|
||||
if (staticMode) {
|
||||
if (_fusionModeGPS <= 1) {
|
||||
states[4] = 0;
|
||||
states[5] = 0;
|
||||
}
|
||||
if (_fusionModeGPS <= 0) {
|
||||
states[6] = 0;
|
||||
}
|
||||
} else if (_ahrs->get_gps()->status() >= GPS::GPS_OK_FIX_3D) {
|
||||
// read the GPS
|
||||
readGpsData();
|
||||
// write to state vector
|
||||
if (_fusionModeGPS <= 1) {
|
||||
states[4] = velNED[0];
|
||||
states[5] = velNED[1];
|
||||
}
|
||||
if (_fusionModeGPS <= 0) {
|
||||
states[6] = velNED[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user