|
54 | 54 |
|
55 | 55 | navigationPosEstimator_t posEstimator;
|
56 | 56 |
|
57 |
| -PG_REGISTER_WITH_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig, PG_POSITION_ESTIMATION_CONFIG, 4); |
| 57 | +PG_REGISTER_WITH_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig, PG_POSITION_ESTIMATION_CONFIG, 5); |
58 | 58 |
|
59 | 59 | PG_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig,
|
60 | 60 | // Inertial position estimator parameters
|
61 | 61 | .automatic_mag_declination = 1,
|
62 | 62 | .reset_altitude_type = NAV_RESET_ON_FIRST_ARM,
|
63 | 63 | .reset_home_type = NAV_RESET_ON_FIRST_ARM,
|
64 | 64 | .gravity_calibration_tolerance = 5, // 5 cm/s/s calibration error accepted (0.5% of gravity)
|
65 |
| - .use_gps_velned = 1, // "Disabled" is mandatory with gps_dyn_model = Pedestrian |
| 65 | + .use_gps_velned = 1, // "Disabled" is mandatory with gps_dyn_model = Pedestrian |
| 66 | + .use_gps_no_baro = 0, // Use GPS altitude if no baro is available on all aircrafts |
66 | 67 | .allow_dead_reckoning = 0,
|
67 | 68 |
|
68 | 69 | .max_surface_altitude = 200,
|
@@ -581,7 +582,7 @@ static bool estimationCalculateCorrection_Z(estimationContext_t * ctx)
|
581 | 582 |
|
582 | 583 | return true;
|
583 | 584 | }
|
584 |
| - else if (STATE(FIXED_WING_LEGACY) && (ctx->newFlags & EST_GPS_Z_VALID)) { |
| 585 | + else if ((STATE(FIXED_WING_LEGACY) || positionEstimationConfig()->use_gps_no_baro) && (ctx->newFlags & EST_GPS_Z_VALID)) { |
585 | 586 | // If baro is not available - use GPS Z for correction on a plane
|
586 | 587 | // Reset current estimate to GPS altitude if estimate not valid
|
587 | 588 | if (!(ctx->newFlags & EST_Z_VALID)) {
|
|
0 commit comments