40 #include "generated/airframe.h"
41 #include "generated/modules.h"
43 #ifdef DEBUG_ALT_KALMAN
48 #if defined ALT_KALMAN || defined ALT_KALMAN_ENABLED
49 #warning Please remove the obsolete ALT_KALMAN and ALT_KALMAN_ENABLED defines from your airframe file.
59 PRINT_CONFIG_MSG(
"USE_BAROMETER is TRUE: Using baro for altitude estimation.")
64 #define INS_BARO_ID BARO_BOARD_SENDER_ID
66 #define INS_BARO_ID ABI_BROADCAST
78 #ifndef INS_ALT_IMU_ID
79 #define INS_ALT_IMU_ID ABI_BROADCAST
84 static void alt_kalman(
float z_meas,
float dt);
117 #ifdef GPS_USE_LATLONG
157 float dt = (float)(now_ts - last_ts) / 1e6;
161 Bound(dt, 0.002, 1.0)
205 const float dt = GPS_DT;
212 float dt = (float)(now_ts - last_ts) / 1e6;
219 float falt = gps_s->
hmsl / 1000.0f;
246 #define GPS_SIGMA2 1.
249 static float p[2][2];
273 #elif USE_BARO_MS5534A
283 #elif USE_BARO_MS5611
299 #endif // USE_BAROMETER
302 q[0][0] = dt * dt * dt * dt / 4.;
303 q[0][1] = dt * dt * dt / 2.;
304 q[1][0] = dt * dt * dt / 2.;
310 p[0][0] = p[0][0] + p[1][0] * dt + dt * (p[0][1] + p[1][1] * dt) + SIGMA2 * q[0][0];
311 p[0][1] = p[0][1] + p[1][1] * dt + SIGMA2 * q[0][1];
312 p[1][0] = p[1][0] + p[1][1] * dt + SIGMA2 * q[1][0];
313 p[1][1] = p[1][1] + SIGMA2 * q[1][1];
316 float e = p[0][0] + R;
318 if (fabs(e) > 1e-5) {
319 float k_0 = p[0][0] / e;
320 float k_1 = p[1][0] / e;
327 p[1][0] = -p[0][0] * k_1 + p[1][0];
328 p[1][1] = -p[0][1] * k_1 + p[1][1];
329 p[0][0] = p[0][0] * (1 - k_0);
330 p[0][1] = p[0][1] * (1 - k_0);
333 #ifdef DEBUG_ALT_KALMAN
346 uint32_t stamp __attribute__((unused)),
353 uint32_t stamp __attribute__((unused)),
Event structure to store callbacks in a linked list.
bool_t baro_ms5611_enabled
bool_t reset_alt_ref
flag to request reset of altitude reference to current alt
int32_t north
in centimeters
void ins_reset_local_origin(void)
Reset the geographic reference to the current GPS fix.
static void orientationSetQuat_f(struct OrientationReps *orientation, struct FloatQuat *quat)
Set vehicle body attitude from quaternion (float).
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static struct Int32RMat * orientationGetRMat_i(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (int).
Common barometric sensor implementation.
static abi_event accel_ev
static void baro_cb(uint8_t sender_id, float pressure)
float alt
in meters above WGS84 reference ellipsoid
static abi_event body_to_imu_ev
float ground_alt
size == nb_waypoint, waypoint 0 is a dummy waypoint
static void gps_cb(uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
static struct Int32RMat * stateGetNedToBodyRMat_i(void)
Get vehicle body attitude rotation matrix (int).
static void accel_cb(uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *accel)
Main include for ABI (AirBorneInterface).
static void alt_kalman_init(void)
position in UTM coordinates Units: meters
int32_t east
in centimeters
float alt
estimated altitude above MSL in meters
void ins_altf_register(void)
void ins_alt_float_update_baro(float pressure)
Ins implementation state (altitude, float)
static void body_to_imu_cb(uint8_t sender_id, struct FloatQuat *q_b2i_f)
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over ellipsoid)
static uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
static void stateSetPositionUtm_f(struct UtmCoor_f *utm_pos)
Set position from UTM coordinates (float).
static void stateSetAccelNed_i(struct NedCoor_i *ned_accel)
Set acceleration in NED coordinates (int).
uint8_t zone
UTM zone number.
vector in Latitude, Longitude and Altitude
static void stateSetSpeedNed_f(struct NedCoor_f *ned_speed)
Set ground speed in local NED coordinates (float).
static void orientationSetEulers_i(struct OrientationReps *orientation, struct Int32Eulers *eulers)
Set vehicle body attitude from euler angles (int).
static void alt_kalman(float z_meas, float dt)
struct InsAltFloat ins_altf
int32_t hmsl
height above mean sea level in mm
vector in North East Down coordinates Units: meters
void ins_alt_float_update_gps(struct GpsState *gps_s)
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Architecture independent timing functions.
data structure for GPS information
void ins_alt_float_init(void)
Device independent GPS code (interface)
Paparazzi atmospheric pressure conversion utilities.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
int32_t lon
in degrees*1e7
uint8_t zone
UTM zone number.
float baro_MS5534A_sigma2
struct UtmCoor_f utm_origin_f
Definition of the origin of Utm coordinate system.
bool_t baro_amsys_enabled
#define DefaultChannel
SITL.
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
API to get/set the generic vehicle states.
vector in North East Down coordinates
void int32_rmat_transp_vmult(struct Int32Vect3 *vb, struct Int32RMat *m_b2a, struct Int32Vect3 *va)
rotate 3D vector by transposed rotation matrix.
Common code for AP and FBW telemetry.
float alt_dot
estimated vertical speed in m/s (positive-up)
#define ABI_BROADCAST
Broadcast address.
static struct OrientationReps body_to_imu
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
Filters altitude and climb rate for fixedwings.
static float pprz_isa_height_of_pressure(float pressure, float ref_p)
Get relative altitude from pressure (using simplified equation).
#define ACCEL_BFP_OF_REAL(_af)
Fixedwing Navigation library.
static void alt_kalman_reset(void)
void ins_register_impl(InsInit init)
struct NedCoor_i ned_vel
speed NED in cm/s
void ins_reset_altitude_ref(void)
INS altitude reference reset.
static void stateSetLocalUtmOrigin_f(struct UtmCoor_f *utm_def)
Set the local (flat earth) coordinate frame origin from UTM (float).
struct GpsState gps
global GPS state
#define LLA_FLOAT_OF_BFP(_o, _i)
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
#define UTM_COPY(_u1, _u2)