2011-12-14 08:54:06 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
2013-05-19 16:37:30 +02:00
|
|
|
* @addtogroup AHRS
|
2011-12-14 08:54:06 +01:00
|
|
|
* @{
|
|
|
|
* @addtogroup INSGPS
|
|
|
|
* @{
|
|
|
|
* @brief INSGPS is a joint attitude and position estimation EKF
|
|
|
|
*
|
|
|
|
* @file insgps.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @brief Include file of the INSGPS exposed functionality.
|
|
|
|
*
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSGPS_H_
|
|
|
|
#define INSGPS_H_
|
|
|
|
|
|
|
|
#include "stdint.h"
|
|
|
|
|
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* @addtogroup Constants
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#define POS_SENSORS 0x007
|
2012-02-28 07:42:18 +01:00
|
|
|
#define HORIZ_POS_SENSORS 0x003
|
2013-05-19 16:37:30 +02:00
|
|
|
#define VER_POS_SENSORS 0x004
|
|
|
|
#define HORIZ_SENSORS 0x018
|
|
|
|
#define VERT_SENSORS 0x020
|
|
|
|
#define MAG_SENSORS 0x1C0
|
|
|
|
#define BARO_SENSOR 0x200
|
2011-12-14 08:54:06 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
#define FULL_SENSORS 0x3FF
|
2011-12-14 08:54:06 +01:00
|
|
|
|
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2011-12-14 08:54:06 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// Exposed Function Prototypes
|
2011-12-14 08:54:06 +01:00
|
|
|
void INSGPSInit();
|
|
|
|
void INSStatePrediction(float gyro_data[3], float accel_data[3], float dT);
|
|
|
|
void INSCovariancePrediction(float dT);
|
|
|
|
void INSCorrection(float mag_data[3], float Pos[3], float Vel[3], float BaroAlt, uint16_t SensorsUsed);
|
|
|
|
|
|
|
|
void INSResetP(float PDiag[13]);
|
2013-04-28 19:38:37 +02:00
|
|
|
void INSGetP(float PDiag[13]);
|
2011-12-14 08:54:06 +01:00
|
|
|
void INSSetState(float pos[3], float vel[3], float q[4], float gyro_bias[3], float accel_bias[3]);
|
2013-05-03 02:17:44 +02:00
|
|
|
void INSSetPosVelVar(float PosVar[3], float VelVar[3]);
|
2011-12-14 08:54:06 +01:00
|
|
|
void INSSetGyroBias(float gyro_bias[3]);
|
|
|
|
void INSSetAccelVar(float accel_var[3]);
|
|
|
|
void INSSetGyroVar(float gyro_var[3]);
|
2013-04-28 16:37:12 +02:00
|
|
|
void INSSetGyroBiasVar(float gyro_bias_var[3]);
|
2011-12-14 08:54:06 +01:00
|
|
|
void INSSetMagNorth(float B[3]);
|
|
|
|
void INSSetMagVar(float scaled_mag_var[3]);
|
2012-04-07 07:37:42 +02:00
|
|
|
void INSSetBaroVar(float baro_var);
|
2011-12-14 08:54:06 +01:00
|
|
|
void INSPosVelReset(float pos[3], float vel[3]);
|
|
|
|
|
|
|
|
void MagCorrection(float mag_data[3]);
|
|
|
|
void MagVelBaroCorrection(float mag_data[3], float Vel[3], float BaroAlt);
|
|
|
|
void FullCorrection(float mag_data[3], float Pos[3], float Vel[3],
|
2013-05-19 16:37:30 +02:00
|
|
|
float BaroAlt);
|
2011-12-14 08:54:06 +01:00
|
|
|
void GpsBaroCorrection(float Pos[3], float Vel[3], float BaroAlt);
|
|
|
|
void GpsMagCorrection(float mag_data[3], float Pos[3], float Vel[2]);
|
|
|
|
void VelBaroCorrection(float Vel[3], float BaroAlt);
|
|
|
|
|
|
|
|
uint16_t ins_get_num_states();
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// Nav structure containing current solution
|
2013-03-17 12:17:48 +01:00
|
|
|
extern struct NavStruct {
|
2013-05-19 16:37:30 +02:00
|
|
|
float Pos[3]; // Position in meters and relative to a local NED frame
|
|
|
|
float Vel[3]; // Velocity in meters and in NED
|
|
|
|
float q[4]; // unit quaternion rotation relative to NED
|
|
|
|
float gyro_bias[3];
|
|
|
|
float accel_bias[3];
|
2011-12-14 08:54:06 +01:00
|
|
|
} Nav;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif /* EKF_H_ */
|