Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
This general state interface holds all the most important vehicle states like position, velocity, attitude, etc. More...
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 | 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... | |
Variables | |
struct State | state |
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.
struct State |
Data Fields | ||
---|---|---|
uint16_t | accel_input_filter | Holds the input filter id for acceleration. |
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. |
uint16_t | attitude_input_filter | Holds the input filter id for attitude. |
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 | origin_input_filter | Holds the input filter id for state origin. |
uint16_t | pos_input_filter | Holds the input filter id for position. |
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. |
uint16_t | rates_input_filter | Holds the input filter id for rates. |
float | sideslip_f | Sideslip angle Unit: rad. |
uint16_t | speed_input_filter | Holds the input filter id for speed. |
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 |
uint16_t | wind_air_input_filter | Holds the input filter id for air data. |
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 |
union State.windspeed_i |
Horizontal windspeed in north/east/down.
Units: m/s in BFP with INT32_SPEED_FRAC
Data Fields | ||
---|---|---|
struct Int32Vect2 | vect2 | |
struct Int32Vect3 | vect3 |
union State.windspeed_f |
Horizontal windspeed.
Units: m/s with x=north, y=east, z=down
Data Fields | ||
---|---|---|
struct FloatVect2 | vect2 | |
struct FloatVect3 | vect3 |
#define STATE_CHECK_INPUT_AND_RETURN | ( | flag, | |
id | |||
) | if (flag==STATE_INPUT_DISABLE || !(flag==STATE_INPUT_ANY || flag==id)) { return; } |
void stateInit | ( | void | ) |
Definition at line 57 of file state.c.
References State::accel_input_filter, State::accel_status, State::attitude_input_filter, State::ned_initialized_f, State::ned_initialized_i, State::ned_to_body_orientation, State::origin_input_filter, State::pos_input_filter, State::pos_status, preflight_check_register(), State::rate_status, State::rates_input_filter, State::speed_input_filter, State::speed_status, state, STATE_INPUT_ANY, OrientationReps::status, State::utm_initialized_f, State::utm_origin_f, State::wind_air_input_filter, State::wind_air_status, and UtmCoor_f::zone.
Referenced by main_init().
set the input filter for a specified type of data.
[in] | type | type of data (origin, pos, speed, ...) |
[in] | id | value of the filter, can be a module ID, or a specific code (disable or any value) |
Definition at line 85 of file state.c.
Referenced by ahrs_float_cmp_quat_wrapper_enable(), ahrs_float_dcm_wrapper_enable(), ahrs_float_invariant_wrapper_enable(), ahrs_float_mlkf_wrapper_enable(), ahrs_int_cmpl_quat_wrapper_enable(), ahrs_madgwick_wrapper_enable(), and ahrs_vectornav_wrapper_enable().
|
extern |
Definition at line 1 of file state.c.
Referenced by acInfoCalcPositionEnu_f(), acInfoCalcPositionEnu_i(), dc_send_command(), error_output(), follow_me_set_wp(), gazebo_read(), gps_cb(), gps_ubx_periodic_check(), handle_reply(), ins_float_invariant_update_gps(), mavlink_send_gps_global_origin(), mission_point_of_lla(), pressure_abs_cb(), px4flash_event(), rotwing_state_set(), send_ins_ref(), send_rotating_wing_state(), 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(), stateGetEcefOrigin_f(), stateGetHmslOrigin_f(), stateGetHmslOrigin_i(), stateGetHorizontalSpeedDir_f(), stateGetHorizontalSpeedDir_i(), stateGetHorizontalSpeedNorm_f(), stateGetHorizontalSpeedNorm_i(), stateGetHorizontalWindspeed_f(), stateGetHorizontalWindspeed_i(), stateGetNedOrigin_f(), stateGetNedOrigin_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(), stateGetUtmOrigin_f(), 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(), target_get_pos(), target_get_vel(), target_pos_set_current_offset(), VL53L1X_BootDevice(), VL53L1X_BootState(), waypoint_globalize(), and waypoint_localize().