Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
State interface

This general state interface holds all the most important vehicle states like position, velocity, attitude, etc. More...

+ Collaboration diagram for State interface:

Modules

 Position representations
 
 Speed representations
 
 Acceleration representations
 
 Angular rate representations
 
 Wind- and airspeed representations
 
 Attitude representations
 

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...
 

Functions

void stateInit (void)
 

Variables

struct State state
 

Detailed Description

This general state interface holds all the most important vehicle states like position, velocity, attitude, etc.

It handles coordinate system and fixed-/floating-point conversion on the fly when needed.

IMPORTANT: Don't access the members of the state struct directly, use the stateSet* and stateGet* functions!

You can set e.g. the position in any coordinate system you wish: stateSetPositionNed_i() to set the position in fixed-point NED coordinates. If you need to read the position somewhere else in a different representation, call: stateGetPositionLla_f() and only then the LLA float position representation is calculated on the fly and returned. It's also only calculated once, until a new position is set which invalidates all the other representations again.


Data Structure Documentation

◆ State

struct State

Structure holding vehicle state data.

Definition at line 134 of file state.h.

+ Collaboration diagram for State:
Data Fields
uint8_t accel_status Holds the status bits for all acceleration representations.

When the corresponding bit is one the representation is already computed.

float airspeed_f Norm of relative air speed.

Unit: m/s

int32_t airspeed_i Norm of relative wind speed.

Unit: m/s in BFP with INT32_SPEED_FRAC

float alt_agl_f Altitude above ground level.

Unit: meters

float angle_of_attack_f Angle of attack Unit: rad.
struct Int32Vect3 body_accel_i Acceleration in Body coordinates.

Units: m/s^2 in BFP with INT32_ACCEL_FRAC

struct FloatRates body_rates_f Angular rates in body frame.

Units: rad/s

struct Int32Rates body_rates_i Angular rates in body frame.

Units: rad/s in BFP with INT32_RATE_FRAC

struct EcefCoor_f ecef_accel_f Acceleration in EarthCenteredEarthFixed coordinates.

Units: m/s^2

struct EcefCoor_i ecef_accel_i Acceleration in EarthCenteredEarthFixed coordinates.

Units: m/s^2 in BFP with INT32_ACCEL_FRAC

struct EcefCoor_f ecef_pos_f Position in EarthCenteredEarthFixed coordinates.

Units: meters

struct EcefCoor_i ecef_pos_i Position in EarthCenteredEarthFixed coordinates.

Units: centimeters

struct EcefCoor_f ecef_speed_f Velocity in EarthCenteredEarthFixed coordinates.

Units: m/s

struct EcefCoor_i ecef_speed_i Velocity in EarthCenteredEarthFixed coordinates.

Units: m/s in BFP with INT32_SPEED_FRAC

struct EnuCoor_f enu_pos_f Position in East North Up coordinates.

with respect to ned_origin_i (flat earth) Units: meters

struct EnuCoor_i enu_pos_i Position in East North Up coordinates.

with respect to ned_origin_i (flat earth) Units: m in BFP with INT32_POS_FRAC

struct EnuCoor_f enu_speed_f Velocity in East North Up coordinates.

Units: m/s

struct EnuCoor_i enu_speed_i Velocity in East North Up coordinates.

Units: m/s in BFP with INT32_SPEED_FRAC

float h_speed_dir_f Direction of horizontal ground speed.

Unit: rad (clockwise, zero=north)

int32_t h_speed_dir_i Direction of horizontal ground speed.

Unit: rad in BFP with INT32_ANGLE_FRAC (clockwise, zero=north)

float h_speed_norm_f Norm of horizontal ground speed.

Unit: m/s

uint32_t h_speed_norm_i Norm of horizontal ground speed.

Unit: m/s in BFP with INT32_SPEED_FRAC

struct LlaCoor_f lla_pos_f Position in Latitude, Longitude and Altitude.

Units lat,lon: radians Units alt: meters above reference ellipsoid

struct LlaCoor_i lla_pos_i Position in Latitude, Longitude and Altitude.

Units lat,lon: degrees*1e7 Units alt: milimeters above reference ellipsoid

struct NedCoor_f ned_accel_f Acceleration in North East Down coordinates.

Units: m/s^2

struct NedCoor_i ned_accel_i Acceleration in North East Down coordinates.

Units: m/s^2 in BFP with INT32_ACCEL_FRAC

bool ned_initialized_f True if local float coordinate frame is initialsed.
bool ned_initialized_i true if local int coordinate frame is initialsed
struct LtpDef_f ned_origin_f Definition of the local (flat earth) coordinate system.

Defines the origin of the local NorthEastDown coordinate system in ECEF (EarthCenteredEarthFixed) and LLA (LatitudeLongitudeAlt) coordinates and the roation matrix from ECEF to local frame. (float version)

struct LtpDef_i ned_origin_i Definition of the local (flat earth) coordinate system.

Defines the origin of the local NorthEastDown coordinate system in ECEF (EarthCenteredEarthFixed) and LLA (LatitudeLongitudeAlt) coordinates and the roation matrix from ECEF to local frame. (int version)

struct NedCoor_f ned_pos_f Position in North East Down coordinates.

with respect to ned_origin_i (flat earth) Units: meters

struct NedCoor_i ned_pos_i Position in North East Down coordinates.

with respect to ned_origin_i (flat earth) Units: m in BFP with INT32_POS_FRAC

struct NedCoor_f ned_speed_f speed in North East Down coordinates

Units: m/s

struct NedCoor_i ned_speed_i Velocity in North East Down coordinates.

Units: m/s in BFP with INT32_SPEED_FRAC

struct OrientationReps ned_to_body_orientation
uint16_t pos_status Holds the status bits for all position representations.

When the corresponding bit is set the representation is already computed.

uint8_t rate_status Holds the status bits for all angular rate representations.

When the corresponding bit is one the representation is already computed.

float sideslip_f Sideslip angle Unit: rad.
uint16_t speed_status Holds the status bits for all ground speed representations.

When the corresponding bit is one the representation is already computed.

bool utm_initialized_f True if utm origin (float) coordinate frame is initialsed.
struct UtmCoor_f utm_origin_f Definition of the origin of Utm coordinate system.

Defines the origin of the local NorthEastDown coordinate system in UTM coordinates, used as a reference when ned_origin is not initialized. Altitude is height above MSL. (float version)

struct UtmCoor_f utm_pos_f Position in UTM coordinates.

Units x,y: meters. Units z: meters above MSL

uint8_t wind_air_status Holds the status bits for all wind- and airspeed representations.

When the corresponding bit is one the representation is already computed.

union State windspeed_f Horizontal windspeed.

Units: m/s with x=north, y=east, z=down

union State windspeed_i Horizontal windspeed in north/east/down.

Units: m/s in BFP with INT32_SPEED_FRAC

◆ State.windspeed_i

union State.windspeed_i

Horizontal windspeed in north/east/down.

Units: m/s in BFP with INT32_SPEED_FRAC

Definition at line 407 of file state.h.

Data Fields
struct Int32Vect2 vect2
struct Int32Vect3 vect3

◆ State.windspeed_f

union State.windspeed_f

Horizontal windspeed.

Units: m/s with x=north, y=east, z=down

Definition at line 422 of file state.h.

Data Fields
struct FloatVect2 vect2
struct FloatVect3 vect3

Function Documentation

◆ stateInit()

Variable Documentation

◆ state

struct State state
extern

Definition at line 1 of file state.c.

Referenced by acInfoCalcPositionEnu_f(), acInfoCalcPositionEnu_i(), acInfoCalcPositionUtm_f(), acInfoCalcPositionUtm_i(), copilot_parse_move_wp_dl(), dc_send_command(), detection_cb(), error_output(), follow_me_periodic(), follow_me_set_wp(), gazebo_read(), gps_cb(), gps_ubx_periodic_check(), handle_reply(), ins_float_invariant_update_gps(), ins_reset_altitude_ref(), mavlink_common_message_handler(), mavlink_send_global_position_int(), mavlink_send_gps_global_origin(), mavlink_send_vfr_hud(), mavlink_wp_message_handler(), mission_point_of_lla(), nav_land_at_loc(), nav_parse_MOVE_WP(), nav_reset_alt(), nav_reset_reference(), nav_set_altitude(), nav_takeoff_from_loc(), pressure_abs_cb(), px4flash_event(), rotwing_state_set(), send_ins_ref(), send_rotating_wing_state(), set_ac_info_utm(), sim_overwrite_ins(), stateCalcAccelEcef_f(), stateCalcAccelEcef_i(), stateCalcAccelNed_f(), stateCalcAccelNed_i(), stateCalcAirspeed_f(), stateCalcAirspeed_i(), stateCalcBodyRates_f(), stateCalcBodyRates_i(), stateCalcHorizontalSpeedDir_f(), stateCalcHorizontalSpeedDir_i(), stateCalcHorizontalSpeedNorm_f(), stateCalcHorizontalSpeedNorm_i(), stateCalcHorizontalWindspeed_f(), stateCalcHorizontalWindspeed_i(), stateCalcPositionEcef_f(), stateCalcPositionEcef_i(), stateCalcPositionEnu_f(), stateCalcPositionEnu_i(), stateCalcPositionLla_f(), stateCalcPositionLla_i(), stateCalcPositionNed_f(), stateCalcPositionNed_i(), stateCalcPositionUtm_f(), stateCalcSpeedEcef_f(), stateCalcSpeedEcef_i(), stateCalcSpeedEnu_f(), stateCalcSpeedEnu_i(), stateCalcSpeedNed_f(), stateCalcSpeedNed_i(), stateCalcVerticalWindspeed_f(), stateCalcVerticalWindspeed_i(), stateGetAccelBody_i(), stateGetAccelEcef_f(), stateGetAccelEcef_i(), stateGetAccelNed_f(), stateGetAccelNed_i(), stateGetAirspeed_f(), stateGetAirspeed_i(), stateGetAngleOfAttack_f(), stateGetBodyRates_f(), stateGetBodyRates_i(), stateGetHorizontalSpeedDir_f(), stateGetHorizontalSpeedDir_i(), stateGetHorizontalSpeedNorm_f(), stateGetHorizontalSpeedNorm_i(), stateGetHorizontalWindspeed_f(), stateGetHorizontalWindspeed_i(), stateGetNedToBodyEulers_f(), stateGetNedToBodyEulers_i(), stateGetNedToBodyQuat_f(), stateGetNedToBodyQuat_i(), stateGetNedToBodyRMat_f(), stateGetNedToBodyRMat_i(), stateGetPositionEcef_f(), stateGetPositionEcef_i(), stateGetPositionEnu_f(), stateGetPositionEnu_i(), stateGetPositionLla_f(), stateGetPositionLla_i(), stateGetPositionNed_f(), stateGetPositionNed_i(), stateGetPositionUtm_f(), stateGetSideslip_f(), stateGetSpeedEcef_f(), stateGetSpeedEcef_i(), stateGetSpeedEnu_f(), stateGetSpeedEnu_i(), stateGetSpeedNed_f(), stateGetSpeedNed_i(), stateGetVerticalWindspeed_f(), stateGetVerticalWindspeed_i(), stateGetWindspeed_f(), stateGetWindspeed_i(), stateInit(), stateIsAccelValid(), stateIsAirspeedValid(), stateIsAngleOfAttackValid(), stateIsAttitudeValid(), stateIsGlobalCoordinateValid(), stateIsLocalCoordinateValid(), stateIsRateValid(), stateIsSideslipValid(), stateIsVerticalWindspeedValid(), stateIsWindspeedValid(), stateSetAccelBody_i(), stateSetAccelEcef_f(), stateSetAccelEcef_i(), stateSetAccelNed_f(), stateSetAccelNed_i(), stateSetAirspeed_f(), stateSetAirspeed_i(), stateSetAngleOfAttack_f(), stateSetBodyRates_f(), stateSetBodyRates_i(), stateSetHorizontalWindspeed_f(), stateSetHorizontalWindspeed_i(), stateSetLocalOrigin_i(), stateSetLocalUtmOrigin_f(), stateSetNedToBodyEulers_f(), stateSetNedToBodyEulers_i(), stateSetNedToBodyQuat_f(), stateSetNedToBodyQuat_i(), stateSetNedToBodyRMat_f(), stateSetNedToBodyRMat_i(), stateSetPosition_f(), stateSetPosition_i(), stateSetPositionEcef_f(), stateSetPositionEcef_i(), stateSetPositionEnu_f(), stateSetPositionEnu_i(), stateSetPositionLla_f(), stateSetPositionLla_i(), stateSetPositionNed_f(), stateSetPositionNed_i(), stateSetPositionUtm_f(), stateSetSideslip_f(), stateSetSpeed_f(), stateSetSpeed_i(), stateSetSpeedEcef_f(), stateSetSpeedEcef_i(), stateSetSpeedEnu_f(), stateSetSpeedEnu_i(), stateSetSpeedNed_f(), stateSetSpeedNed_i(), stateSetVerticalWindspeed_f(), stateSetVerticalWindspeed_i(), syslink_parse_char(), syslink_parse_init(), tag_tracking_report(), target_get_pos(), target_get_vel(), target_pos_set_current_offset(), VL53L1X_BootDevice(), VL53L1X_BootState(), waypoint_get_lla_alt(), waypoint_globalize(), waypoint_localize(), waypoint_move_here_2d(), and waypoint_move_lla().