81 #define POS_LOCAL_COORD ((1<<POS_NED_I)|(1<<POS_NED_F)|(1<<POS_ENU_I)|(1<<POS_ENU_F))
82 #define POS_GLOBAL_COORD ((1<<POS_ECEF_I)|(1<<POS_ECEF_F)|(1<<POS_LLA_I)|(1<<POS_LLA_F)|(1<<POS_UTM_I)|(1<<POS_UTM_F))
89 #define SPEED_ECEF_I 0
92 #define SPEED_HNORM_I 3
93 #define SPEED_HDIR_I 4
94 #define SPEED_ECEF_F 5
97 #define SPEED_HNORM_F 8
98 #define SPEED_HDIR_F 9
99 #define SPEED_LOCAL_COORD ((1<<SPEED_NED_I)|(1<<SPEED_ENU_I)|(1<<SPEED_NED_F)|(1<<SPEED_ENU_F))
106 #define ACCEL_ECEF_I 0
107 #define ACCEL_NED_I 1
108 #define ACCEL_ECEF_F 2
109 #define ACCEL_NED_F 3
124 #define WINDSPEED_I 0
127 #define WINDSPEED_F 3
138 #define STATE_INPUT_DISABLE 0
139 #define STATE_INPUT_ANY 0xFFFF
140 #define STATE_INPUT_ORIGIN 1
141 #define STATE_INPUT_POS 2
142 #define STATE_INPUT_SPEED 3
143 #define STATE_INPUT_ACCEL 4
144 #define STATE_INPUT_ATTITUDE 5
145 #define STATE_INPUT_RATES 6
146 #define STATE_INPUT_WIND_AIR 7
513 #define STATE_CHECK_INPUT_AND_RETURN(flag, id) if (flag==STATE_INPUT_DISABLE || !(flag==STATE_INPUT_ANY || flag==id)) { return; }
679 if (ecef_pos != NULL) {
683 if (ned_pos != NULL) {
687 if (enu_pos != NULL) {
691 if (lla_pos != NULL) {
760 if (ecef_pos != NULL) {
764 if (ned_pos != NULL) {
768 if (enu_pos != NULL) {
772 if (lla_pos != NULL) {
776 if (utm_pos != NULL) {
932 if (ecef_speed != NULL) {
936 if (ned_speed != NULL) {
940 if (enu_speed != NULL) {
987 if (ecef_speed != NULL) {
991 if (ned_speed != NULL) {
995 if (enu_speed != NULL) {
static struct LtpDef_i ltp_def
#define RATES_COPY(_a, _b)
#define VECT2_COPY(_a, _b)
#define VECT3_COPY(_a, _b)
#define LLA_COPY(_pos1, _pos2)
struct Int32RMat ltp_of_ecef
Rotation matrix.
int32_t hmsl
Height above mean sea level in mm.
struct LlaCoor_i lla
Reference point in lla.
struct EcefCoor_i ecef
Reference point in ecef.
#define ECEF_FLOAT_OF_BFP(_o, _i)
#define HIGH_RES_RMAT_FLOAT_OF_BFP(_ef, _ei)
#define LLA_FLOAT_OF_BFP(_o, _i)
vector in EarthCenteredEarthFixed coordinates
vector in East North Up coordinates
vector in Latitude, Longitude and Altitude
definition of the local (flat earth) coordinate system
vector in North East Down coordinates
static void orientationSetRMat_f(struct OrientationReps *orientation, struct FloatRMat *rmat)
Set vehicle body attitude from rotation matrix (float).
static void orientationSetQuat_f(struct OrientationReps *orientation, struct FloatQuat *quat)
Set vehicle body attitude from quaternion (float).
static struct FloatQuat * orientationGetQuat_f(struct OrientationReps *orientation)
Get vehicle body attitude quaternion (float).
static struct Int32RMat * orientationGetRMat_i(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (int).
static bool orienationCheckValid(struct OrientationReps *orientation)
Test if orientations are valid.
static void orientationSetEulers_f(struct OrientationReps *orientation, struct FloatEulers *eulers)
Set vehicle body attitude from euler angles (float).
static struct Int32Quat * orientationGetQuat_i(struct OrientationReps *orientation)
Get vehicle body attitude quaternion (int).
static void orientationSetQuat_i(struct OrientationReps *orientation, struct Int32Quat *quat)
Set vehicle body attitude from quaternion (int).
static void orientationSetEulers_i(struct OrientationReps *orientation, struct Int32Eulers *eulers)
Set vehicle body attitude from euler angles (int).
static struct FloatEulers * orientationGetEulers_f(struct OrientationReps *orientation)
Get vehicle body attitude euler angles (float).
static void orientationSetRMat_i(struct OrientationReps *orientation, struct Int32RMat *rmat)
Set vehicle body attitude from rotation matrix (int).
static struct FloatRMat * orientationGetRMat_f(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (float).
static struct Int32Eulers * orientationGetEulers_i(struct OrientationReps *orientation)
Get vehicle body attitude euler angles (int).
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
static void stateSetAccelNed_i(uint16_t id, struct NedCoor_i *ned_accel)
Set acceleration in NED coordinates (int).
struct EcefCoor_f ecef_accel_f
Acceleration in EarthCenteredEarthFixed coordinates.
struct Int32Vect3 body_accel_i
Acceleration in Body coordinates.
struct NedCoor_i ned_accel_i
Acceleration in North East Down coordinates.
static struct EcefCoor_f * stateGetAccelEcef_f(void)
Get acceleration in ECEF coordinates (float).
uint8_t accel_status
Holds the status bits for all acceleration representations.
void stateCalcAccelNed_i(void)
void stateCalcAccelEcef_i(void)
struct EcefCoor_i ecef_accel_i
Acceleration in EarthCenteredEarthFixed coordinates.
static void stateSetAccelEcef_f(uint16_t id, struct EcefCoor_f *ecef_accel)
Set acceleration in ECEF coordinates (float).
static bool stateIsAccelValid(void)
Test if accelerations are valid.
void stateCalcAccelEcef_f(void)
uint16_t accel_input_filter
Holds the input filter id for acceleration.
static void stateSetAccelNed_f(uint16_t id, struct NedCoor_f *ned_accel)
Set acceleration in NED coordinates (float).
static void stateSetAccelEcef_i(uint16_t id, struct EcefCoor_i *ecef_accel)
Set acceleration in ECEF coordinates (int).
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
static struct EcefCoor_i * stateGetAccelEcef_i(void)
Get acceleration in ECEF coordinates (int).
struct NedCoor_f ned_accel_f
Acceleration in North East Down coordinates.
static void stateSetAccelBody_i(uint16_t id, struct Int32Vect3 *body_accel)
Set acceleration in Body coordinates (int).
void stateCalcAccelNed_f(void)
static struct Int32Quat * stateGetNedToBodyQuat_i(void)
Get vehicle body attitude quaternion (int).
static void stateSetNedToBodyQuat_f(uint16_t id, struct FloatQuat *ned_to_body_quat)
Set vehicle body attitude from quaternion (float).
static void stateSetNedToBodyQuat_i(uint16_t id, struct Int32Quat *ned_to_body_quat)
Set vehicle body attitude from quaternion (int).
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
static bool stateIsAttitudeValid(void)
Test if attitudes are valid.
static void stateSetNedToBodyEulers_f(uint16_t id, struct FloatEulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (float).
static struct FloatRMat * stateGetNedToBodyRMat_f(void)
Get vehicle body attitude rotation matrix (float).
static struct Int32RMat * stateGetNedToBodyRMat_i(void)
Get vehicle body attitude rotation matrix (int).
static void stateSetNedToBodyEulers_i(uint16_t id, struct Int32Eulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (int).
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static void stateSetNedToBodyRMat_f(uint16_t id, struct FloatRMat *ned_to_body_rmat)
Set vehicle body attitude from rotation matrix (float).
static void stateSetNedToBodyRMat_i(uint16_t id, struct Int32RMat *ned_to_body_rmat)
Set vehicle body attitude from rotation matrix (int).
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
uint16_t attitude_input_filter
Holds the input filter id for attitude.
struct OrientationReps ned_to_body_orientation
#define STATE_CHECK_INPUT_AND_RETURN(flag, id)
Helper macro to check input filter and return if not valid input id.
void stateSetInputFilter(uint8_t type, uint16_t flag)
set the input filter for a specified type of data.
Structure holding vehicle state data.
struct NedCoor_i ned_pos_i
Position in North East Down coordinates.
static void stateSetPositionLla_f(uint16_t id, struct LlaCoor_f *lla_pos)
Set position from LLA coordinates (float).
static struct UtmCoor_f * stateGetUtmOrigin_f(void)
Get the coordinate UTM frame origin (int)
static void stateSetPositionNed_f(uint16_t id, struct NedCoor_f *ned_pos)
Set position from local NED coordinates (float).
struct NedCoor_f ned_pos_f
Position in North East Down coordinates.
struct EnuCoor_f enu_pos_f
Position in East North Up coordinates.
struct UtmCoor_f utm_pos_f
Position in UTM coordinates.
static void stateSetLocalOrigin_i(uint16_t id, struct LtpDef_i *ltp_def)
Set the local (flat earth) coordinate frame origin (int).
void stateCalcPositionNed_f(void)
static void stateSetPositionEnu_i(uint16_t id, struct EnuCoor_i *enu_pos)
Set position from local ENU coordinates (int).
static void stateSetPosition_f(uint16_t id, struct EcefCoor_f *ecef_pos, struct NedCoor_f *ned_pos, struct EnuCoor_f *enu_pos, struct LlaCoor_f *lla_pos, struct UtmCoor_f *utm_pos)
Set multiple position coordinates (float).
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
struct LtpDef_f ned_origin_f
Definition of the local (flat earth) coordinate system.
struct LtpDef_i ned_origin_i
Definition of the local (flat earth) coordinate system.
static struct LtpDef_f * stateGetNedOrigin_f(void)
Get the coordinate NED frame origin (float)
bool ned_initialized_f
True if local float coordinate frame is initialsed.
struct EcefCoor_f stateGetEcefOrigin_f(void)
Get the ECEF position of the frame origin (float)
uint16_t pos_status
Holds the status bits for all position representations.
struct LlaCoor_i lla_pos_i
Position in Latitude, Longitude and Altitude.
void stateCalcPositionUtm_f(void)
static void stateSetPositionEnu_f(uint16_t id, struct EnuCoor_f *enu_pos)
Set position from local ENU coordinates (float).
void stateCalcPositionEnu_f(void)
struct EcefCoor_f ecef_pos_f
Position in EarthCenteredEarthFixed coordinates.
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
static void stateSetPositionUtm_f(uint16_t id, struct UtmCoor_f *utm_pos)
Set position from UTM coordinates (float).
static struct EcefCoor_i * stateGetPositionEcef_i(void)
Get position in ECEF coordinates (int).
bool utm_initialized_f
True if utm origin (float) coordinate frame is initialsed.
uint16_t origin_input_filter
Holds the input filter id for state origin.
void stateCalcPositionEcef_f(void)
struct EnuCoor_i enu_pos_i
Position in East North Up coordinates.
static struct LlaCoor_i * stateGetPositionLla_i(void)
Get position in LLA coordinates (int).
bool ned_initialized_i
true if local int coordinate frame is initialsed
static void stateSetPositionEcef_f(uint16_t id, struct EcefCoor_f *ecef_pos)
Set position from ECEF coordinates (float).
static bool stateIsGlobalCoordinateValid(void)
Test if global coordinates are valid.
float alt_agl_f
Altitude above ground level.
void stateCalcPositionLla_f(void)
static struct LtpDef_i * stateGetNedOrigin_i(void)
Get the coordinate NED frame origin (int)
int32_t stateGetHmslOrigin_i(void)
Get the HMSL of the frame origin (int)
static void stateSetLocalUtmOrigin_f(uint16_t id, struct UtmCoor_f *utm_def)
Set the local (flat earth) coordinate frame origin from UTM (float).
void stateCalcPositionEcef_i(void)
static void stateSetPositionEcef_i(uint16_t id, struct EcefCoor_i *ecef_pos)
Set position from ECEF coordinates (int).
float stateGetHmslOrigin_f(void)
Get the HMSL of the frame origin (float)
struct UtmCoor_f utm_origin_f
Definition of the origin of Utm coordinate system.
static struct EcefCoor_f * stateGetPositionEcef_f(void)
Get position in ECEF coordinates (float).
static struct LlaCoor_f * stateGetPositionLla_f(void)
Get position in LLA coordinates (float).
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
struct LlaCoor_i stateGetLlaOrigin_i(void)
Get the LLA position of the frame origin (int)
void stateCalcPositionNed_i(void)
void stateCalcPositionLla_i(void)
Calculate LLA (int) from any other available representation.
static bool stateIsLocalCoordinateValid(void)
Test if local coordinates are valid.
struct LlaCoor_f stateGetLlaOrigin_f(void)
Get the LLA position of the frame origin (float)
static void stateSetPositionLla_i(uint16_t id, struct LlaCoor_i *lla_pos)
Set position from LLA coordinates (int).
struct LlaCoor_f lla_pos_f
Position in Latitude, Longitude and Altitude.
static void stateSetPosition_i(uint16_t id, struct EcefCoor_i *ecef_pos, struct NedCoor_i *ned_pos, struct EnuCoor_i *enu_pos, struct LlaCoor_i *lla_pos)
Set multiple position coordinates (int).
uint16_t pos_input_filter
Holds the input filter id for position.
struct EcefCoor_i ecef_pos_i
Position in EarthCenteredEarthFixed coordinates.
static struct EnuCoor_i * stateGetPositionEnu_i(void)
Get position in local ENU coordinates (int).
static void stateSetPositionNed_i(uint16_t id, struct NedCoor_i *ned_pos)
Set position from local NED coordinates (int).
struct EcefCoor_i stateGetEcefOrigin_i(void)
Get the ECEF position of the frame origin (int)
void stateCalcPositionEnu_i(void)
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
uint16_t rates_input_filter
Holds the input filter id for rates.
static struct Int32Rates * stateGetBodyRates_i(void)
Get vehicle body angular rate (int).
static void stateSetBodyRates_i(uint16_t id, struct Int32Rates *body_rate)
Set vehicle body angular rate (int).
void stateCalcBodyRates_f(void)
struct FloatRates body_rates_f
Angular rates in body frame.
void stateCalcBodyRates_i(void)
static void stateSetBodyRates_f(uint16_t id, struct FloatRates *body_rate)
Set vehicle body angular rate (float).
struct Int32Rates body_rates_i
Angular rates in body frame.
uint8_t rate_status
Holds the status bits for all angular rate representations.
static bool stateIsRateValid(void)
Test if rates are valid.
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
static struct EnuCoor_i * stateGetSpeedEnu_i(void)
Get ground speed in local ENU coordinates (int).
static void stateSetSpeedEcef_f(uint16_t id, struct EcefCoor_f *ecef_speed)
Set ground speed in ECEF coordinates (float).
static void stateSetSpeedNed_f(uint16_t id, struct NedCoor_f *ned_speed)
Set ground speed in local NED coordinates (float).
void stateCalcSpeedEnu_f(void)
struct NedCoor_f ned_speed_f
speed in North East Down coordinates
static void stateSetSpeedNed_i(uint16_t id, struct NedCoor_i *ned_speed)
Set ground speed in local NED coordinates (int).
static void stateSetSpeedEcef_i(uint16_t id, struct EcefCoor_i *ecef_speed)
Set ground speed in ECEF coordinates (int).
void stateCalcSpeedNed_f(void)
uint16_t speed_input_filter
Holds the input filter id for speed.
static void stateSetSpeed_f(uint16_t id, struct EcefCoor_f *ecef_speed, struct NedCoor_f *ned_speed, struct EnuCoor_f *enu_speed)
Set multiple speed coordinates (float).
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
static void stateSetSpeedEnu_f(uint16_t id, struct EnuCoor_f *enu_speed)
Set ground speed in local ENU coordinates (float).
void stateCalcHorizontalSpeedDir_i(void)
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
struct NedCoor_i ned_speed_i
Velocity in North East Down coordinates.
float h_speed_norm_f
Norm of horizontal ground speed.
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
int32_t h_speed_dir_i
Direction of horizontal ground speed.
float h_speed_dir_f
Direction of horizontal ground speed.
void stateCalcHorizontalSpeedNorm_f(void)
void stateCalcHorizontalSpeedNorm_i(void)
#define SPEED_LOCAL_COORD
static int32_t stateGetHorizontalSpeedDir_i(void)
Get dir of horizontal ground speed (int).
struct EcefCoor_f ecef_speed_f
Velocity in EarthCenteredEarthFixed coordinates.
void stateCalcSpeedEcef_f(void)
void stateCalcSpeedEnu_i(void)
struct EcefCoor_i ecef_speed_i
Velocity in EarthCenteredEarthFixed coordinates.
static struct EcefCoor_i * stateGetSpeedEcef_i(void)
Get ground speed in ECEF coordinates (int).
void stateCalcHorizontalSpeedDir_f(void)
struct EnuCoor_i enu_speed_i
Velocity in East North Up coordinates.
uint16_t speed_status
Holds the status bits for all ground speed representations.
static struct EcefCoor_f * stateGetSpeedEcef_f(void)
Get ground speed in ECEF coordinates (float).
static void stateSetSpeedEnu_i(uint16_t id, struct EnuCoor_i *enu_speed)
Set ground speed in local ENU coordinates (int).
static void stateSetSpeed_i(uint16_t id, struct EcefCoor_i *ecef_speed, struct NedCoor_i *ned_speed, struct EnuCoor_i *enu_speed)
Set multiple speed coordinates (int).
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
void stateCalcSpeedNed_i(void)
static struct Int32Vect3 * stateGetAccelBody_i(void)
Get acceleration in Body coordinates (int).
uint32_t h_speed_norm_i
Norm of horizontal ground speed.
static uint32_t stateGetHorizontalSpeedNorm_i(void)
Get norm of horizontal ground speed (int).
struct EnuCoor_f enu_speed_f
Velocity in East North Up coordinates.
void stateCalcSpeedEcef_i(void)
static bool stateIsSideslipValid(void)
test if sideslip is available.
static void stateSetAngleOfAttack_f(uint16_t id, float aoa)
Set angle of attack in radians (float).
static struct Int32Vect3 * stateGetWindspeed_i(void)
Get windspeed (int).
static bool stateIsWindspeedValid(void)
test if wind speed is available.
static void stateSetSideslip_f(uint16_t id, float sideslip)
Set sideslip angle in radians (float).
int32_t airspeed_i
Norm of relative wind speed.
static struct Int32Vect2 * stateGetHorizontalWindspeed_i(void)
Get horizontal windspeed (int).
static float stateGetSideslip_f(void)
Get sideslip (float).
union State::@356 windspeed_f
Horizontal windspeed.
float airspeed_f
Norm of relative air speed.
static void stateSetVerticalWindspeed_f(uint16_t id, float v_windspeed)
Set vertical windspeed (float).
static bool stateIsAirspeedValid(void)
test if air speed is available.
uint8_t wind_air_status
Holds the status bits for all wind- and airspeed representations.
static void stateSetVerticalWindspeed_i(uint16_t id, int32_t v_windspeed)
Set vertical windspeed (int).
static void stateSetAirspeed_i(uint16_t id, int32_t airspeed)
Set airspeed (int).
void stateCalcAirspeed_i(void)
static void stateSetHorizontalWindspeed_i(uint16_t id, struct Int32Vect2 *h_windspeed)
Set horizontal windspeed (int).
void stateCalcVerticalWindspeed_i(void)
static float stateGetAirspeed_f(void)
Get airspeed (float).
static float stateGetVerticalWindspeed_i(void)
Get vertical windspeed (int).
static float stateGetAngleOfAttack_f(void)
Get angle of attack (float).
void stateCalcAirspeed_f(void)
float sideslip_f
Sideslip angle Unit: rad.
uint16_t wind_air_input_filter
Holds the input filter id for air data.
void stateCalcHorizontalWindspeed_f(void)
static float stateGetVerticalWindspeed_f(void)
Get vertical windspeed (float).
static int32_t stateGetAirspeed_i(void)
Get airspeed (int).
static void stateSetHorizontalWindspeed_f(uint16_t id, struct FloatVect2 *h_windspeed)
Set horizontal windspeed (float).
void stateCalcHorizontalWindspeed_i(void)
float angle_of_attack_f
Angle of attack Unit: rad.
union State::@355 windspeed_i
Horizontal windspeed in north/east/down.
static bool stateIsAngleOfAttackValid(void)
test if angle of attack is available.
static void stateSetAirspeed_f(uint16_t id, float airspeed)
Set airspeed (float).
void stateCalcVerticalWindspeed_f(void)
static struct FloatVect3 * stateGetWindspeed_f(void)
Get windspeed (float).
static bool stateIsVerticalWindspeedValid(void)
test if vertical wind speed is available.
static struct FloatVect2 * stateGetHorizontalWindspeed_f(void)
Get horizontal windspeed (float).
Paparazzi floating point algebra.
Paparazzi fixed point algebra.
Paparazzi floating point math for geodetic calculations.
float hmsl
Height above mean sea level in meters.
struct FloatRMat ltp_of_ecef
rotation from ECEF to local frame
struct EcefCoor_f ecef
origin of local frame in ECEF
struct LlaCoor_f lla
origin of local frame in LLA
vector in EarthCenteredEarthFixed coordinates
vector in East North Up coordinates Units: meters
vector in Latitude, Longitude and Altitude
definition of the local (flat earth) coordinate system
vector in North East Down coordinates Units: meters
position in UTM coordinates Units: meters
Paparazzi fixed point math for geodetic calculations.
Generic orientation representation and conversions.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.