Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
state.h File Reference

API to get/set the generic vehicle states. More...

#include "math/pprz_algebra_int.h"
#include "math/pprz_algebra_float.h"
#include "math/pprz_geodetic_int.h"
#include "math/pprz_geodetic_float.h"
#include "math/pprz_orientation_conversion.h"
#include "std.h"
#include <string.h>
+ Include dependency graph for state.h:

Go to the source code of this file.

Data Structures

struct  State
 Structure holding vehicle state data. More...
 
union  State.windspeed_i
 Horizontal windspeed in north/east/down. More...
 
union  State.windspeed_f
 Horizontal windspeed. More...
 

Macros

#define POS_ECEF_I   0
 
#define POS_NED_I   1
 
#define POS_ENU_I   2
 
#define POS_LLA_I   3
 
#define POS_UTM_I   4
 
#define POS_ECEF_F   5
 
#define POS_NED_F   6
 
#define POS_ENU_F   7
 
#define POS_LLA_F   8
 
#define POS_UTM_F   9
 
#define POS_LOCAL_COORD   ((1<<POS_NED_I)|(1<<POS_NED_F)|(1<<POS_ENU_I)|(1<<POS_ENU_F))
 
#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))
 
#define SPEED_ECEF_I   0
 
#define SPEED_NED_I   1
 
#define SPEED_ENU_I   2
 
#define SPEED_HNORM_I   3
 
#define SPEED_HDIR_I   4
 
#define SPEED_ECEF_F   5
 
#define SPEED_NED_F   6
 
#define SPEED_ENU_F   7
 
#define SPEED_HNORM_F   8
 
#define SPEED_HDIR_F   9
 
#define SPEED_LOCAL_COORD   ((1<<SPEED_NED_I)|(1<<SPEED_ENU_I)|(1<<SPEED_NED_F)|(1<<SPEED_ENU_F))
 
#define ACCEL_ECEF_I   0
 
#define ACCEL_NED_I   1
 
#define ACCEL_ECEF_F   2
 
#define ACCEL_NED_F   3
 
#define RATE_I   0
 
#define RATE_F   1
 
#define WINDSPEED_I   0
 
#define DOWNWIND_I   1
 
#define AIRSPEED_I   2
 
#define WINDSPEED_F   3
 
#define DOWNWIND_F   4
 
#define AIRSPEED_F   5
 
#define AOA_F   6
 
#define SIDESLIP_F   7
 
#define STATE_INPUT_DISABLE   0
 use with care More...
 
#define STATE_INPUT_ANY   0xFFFF
 default More...
 
#define STATE_INPUT_ORIGIN   1
 
#define STATE_INPUT_POS   2
 
#define STATE_INPUT_SPEED   3
 
#define STATE_INPUT_ACCEL   4
 
#define STATE_INPUT_ATTITUDE   5
 
#define STATE_INPUT_RATES   6
 
#define STATE_INPUT_WIND_AIR   7
 
#define STATE_CHECK_INPUT_AND_RETURN(flag, id)   if (flag==STATE_INPUT_DISABLE || !(flag==STATE_INPUT_ANY || flag==id)) { return; }
 Helper macro to check input filter and return if not valid input id. More...
 

Functions

void stateInit (void)
 
void stateSetInputFilter (uint8_t type, uint16_t id)
 set the input filter for a specified type of data. More...
 
static void stateSetLocalOrigin_i (uint16_t id, struct LtpDef_i *ltp_def)
 Set the local (flat earth) coordinate frame origin (int). More...
 
static void stateSetLocalUtmOrigin_f (uint16_t id, struct UtmCoor_f *utm_def)
 Set the local (flat earth) coordinate frame origin from UTM (float). More...
 
static struct LtpDef_istateGetNedOrigin_i (void)
 Get the coordinate NED frame origin (int) More...
 
static struct LtpDef_fstateGetNedOrigin_f (void)
 Get the coordinate NED frame origin (float) More...
 
static struct UtmCoor_fstateGetUtmOrigin_f (void)
 Get the coordinate UTM frame origin (int) More...
 
struct LlaCoor_i stateGetLlaOrigin_i (void)
 Get the LLA position of the frame origin (int) More...
 
struct LlaCoor_f stateGetLlaOrigin_f (void)
 Get the LLA position of the frame origin (float) More...
 
struct EcefCoor_i stateGetEcefOrigin_i (void)
 Get the ECEF position of the frame origin (int) More...
 
struct EcefCoor_f stateGetEcefOrigin_f (void)
 Get the ECEF position of the frame origin (float) More...
 
int32_t stateGetHmslOrigin_i (void)
 Get the HMSL of the frame origin (int) More...
 
float stateGetHmslOrigin_f (void)
 Get the HMSL of the frame origin (float) More...
 
void stateCalcPositionEcef_i (void)
 
void stateCalcPositionNed_i (void)
 
void stateCalcPositionEnu_i (void)
 
void stateCalcPositionLla_i (void)
 Calculate LLA (int) from any other available representation. More...
 
void stateCalcPositionUtm_f (void)
 
void stateCalcPositionEcef_f (void)
 
void stateCalcPositionNed_f (void)
 
void stateCalcPositionEnu_f (void)
 
void stateCalcPositionLla_f (void)
 
static bool stateIsLocalCoordinateValid (void)
 Test if local coordinates are valid. More...
 
static bool stateIsGlobalCoordinateValid (void)
 Test if global coordinates are valid. More...
 
static void stateSetPositionEcef_i (uint16_t id, struct EcefCoor_i *ecef_pos)
 Set position from ECEF coordinates (int). More...
 
static void stateSetPositionNed_i (uint16_t id, struct NedCoor_i *ned_pos)
 Set position from local NED coordinates (int). More...
 
static void stateSetPositionEnu_i (uint16_t id, struct EnuCoor_i *enu_pos)
 Set position from local ENU coordinates (int). More...
 
static void stateSetPositionLla_i (uint16_t id, struct LlaCoor_i *lla_pos)
 Set position from LLA coordinates (int). More...
 
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). More...
 
static void stateSetPositionUtm_f (uint16_t id, struct UtmCoor_f *utm_pos)
 Set position from UTM coordinates (float). More...
 
static void stateSetPositionEcef_f (uint16_t id, struct EcefCoor_f *ecef_pos)
 Set position from ECEF coordinates (float). More...
 
static void stateSetPositionNed_f (uint16_t id, struct NedCoor_f *ned_pos)
 Set position from local NED coordinates (float). More...
 
static void stateSetPositionEnu_f (uint16_t id, struct EnuCoor_f *enu_pos)
 Set position from local ENU coordinates (float). More...
 
static void stateSetPositionLla_f (uint16_t id, struct LlaCoor_f *lla_pos)
 Set position from LLA coordinates (float). More...
 
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). More...
 
static struct EcefCoor_istateGetPositionEcef_i (void)
 Get position in ECEF coordinates (int). More...
 
static struct NedCoor_istateGetPositionNed_i (void)
 Get position in local NED coordinates (int). More...
 
static struct EnuCoor_istateGetPositionEnu_i (void)
 Get position in local ENU coordinates (int). More...
 
static struct LlaCoor_istateGetPositionLla_i (void)
 Get position in LLA coordinates (int). More...
 
static struct UtmCoor_fstateGetPositionUtm_f (void)
 Get position in UTM coordinates (float). More...
 
static struct EcefCoor_fstateGetPositionEcef_f (void)
 Get position in ECEF coordinates (float). More...
 
static struct NedCoor_fstateGetPositionNed_f (void)
 Get position in local NED coordinates (float). More...
 
static struct EnuCoor_fstateGetPositionEnu_f (void)
 Get position in local ENU coordinates (float). More...
 
static struct LlaCoor_fstateGetPositionLla_f (void)
 Get position in LLA coordinates (float). More...
 
void stateCalcSpeedNed_i (void)
 
void stateCalcSpeedEnu_i (void)
 
void stateCalcSpeedEcef_i (void)
 
void stateCalcHorizontalSpeedNorm_i (void)
 
void stateCalcHorizontalSpeedDir_i (void)
 
void stateCalcSpeedNed_f (void)
 
void stateCalcSpeedEnu_f (void)
 
void stateCalcSpeedEcef_f (void)
 
void stateCalcHorizontalSpeedNorm_f (void)
 
void stateCalcHorizontalSpeedDir_f (void)
 
static void stateSetSpeedNed_i (uint16_t id, struct NedCoor_i *ned_speed)
 Set ground speed in local NED coordinates (int). More...
 
static void stateSetSpeedEnu_i (uint16_t id, struct EnuCoor_i *enu_speed)
 Set ground speed in local ENU coordinates (int). More...
 
static void stateSetSpeedEcef_i (uint16_t id, struct EcefCoor_i *ecef_speed)
 Set ground speed in ECEF coordinates (int). More...
 
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). More...
 
static void stateSetSpeedNed_f (uint16_t id, struct NedCoor_f *ned_speed)
 Set ground speed in local NED coordinates (float). More...
 
static void stateSetSpeedEnu_f (uint16_t id, struct EnuCoor_f *enu_speed)
 Set ground speed in local ENU coordinates (float). More...
 
static void stateSetSpeedEcef_f (uint16_t id, struct EcefCoor_f *ecef_speed)
 Set ground speed in ECEF coordinates (float). More...
 
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). More...
 
static struct NedCoor_istateGetSpeedNed_i (void)
 Get ground speed in local NED coordinates (int). More...
 
static struct EnuCoor_istateGetSpeedEnu_i (void)
 Get ground speed in local ENU coordinates (int). More...
 
static struct EcefCoor_istateGetSpeedEcef_i (void)
 Get ground speed in ECEF coordinates (int). More...
 
static uint32_t stateGetHorizontalSpeedNorm_i (void)
 Get norm of horizontal ground speed (int). More...
 
static int32_t stateGetHorizontalSpeedDir_i (void)
 Get dir of horizontal ground speed (int). More...
 
static struct NedCoor_fstateGetSpeedNed_f (void)
 Get ground speed in local NED coordinates (float). More...
 
static struct EnuCoor_fstateGetSpeedEnu_f (void)
 Get ground speed in local ENU coordinates (float). More...
 
static struct EcefCoor_fstateGetSpeedEcef_f (void)
 Get ground speed in ECEF coordinates (float). More...
 
static float stateGetHorizontalSpeedNorm_f (void)
 Get norm of horizontal ground speed (float). More...
 
static float stateGetHorizontalSpeedDir_f (void)
 Get dir of horizontal ground speed (float). More...
 
static struct Int32Vect3stateGetAccelBody_i (void)
 Get acceleration in Body coordinates (int). More...
 
void stateCalcAccelNed_i (void)
 
void stateCalcAccelEcef_i (void)
 
void stateCalcAccelNed_f (void)
 
void stateCalcAccelEcef_f (void)
 
static bool stateIsAccelValid (void)
 Test if accelerations are valid. More...
 
static void stateSetAccelNed_i (uint16_t id, struct NedCoor_i *ned_accel)
 Set acceleration in NED coordinates (int). More...
 
static void stateSetAccelEcef_i (uint16_t id, struct EcefCoor_i *ecef_accel)
 Set acceleration in ECEF coordinates (int). More...
 
static void stateSetAccelNed_f (uint16_t id, struct NedCoor_f *ned_accel)
 Set acceleration in NED coordinates (float). More...
 
static void stateSetAccelEcef_f (uint16_t id, struct EcefCoor_f *ecef_accel)
 Set acceleration in ECEF coordinates (float). More...
 
static void stateSetAccelBody_i (uint16_t id, struct Int32Vect3 *body_accel)
 Set acceleration in Body coordinates (int). More...
 
static struct NedCoor_istateGetAccelNed_i (void)
 Get acceleration in NED coordinates (int). More...
 
static struct EcefCoor_istateGetAccelEcef_i (void)
 Get acceleration in ECEF coordinates (int). More...
 
static struct NedCoor_fstateGetAccelNed_f (void)
 Get acceleration in NED coordinates (float). More...
 
static struct EcefCoor_fstateGetAccelEcef_f (void)
 Get acceleration in ECEF coordinates (float). More...
 
static bool stateIsAttitudeValid (void)
 Test if attitudes are valid. More...
 
static void stateSetNedToBodyQuat_i (uint16_t id, struct Int32Quat *ned_to_body_quat)
 Set vehicle body attitude from quaternion (int). More...
 
static void stateSetNedToBodyRMat_i (uint16_t id, struct Int32RMat *ned_to_body_rmat)
 Set vehicle body attitude from rotation matrix (int). More...
 
static void stateSetNedToBodyEulers_i (uint16_t id, struct Int32Eulers *ned_to_body_eulers)
 Set vehicle body attitude from euler angles (int). More...
 
static void stateSetNedToBodyQuat_f (uint16_t id, struct FloatQuat *ned_to_body_quat)
 Set vehicle body attitude from quaternion (float). More...
 
static void stateSetNedToBodyRMat_f (uint16_t id, struct FloatRMat *ned_to_body_rmat)
 Set vehicle body attitude from rotation matrix (float). More...
 
static void stateSetNedToBodyEulers_f (uint16_t id, struct FloatEulers *ned_to_body_eulers)
 Set vehicle body attitude from euler angles (float). More...
 
static struct Int32QuatstateGetNedToBodyQuat_i (void)
 Get vehicle body attitude quaternion (int). More...
 
static struct Int32RMatstateGetNedToBodyRMat_i (void)
 Get vehicle body attitude rotation matrix (int). More...
 
static struct Int32EulersstateGetNedToBodyEulers_i (void)
 Get vehicle body attitude euler angles (int). More...
 
static struct FloatQuatstateGetNedToBodyQuat_f (void)
 Get vehicle body attitude quaternion (float). More...
 
static struct FloatRMatstateGetNedToBodyRMat_f (void)
 Get vehicle body attitude rotation matrix (float). More...
 
static struct FloatEulersstateGetNedToBodyEulers_f (void)
 Get vehicle body attitude euler angles (float). More...
 
void stateCalcBodyRates_i (void)
 
void stateCalcBodyRates_f (void)
 
static bool stateIsRateValid (void)
 Test if rates are valid. More...
 
static void stateSetBodyRates_i (uint16_t id, struct Int32Rates *body_rate)
 Set vehicle body angular rate (int). More...
 
static void stateSetBodyRates_f (uint16_t id, struct FloatRates *body_rate)
 Set vehicle body angular rate (float). More...
 
static struct Int32RatesstateGetBodyRates_i (void)
 Get vehicle body angular rate (int). More...
 
static struct FloatRatesstateGetBodyRates_f (void)
 Get vehicle body angular rate (float). More...
 
void stateCalcHorizontalWindspeed_i (void)
 
void stateCalcVerticalWindspeed_i (void)
 
void stateCalcAirspeed_i (void)
 
void stateCalcHorizontalWindspeed_f (void)
 
void stateCalcVerticalWindspeed_f (void)
 
void stateCalcAirspeed_f (void)
 
static bool stateIsWindspeedValid (void)
 test if wind speed is available. More...
 
static bool stateIsVerticalWindspeedValid (void)
 test if vertical wind speed is available. More...
 
static bool stateIsAirspeedValid (void)
 test if air speed is available. More...
 
static bool stateIsAngleOfAttackValid (void)
 test if angle of attack is available. More...
 
static bool stateIsSideslipValid (void)
 test if sideslip is available. More...
 
static void stateSetHorizontalWindspeed_i (uint16_t id, struct Int32Vect2 *h_windspeed)
 Set horizontal windspeed (int). More...
 
static void stateSetVerticalWindspeed_i (uint16_t id, int32_t v_windspeed)
 Set vertical windspeed (int). More...
 
static void stateSetAirspeed_i (uint16_t id, int32_t airspeed)
 Set airspeed (int). More...
 
static void stateSetHorizontalWindspeed_f (uint16_t id, struct FloatVect2 *h_windspeed)
 Set horizontal windspeed (float). More...
 
static void stateSetVerticalWindspeed_f (uint16_t id, float v_windspeed)
 Set vertical windspeed (float). More...
 
static void stateSetAirspeed_f (uint16_t id, float airspeed)
 Set airspeed (float). More...
 
static void stateSetAngleOfAttack_f (uint16_t id, float aoa)
 Set angle of attack in radians (float). More...
 
static void stateSetSideslip_f (uint16_t id, float sideslip)
 Set sideslip angle in radians (float). More...
 
static struct Int32Vect2stateGetHorizontalWindspeed_i (void)
 Get horizontal windspeed (int). More...
 
static float stateGetVerticalWindspeed_i (void)
 Get vertical windspeed (int). More...
 
static struct Int32Vect3stateGetWindspeed_i (void)
 Get windspeed (int). More...
 
static int32_t stateGetAirspeed_i (void)
 Get airspeed (int). More...
 
static struct FloatVect2stateGetHorizontalWindspeed_f (void)
 Get horizontal windspeed (float). More...
 
static float stateGetVerticalWindspeed_f (void)
 Get vertical windspeed (float). More...
 
static struct FloatVect3stateGetWindspeed_f (void)
 Get windspeed (float). More...
 
static float stateGetAirspeed_f (void)
 Get airspeed (float). More...
 
static float stateGetAngleOfAttack_f (void)
 Get angle of attack (float). More...
 
static float stateGetSideslip_f (void)
 Get sideslip (float). More...
 

Variables

struct State state
 

Detailed Description

API to get/set the generic vehicle states.

Also see the State Interface page.

Author
Felix Ruess felix.nosp@m..rue.nosp@m.ss@gm.nosp@m.ail..nosp@m.com

Definition in file state.h.