dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Libraries

Structures relating to loadable extensions. More...

Modules

 Constants
 
 math support libraries
 
 Protocol Library
 Deals with packing/unpacking and MSP streams.
 

Files

file  alarms.c
 Library for setting and clearing system alarms.
 
file  alarms.h
 Include file of the alarm library.
 
file  insgps.h
 Include file of the INSGPS exposed functionality.
 
file  paths.h
 Path calculation library with common API.
 
file  sanitycheck.h
 Utilities to validate a flight configuration.
 
file  timeutils.h
 Time conversion functions.
 
file  WMMInternal.h
 Include file of the WorldMagModel internal functionality.
 
file  WorldMagModel.h
 Source file for the World Magnetic Model.
 
file  paths.c
 Path calculation library with common API.
 
file  sanitycheck.c
 Utilities to validate a flight configuration.
 
file  timeutils.c
 Time conversion functions.
 
file  WorldMagModel.c
 Source file for the World Magnetic Model This is a port of code available from the US NOAA.
 
file  taskmonitor.h
 Task monitoring library.
 
file  taskmonitor.h
 Task monitoring library.
 

Data Structures

struct  loadable_extension
 
struct  path_status
 
struct  __attribute__
 
struct  WMMtype_MagneticModel
 
struct  WMMtype_Ellipsoid
 
struct  WMMtype_CoordGeodetic
 
struct  WMMtype_CoordSpherical
 
struct  WMMtype_Date
 
struct  WMMtype_LegendreFunction
 
struct  WMMtype_MagneticResults
 
struct  WMMtype_SphericalHarmonicVariables
 
struct  WMMtype_GeoMagneticElements
 

Macros

#define LONGEST_MESSAGE   17
 
#define SYSTEMALARMS_ALARM_DEFAULT   SYSTEMALARMS_ALARM_UNINITIALISED
 
#define DECLARE_LOADABLE_EXTENSION(ent_func)
 
#define TRUE   ((uint16_t)1)
 
#define FALSE   ((uint16_t)0)
 
#define WMM_MAX_MODEL_DEGREES   12
 
#define WMM_MAX_SECULAR_VARIATION_MODEL_DEGREES   12
 
#define NUMTERMS   91
 
#define NUMPCUP   92
 
#define NUMPCUPS   13
 
#define __isleap(year)   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
 
#define SECS_PER_HOUR   (60 * 60)
 
#define SECS_PER_DAY   (SECS_PER_HOUR * 24)
 
#define NUMX   13
 
#define NUMW   9
 
#define NUMV   10
 
#define NUMU   6
 

Functions

static int32_t hasSeverity (SystemAlarmsAlarmOptions severity)
 
int32_t AlarmsInitialize (void)
 
int32_t AlarmsSet (SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity)
 
SystemAlarmsAlarmOptions AlarmsGet (SystemAlarmsAlarmElem alarm)
 
int32_t AlarmsDefault (SystemAlarmsAlarmElem alarm)
 
void AlarmsDefaultAll ()
 
int32_t AlarmsClear (SystemAlarmsAlarmElem alarm)
 
void AlarmsClearAll ()
 
int32_t AlarmsHasWarnings ()
 
int32_t AlarmsHasErrors ()
 
int32_t AlarmsHasCritical ()
 
 DONT_BUILD_IF (NELEMENTS(alarm_names)!=SYSTEMALARMS_ALARM_NUMELEM, AlarmArrayMismatch)
 
int32_t AlarmString (SystemAlarmsData *alarm, char *buf, size_t buflen, bool blink, uint8_t *state)
 
const char * AlarmBootReason (uint8_t reason)
 
void INSGPSInit ()
 Reset the internal state variables and variances. More...
 
void INSStatePrediction (const float gyro_data[3], const float accel_data[3], float dT)
 Compute an update of the state estimate. More...
 
void INSCovariancePrediction (float dT)
 Compute an update of the state covariance. More...
 
void INSCorrection (const float mag_data[3], const float Pos[3], const float Vel[3], float BaroAlt, uint16_t SensorsUsed)
 Correct the state and covariance estimate based on the sensors that were updated. More...
 
void INSSetArmed (bool armed)
 Set the current flight state. More...
 
void INSResetP (const float *PDiag)
 
void INSSetState (const float pos[3], const float vel[3], const float q[4], const float gyro_bias[3], const float accel_bias[3])
 
void INSSetPosVelVar (float PosVar, float VelVar, float VertPosVar)
 
void INSSetGyroBias (const float gyro_bias[3])
 
void INSSetAccelBias (const float gyro_bias[3])
 
void INSSetAccelVar (const float accel_var[3])
 
void INSSetGyroVar (const float gyro_var[3])
 
void INSSetMagNorth (const float B[3])
 
void INSSetMagVar (const float scaled_mag_var[3])
 
void INSSetBaroVar (float baro_var)
 
void INSPosVelReset (const float pos[3], const float vel[3])
 
uint16_t ins_get_num_states ()
 
void path_progress (const PathDesiredData *pathDesired, const float *cur_point, struct path_status *status)
 Compute progress along path and deviation from it. More...
 
int32_t configuration_check ()
 
void set_config_error (SystemAlarmsConfigErrorOptions error_code)
 
void date_from_timestamp (uint32_t timestamp, DateTimeT *date_time)
 
void WMM_Set_Coeff_Array ()
 
int WMM_GeodeticToSpherical (WMMtype_CoordGeodetic *CoordGeodetic, WMMtype_CoordSpherical *CoordSpherical)
 
int WMM_DateToYear (uint16_t month, uint16_t day, uint16_t year)
 
int WMM_Geomag (WMMtype_CoordSpherical *CoordSpherical, WMMtype_CoordGeodetic *CoordGeodetic, WMMtype_GeoMagneticElements *GeoMagneticElements)
 
int WMM_AssociatedLegendreFunction (WMMtype_CoordSpherical *CoordSpherical, uint16_t nMax, WMMtype_LegendreFunction *LegendreFunction)
 
int WMM_CalculateGeoMagneticElements (WMMtype_MagneticResults *MagneticResultsGeo, WMMtype_GeoMagneticElements *GeoMagneticElements)
 
int WMM_CalculateSecularVariation (WMMtype_MagneticResults *MagneticVariation, WMMtype_GeoMagneticElements *MagneticElements)
 
int WMM_ComputeSphericalHarmonicVariables (WMMtype_CoordSpherical *CoordSpherical, uint16_t nMax, WMMtype_SphericalHarmonicVariables *SphVariables)
 
int WMM_PcupLow (float *Pcup, float *dPcup, float x, uint16_t nMax)
 
int WMM_PcupHigh (float *Pcup, float *dPcup, float x, uint16_t nMax)
 
int WMM_RotateMagneticVector (WMMtype_CoordSpherical *, WMMtype_CoordGeodetic *CoordGeodetic, WMMtype_MagneticResults *MagneticResultsSph, WMMtype_MagneticResults *MagneticResultsGeo)
 
int WMM_SecVarSummation (WMMtype_LegendreFunction *LegendreFunction, WMMtype_SphericalHarmonicVariables *SphVariables, WMMtype_CoordSpherical *CoordSpherical, WMMtype_MagneticResults *MagneticResults)
 
int WMM_SecVarSummationSpecial (WMMtype_SphericalHarmonicVariables *SphVariables, WMMtype_CoordSpherical *CoordSpherical, WMMtype_MagneticResults *MagneticResults)
 
int WMM_Summation (WMMtype_LegendreFunction *LegendreFunction, WMMtype_SphericalHarmonicVariables *SphVariables, WMMtype_CoordSpherical *CoordSpherical, WMMtype_MagneticResults *MagneticResults)
 
int WMM_SummationSpecial (WMMtype_SphericalHarmonicVariables *SphVariables, WMMtype_CoordSpherical *CoordSpherical, WMMtype_MagneticResults *MagneticResults)
 
float WMM_get_main_field_coeff_g (uint16_t index)
 Comput the MainFieldCoeffH accounting for the date. More...
 
float WMM_get_main_field_coeff_h (uint16_t index)
 
float WMM_get_secular_var_coeff_g (uint16_t index)
 
float WMM_get_secular_var_coeff_h (uint16_t index)
 
int WMM_Initialize ()
 
int WMM_GetMagVector (float Lat, float Lon, float AltEllipsoid, uint16_t Month, uint16_t Day, uint16_t Year, float B[3])
 
static void path_endpoint (const float *start_point, const float *end_point, const float *cur_point, struct path_status *status)
 Compute progress towards endpoint. Deviation equals distance. More...
 
static void path_vector (const float *start_point, const float *end_point, const float *cur_point, struct path_status *status)
 Compute progress along path and deviation from it. More...
 
static void path_circle (const float *center_point, float radius, const float *cur_point, struct path_status *status, bool clockwise)
 Circle location continuously. More...
 
static void path_curve (const float *start_point, const float *end_point, float radius, const float *cur_point, struct path_status *status, bool clockwise)
 Compute progress along circular path and deviation from it. More...
 
static int32_t check_safe_to_arm ()
 Check it is safe to arm in this position. More...
 
static int32_t check_stabilization_settings (int index, bool multirotor)
 Check a stabilization mode switch position for safety. More...
 
static int32_t check_stabilization_rates ()
 Check a stabilization mode switch position for safety. More...
 
static int32_t check_safe_autonomous ()
 Check the system is safe for autonomous flight. More...
 
bool lqg_sysident_check ()
 
 DONT_BUILD_IF (MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM!=MANUALCONTROLSETTINGS_STABILIZATION2SETTINGS_NUMELEM, StabSettingsNumElem)
 
 DONT_BUILD_IF (MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM!=MANUALCONTROLSETTINGS_STABILIZATION3SETTINGS_NUMELEM, StabSettingsNumElem2)
 
static void CovariancePrediction (float F[NUMX][NUMX], float G[NUMX][NUMW], float Q[NUMW], float dT, float P[NUMX][NUMX])
 
static void SerialUpdate (float H[NUMV][NUMX], float R[NUMV], float Z[NUMV], float Y[NUMV], float P[NUMX][NUMX], float X[NUMX], uint16_t SensorsUsed)
 
static void RungeKutta (float X[NUMX], float U[NUMU], float dT)
 
static void StateEq (float X[NUMX], float U[NUMU], float Xdot[NUMX])
 
static void LinearizeFG (float X[NUMX], float U[NUMU], float F[NUMX][NUMX], float G[NUMX][NUMW])
 
static void MeasurementEq (float X[NUMX], float Be[3], float Y[NUMV])
 
static void LinearizeH (float X[NUMX], float Be[3], float H[NUMV][NUMX])
 
 DONT_BUILD_IF (TASKINFO_RUNNING_NUMELEM!=TASKINFO_STACKREMAINING_NUMELEM, taskelems1)
 
 DONT_BUILD_IF (TASKINFO_RUNNING_NUMELEM!=TASKINFO_RUNNINGTIME_NUMELEM, taskelems2)
 
int32_t TaskMonitorInitialize (void)
 
int32_t TaskMonitorAdd (TaskInfoRunningElem task, struct pios_thread *threadp)
 
int32_t TaskMonitorRemove (TaskInfoRunningElem task)
 
bool TaskMonitorQueryRunning (TaskInfoRunningElem task)
 
void TaskMonitorUpdateAll (void)
 

Variables

static struct pios_mutexlock
 
static const char alarm_names [][10]
 
static const char config_error_names [][15]
 
static const char manual_control_names [][13]
 
static const char boot_reason_names [][16]
 
uint8_t __attribute__::sec
 
uint8_t __attribute__::min
 
uint8_t __attribute__::hour
 
uint8_t __attribute__::mday
 
uint8_t __attribute__::mon
 
uint8_t __attribute__::wday
 
uint8_t __attribute__::year
 
static const uint16_t __mon_yday [2][13]
 
static float F [NUMX][NUMX]
 
static float G [NUMX][NUMW]
 
static float H [NUMV][NUMX]
 
static float Be [3]
 
static float P [NUMX][NUMX]
 
static float X [NUMX]
 
static float Q [NUMW]
 
static float R [NUMV]
 
static float K [NUMX][NUMV]
 
static const float CoeffFile [91][6] = COEFFS_FROM_NASA
 
static WMMtype_Ellipsoid Ellip
 
static WMMtype_MagneticModel MagneticModel
 
static float decimal_date
 
static struct pios_mutexlock
 
static struct pios_thread * handles [TASKINFO_RUNNING_NUMELEM]
 
static uint32_t lastMonitorTime
 

Detailed Description

Structures relating to loadable extensions.

Macro Definition Documentation

#define __isleap (   year)    ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))

Definition at line 33 of file timeutils.c.

#define DECLARE_LOADABLE_EXTENSION (   ent_func)
Value:
extern char _sidata; \
extern char _eidata; \
\
extern char _copylen; \
extern char _gotlen; \
extern char _ramlen; \
\
const struct loadable_extension lext __attribute__((section (".extension_header"))) = { \
.length = (uint32_t) &_eidata, \
.entry_offset = (uint32_t) ent_func, \
.ram_seg_copyoff = (uint32_t) &_sidata, \
/* These next & opers are lies, because they're lengths, not offsets */ \
.ram_seg_len = (uint32_t) &_ramlen, \
.ram_seg_copylen = (uint32_t) &_copylen, \
.ram_seg_gotlen = (uint32_t) &_gotlen, \
}
char _sidata
#define LOADABLE_REQUIRE_VERSION_WIRED
#define LOADABLE_EXTENSION_MAGIC

Definition at line 63 of file loadable_extension.h.

#define FALSE   ((uint16_t)0)

Definition at line 37 of file WMMInternal.h.

#define LONGEST_MESSAGE   17

Definition at line 316 of file alarms.c.

#define NUMPCUP   92

Definition at line 42 of file WMMInternal.h.

#define NUMPCUPS   13

Definition at line 43 of file WMMInternal.h.

#define NUMTERMS   91

Definition at line 41 of file WMMInternal.h.

#define NUMU   6

Definition at line 38 of file insgps13state.c.

#define NUMV   10

Definition at line 37 of file insgps13state.c.

#define NUMW   9

Definition at line 36 of file insgps13state.c.

#define NUMX   13

Definition at line 35 of file insgps13state.c.

#define SECS_PER_DAY   (SECS_PER_HOUR * 24)

Definition at line 45 of file timeutils.c.

#define SECS_PER_HOUR   (60 * 60)

Definition at line 44 of file timeutils.c.

#define SYSTEMALARMS_ALARM_DEFAULT   SYSTEMALARMS_ALARM_UNINITIALISED

Definition at line 31 of file alarms.h.

#define TRUE   ((uint16_t)1)

Definition at line 34 of file WMMInternal.h.

#define WMM_MAX_MODEL_DEGREES   12

Definition at line 39 of file WMMInternal.h.

#define WMM_MAX_SECULAR_VARIATION_MODEL_DEGREES   12

Definition at line 40 of file WMMInternal.h.

Function Documentation

const char* AlarmBootReason ( uint8_t  reason)
int32_t AlarmsClear ( SystemAlarmsAlarmElem  alarm)

Clear an alarm

Parameters
alarmThe system alarm to be modified
Returns
0 if success, -1 if an error

Definition at line 171 of file alarms.c.

void AlarmsClearAll ( )

Clear all alarms

Definition at line 179 of file alarms.c.

int32_t AlarmsDefault ( SystemAlarmsAlarmElem  alarm)

Set an alarm to it's default value

Parameters
alarmThe system alarm to be modified
Returns
0 if success, -1 if an error

Definition at line 149 of file alarms.c.

void AlarmsDefaultAll ( )

Default all alarms

Definition at line 157 of file alarms.c.

SystemAlarmsAlarmOptions AlarmsGet ( SystemAlarmsAlarmElem  alarm)

Get an alarm

Parameters
alarmThe system alarm to be read
Returns
Alarm severity

Definition at line 129 of file alarms.c.

int32_t AlarmsHasCritical ( )

Check if there are any alarms with critical or higher severity

Returns
0 if no alarms are found, 1 if at least one alarm is found

Definition at line 210 of file alarms.c.

int32_t AlarmsHasErrors ( )

Check if there are any alarms with error or higher severity

Returns
0 if no alarms are found, 1 if at least one alarm is found

Definition at line 201 of file alarms.c.

int32_t AlarmsHasWarnings ( )

Check if there are any alarms with the given or higher severity

Returns
0 if no alarms are found, 1 if at least one alarm is found

Definition at line 192 of file alarms.c.

int32_t AlarmsInitialize ( void  )

Initialize the alarms library

Definition at line 51 of file alarms.c.

int32_t AlarmsSet ( SystemAlarmsAlarmElem  alarm,
SystemAlarmsAlarmOptions  severity 
)

Set an alarm

Parameters
alarmThe system alarm to be modified
severityThe alarm severity
Returns
0 if success, -1 if an error

Definition at line 97 of file alarms.c.

int32_t AlarmString ( SystemAlarmsData *  alarm,
char *  buf,
size_t  buflen,
bool  blink,
uint8_t *  state 
)

Produce a string indicating what alarms are currently firing.

Parameters
alarm]the current alarm state (from SystemAlarmsGet).
buf]where the alarm string should be written.
buflen]how many bytes may be safely written into buf.
blink]if true, alarms are replaced with spaces.
state]output variable indicating the most severe alarm found. The output variable 'state' is a value from the SystemAlarms alarm enum (e.g., SYSTEMALARMS_ALARM_WARNING).
Returns
The number of bytes written to the buffer.
static int32_t check_safe_autonomous ( )
static

Check the system is safe for autonomous flight.

If an autonomous mode is available, make sure all the configurations are valid for it

Definition at line 341 of file sanitycheck.c.

static int32_t check_safe_to_arm ( )
static

Check it is safe to arm in this position.

If the system is disarmed, look for a variety of conditions that make it unsafe to arm (that might not be dangerous to engage once flying).

Note this does not check every possible situation that prevents arming. In particular, transmitter_control checks for failsafe and ranges and switch arming configuration to allow/prevent arming.

Definition at line 293 of file sanitycheck.c.

static int32_t check_stabilization_rates ( )
static

Check a stabilization mode switch position for safety.

Check the rates achieved via stabilization are ones that can be tracked by the gyros as configured.

Returns
error code if not

Definition at line 370 of file sanitycheck.c.

static int32_t check_stabilization_settings ( int  index,
bool  multirotor 
)
static

Check a stabilization mode switch position for safety.

Checks the stabiliation settings for a paritcular mode and makes sure it is appropriate for the airframe

Parameters
[in]indexWhich stabilization mode to check
Returns
SYSTEMALARMS_CONFIGERROR_NONE or SYSTEMALARMS_CONFIGERROR_MULTIROTOR

Definition at line 210 of file sanitycheck.c.

int32_t configuration_check ( )

Run a preflight check over the hardware configuration and currently active modules

Definition at line 84 of file sanitycheck.c.

static void CovariancePrediction ( float  F[NUMX][NUMX],
float  G[NUMX][NUMW],
float  Q[NUMW],
float  dT,
float  P[NUMX][NUMX] 
)
static

Definition at line 402 of file insgps13state.c.

void date_from_timestamp ( uint32_t  timestamp,
DateTimeT *  date_time 
)

Convert UNIX timestamp to date/time Based on code from GNU C Library

Definition at line 51 of file timeutils.c.

DONT_BUILD_IF ( TASKINFO_RUNNING_NUMELEM!  = TASKINFO_STACKREMAINING_NUMELEM,
taskelems1   
)
DONT_BUILD_IF ( TASKINFO_RUNNING_NUMELEM!  = TASKINFO_RUNNINGTIME_NUMELEM,
taskelems2   
)
DONT_BUILD_IF ( MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM!  = MANUALCONTROLSETTINGS_STABILIZATION2SETTINGS_NUMELEM,
StabSettingsNumElem   
)
DONT_BUILD_IF ( MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM!  = MANUALCONTROLSETTINGS_STABILIZATION3SETTINGS_NUMELEM,
StabSettingsNumElem2   
)
DONT_BUILD_IF ( NELEMENTS(alarm_names)!  = SYSTEMALARMS_ALARM_NUMELEM,
AlarmArrayMismatch   
)
static int32_t hasSeverity ( SystemAlarmsAlarmOptions  severity)
static

Check if there are any alarms with the given or higher severity

Returns
0 if no alarms are found, 1 if at least one alarm is found

Definition at line 219 of file alarms.c.

uint16_t ins_get_num_states ( )

Definition at line 69 of file insgps13state.c.

void INSCorrection ( const float  mag_data[3],
const float  Pos[3],
const float  Vel[3],
float  BaroAlt,
uint16_t  SensorsUsed 
)

Correct the state and covariance estimate based on the sensors that were updated.

Definition at line 325 of file insgps13state.c.

void INSCovariancePrediction ( float  dT)

Compute an update of the state covariance.

Definition at line 320 of file insgps13state.c.

void INSGPSInit ( )

Reset the internal state variables and variances.

Main interface for running the filter

Definition at line 74 of file insgps13state.c.

void INSPosVelReset ( const float  pos[3],
const float  vel[3] 
)

Definition at line 220 of file insgps13state.c.

void INSResetP ( const float *  PDiag)

These methods alter the behavior of the filter

Definition at line 188 of file insgps13state.c.

void INSSetAccelBias ( const float  gyro_bias[3])

Definition at line 257 of file insgps13state.c.

void INSSetAccelVar ( const float  accel_var[3])

Definition at line 262 of file insgps13state.c.

void INSSetArmed ( bool  armed)

Set the current flight state.

Definition at line 126 of file insgps13state.c.

void INSSetBaroVar ( float  baro_var)

Definition at line 283 of file insgps13state.c.

void INSSetGyroBias ( const float  gyro_bias[3])

Definition at line 250 of file insgps13state.c.

void INSSetGyroVar ( const float  gyro_var[3])

Definition at line 269 of file insgps13state.c.

void INSSetMagNorth ( const float  B[3])

Definition at line 288 of file insgps13state.c.

void INSSetMagVar ( const float  scaled_mag_var[3])

Definition at line 276 of file insgps13state.c.

void INSSetPosVelVar ( float  PosVar,
float  VelVar,
float  VertPosVar 
)

Definition at line 240 of file insgps13state.c.

void INSSetState ( const float  pos[3],
const float  vel[3],
const float  q[4],
const float  gyro_bias[3],
const float  accel_bias[3] 
)

Definition at line 202 of file insgps13state.c.

void INSStatePrediction ( const float  gyro_data[3],
const float  accel_data[3],
float  dT 
)

Compute an update of the state estimate.

Definition at line 295 of file insgps13state.c.

static void LinearizeFG ( float  X[NUMX],
float  U[NUMU],
float  F[NUMX][NUMX],
float  G[NUMX][NUMW] 
)
static

Definition at line 1490 of file insgps13state.c.

static void LinearizeH ( float  X[NUMX],
float  Be[3],
float  H[NUMV][NUMX] 
)
static

Definition at line 1622 of file insgps13state.c.

bool lqg_sysident_check ( )

Definition at line 65 of file sanitycheck.c.

static void MeasurementEq ( float  X[NUMX],
float  Be[3],
float  Y[NUMV] 
)
static

Definition at line 1587 of file insgps13state.c.

static void path_circle ( const float *  center_point,
float  radius,
const float *  cur_point,
struct path_status status,
bool  clockwise 
)
static

Circle location continuously.

Parameters
[in]start_pointStarting point
[in]end_pointCenter point
[in]cur_pointCurrent location
[out]statusStructure containing progress along path and deviation

Definition at line 203 of file paths.c.

static void path_curve ( const float *  start_point,
const float *  end_point,
float  radius,
const float *  cur_point,
struct path_status status,
bool  clockwise 
)
static

Compute progress along circular path and deviation from it.

Parameters
[in]start_pointStarting point
[in]end_pointEnding point
[in]radiusRadius of the curve segment
[in]cur_pointCurrent location
[out]statusStructure containing progress along path and deviation

Definition at line 268 of file paths.c.

static void path_endpoint ( const float *  start_point,
const float *  end_point,
const float *  cur_point,
struct path_status status 
)
static

Compute progress towards endpoint. Deviation equals distance.

Parameters
[in]start_pointStarting point
[in]end_pointEnding point
[in]cur_pointCurrent location
[out]statusStructure containing progress along path and deviation

Definition at line 102 of file paths.c.

void path_progress ( const PathDesiredData *  pathDesired,
const float *  cur_point,
struct path_status status 
)

Compute progress along path and deviation from it.

Parameters
[in]start_pointStarting point
[in]end_pointEnding point
[in]cur_pointCurrent location
[in]modePath following mode
[out]statusStructure containing progress along path and deviation

Definition at line 62 of file paths.c.

static void path_vector ( const float *  start_point,
const float *  end_point,
const float *  cur_point,
struct path_status status 
)
static

Compute progress along path and deviation from it.

Parameters
[in]start_pointStarting point
[in]end_pointEnding point
[in]cur_pointCurrent location
[out]statusStructure containing progress along path and deviation

Definition at line 146 of file paths.c.

static void RungeKutta ( float  X[NUMX],
float  U[NUMU],
float  dT 
)
static

Definition at line 1398 of file insgps13state.c.

static void SerialUpdate ( float  H[NUMV][NUMX],
float  R[NUMV],
float  Z[NUMV],
float  Y[NUMV],
float  P[NUMX][NUMX],
float  X[NUMX],
uint16_t  SensorsUsed 
)
static

Definition at line 1354 of file insgps13state.c.

void set_config_error ( SystemAlarmsConfigErrorOptions  error_code)

Set the error code and alarm state

Parameters
[in]errorcode

Definition at line 391 of file sanitycheck.c.

static void StateEq ( float  X[NUMX],
float  U[NUMU],
float  Xdot[NUMX] 
)
static

Definition at line 1445 of file insgps13state.c.

int32_t TaskMonitorAdd ( TaskInfoRunningElem  task,
struct pios_thread *  threadp 
)

Register a task handle with the library

Definition at line 67 of file taskmonitor.c.

int32_t TaskMonitorInitialize ( void  )

Initialize library

Definition at line 50 of file taskmonitor.c.

bool TaskMonitorQueryRunning ( TaskInfoRunningElem  task)

Query if a task is running

Definition at line 105 of file taskmonitor.c.

int32_t TaskMonitorRemove ( TaskInfoRunningElem  task)

Remove a task handle from the library

Definition at line 86 of file taskmonitor.c.

void TaskMonitorUpdateAll ( void  )

Update the status of all tasks

Definition at line 116 of file taskmonitor.c.

int WMM_AssociatedLegendreFunction ( WMMtype_CoordSpherical CoordSpherical,
uint16_t  nMax,
WMMtype_LegendreFunction LegendreFunction 
)

Definition at line 308 of file WorldMagModel.c.

int WMM_CalculateGeoMagneticElements ( WMMtype_MagneticResults MagneticResultsGeo,
WMMtype_GeoMagneticElements GeoMagneticElements 
)

Definition at line 551 of file WorldMagModel.c.

int WMM_CalculateSecularVariation ( WMMtype_MagneticResults MagneticVariation,
WMMtype_GeoMagneticElements MagneticElements 
)

Definition at line 581 of file WorldMagModel.c.

int WMM_ComputeSphericalHarmonicVariables ( WMMtype_CoordSpherical CoordSpherical,
uint16_t  nMax,
WMMtype_SphericalHarmonicVariables SphVariables 
)

Definition at line 251 of file WorldMagModel.c.

int WMM_DateToYear ( uint16_t  month,
uint16_t  day,
uint16_t  year 
)

Definition at line 1089 of file WorldMagModel.c.

int WMM_GeodeticToSpherical ( WMMtype_CoordGeodetic CoordGeodetic,
WMMtype_CoordSpherical CoordSpherical 
)

Definition at line 1119 of file WorldMagModel.c.

int WMM_Geomag ( WMMtype_CoordSpherical CoordSpherical,
WMMtype_CoordGeodetic CoordGeodetic,
WMMtype_GeoMagneticElements GeoMagneticElements 
)

Definition at line 163 of file WorldMagModel.c.

float WMM_get_main_field_coeff_g ( uint16_t  index)

Comput the MainFieldCoeffH accounting for the date.

Definition at line 1013 of file WorldMagModel.c.

float WMM_get_main_field_coeff_h ( uint16_t  index)

Definition at line 1044 of file WorldMagModel.c.

float WMM_get_secular_var_coeff_g ( uint16_t  index)

Definition at line 1073 of file WorldMagModel.c.

float WMM_get_secular_var_coeff_h ( uint16_t  index)

Definition at line 1081 of file WorldMagModel.c.

int WMM_GetMagVector ( float  Lat,
float  Lon,
float  AltEllipsoid,
uint16_t  Month,
uint16_t  Day,
uint16_t  Year,
float  B[3] 
)

Definition at line 98 of file WorldMagModel.c.

int WMM_Initialize ( )

Definition at line 75 of file WorldMagModel.c.

int WMM_PcupHigh ( float *  Pcup,
float *  dPcup,
float  x,
uint16_t  nMax 
)

Definition at line 618 of file WorldMagModel.c.

int WMM_PcupLow ( float *  Pcup,
float *  dPcup,
float  x,
uint16_t  nMax 
)

Definition at line 763 of file WorldMagModel.c.

int WMM_RotateMagneticVector ( WMMtype_CoordSpherical CoordSpherical,
WMMtype_CoordGeodetic CoordGeodetic,
WMMtype_MagneticResults MagneticResultsSph,
WMMtype_MagneticResults MagneticResultsGeo 
)

Definition at line 508 of file WorldMagModel.c.

int WMM_SecVarSummation ( WMMtype_LegendreFunction LegendreFunction,
WMMtype_SphericalHarmonicVariables SphVariables,
WMMtype_CoordSpherical CoordSpherical,
WMMtype_MagneticResults MagneticResults 
)

Definition at line 432 of file WorldMagModel.c.

int WMM_SecVarSummationSpecial ( WMMtype_SphericalHarmonicVariables SphVariables,
WMMtype_CoordSpherical CoordSpherical,
WMMtype_MagneticResults MagneticResults 
)

Definition at line 950 of file WorldMagModel.c.

void WMM_Set_Coeff_Array ( )
int WMM_Summation ( WMMtype_LegendreFunction LegendreFunction,
WMMtype_SphericalHarmonicVariables SphVariables,
WMMtype_CoordSpherical CoordSpherical,
WMMtype_MagneticResults MagneticResults 
)

Definition at line 342 of file WorldMagModel.c.

int WMM_SummationSpecial ( WMMtype_SphericalHarmonicVariables SphVariables,
WMMtype_CoordSpherical CoordSpherical,
WMMtype_MagneticResults MagneticResults 
)

Definition at line 884 of file WorldMagModel.c.

Variable Documentation

const uint16_t __mon_yday[2][13]
static
Initial value:
= {
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
}

Definition at line 37 of file timeutils.c.

const char alarm_names[][10]
static
Initial value:
= {
[SYSTEMALARMS_ALARM_OUTOFMEMORY] = "MEMORY",
[SYSTEMALARMS_ALARM_CPUOVERLOAD] = "CPU",
[SYSTEMALARMS_ALARM_STACKOVERFLOW] = "STACK",
[SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION] = "CONFIG",
[SYSTEMALARMS_ALARM_EVENTSYSTEM] = {0},
[SYSTEMALARMS_ALARM_TELEMETRY] = {0},
[SYSTEMALARMS_ALARM_MANUALCONTROL] = "MANUAL",
[SYSTEMALARMS_ALARM_ACTUATOR] = "ACTUATOR",
[SYSTEMALARMS_ALARM_ATTITUDE] = "ATTITUDE",
[SYSTEMALARMS_ALARM_SENSORS] = "SENSORS",
[SYSTEMALARMS_ALARM_STABILIZATION] = "STAB",
[SYSTEMALARMS_ALARM_PATHFOLLOWER] = "P-FOLLOW",
[SYSTEMALARMS_ALARM_PATHPLANNER] = "P-PLAN",
[SYSTEMALARMS_ALARM_BATTERY] = "BATTERY",
[SYSTEMALARMS_ALARM_FLIGHTTIME] = "TIME",
[SYSTEMALARMS_ALARM_I2C] = "I2C",
[SYSTEMALARMS_ALARM_GPS] = "GPS",
[SYSTEMALARMS_ALARM_ALTITUDEHOLD] = "A-HOLD",
[SYSTEMALARMS_ALARM_BOOTFAULT] = "BOOT",
[SYSTEMALARMS_ALARM_GEOFENCE] = "GEOFENCE",
[SYSTEMALARMS_ALARM_TEMPBARO] = "TEMPBARO",
[SYSTEMALARMS_ALARM_GYROBIAS] = "GYROBIAS",
[SYSTEMALARMS_ALARM_ADC] = "ADC",
[SYSTEMALARMS_ALARM_GIMBAL] = "GIMBAL",
}

Definition at line 245 of file alarms.c.

float Be[3]
static

Definition at line 61 of file insgps13state.c.

const char boot_reason_names[][16]
static
Initial value:
= {
[SYSTEMALARMS_REBOOTCAUSE_BROWNOUT] = "BOOT:BROWNOUT",
[SYSTEMALARMS_REBOOTCAUSE_PINRESET] = "BOOT:PIN RESET",
[SYSTEMALARMS_REBOOTCAUSE_POWERONRESET] = "BOOT:PWR ON RST",
[SYSTEMALARMS_REBOOTCAUSE_SOFTWARERESET] = "BOOT:SW RESET",
[SYSTEMALARMS_REBOOTCAUSE_INDEPENDENTWATCHDOG] = "BOOT:INDY WDOG",
[SYSTEMALARMS_REBOOTCAUSE_WINDOWWATCHDOG] = "BOOT:WIN WDOG",
[SYSTEMALARMS_REBOOTCAUSE_LOWPOWER] = "BOOT:LOW POWER",
[SYSTEMALARMS_REBOOTCAUSE_UNDEFINED] = "BOOT:UNDEFINED",
}

Definition at line 305 of file alarms.c.

const float CoeffFile[91][6] = COEFFS_FROM_NASA
static

Definition at line 58 of file WorldMagModel.c.

const char config_error_names[][15]
static
Initial value:
= {
[SYSTEMALARMS_CONFIGERROR_STABILIZATION] = "CFG:STAB",
[SYSTEMALARMS_CONFIGERROR_MULTIROTOR] = "CFG:MULTIROTOR",
[SYSTEMALARMS_CONFIGERROR_AUTOTUNE] = "CFG:AUTOTUNE",
[SYSTEMALARMS_CONFIGERROR_ALTITUDEHOLD] = "CFG:AH1",
[SYSTEMALARMS_CONFIGERROR_POSITIONHOLD] = "CFG:POS-HOLD",
[SYSTEMALARMS_CONFIGERROR_PATHPLANNER] = "CFG:PATHPLAN",
[SYSTEMALARMS_CONFIGERROR_DUPLICATEPORTCFG] = "CFG:DUP PORT",
[SYSTEMALARMS_CONFIGERROR_NAVFILTER] = "CFG:NAVFILTER",
[SYSTEMALARMS_CONFIGERROR_UNSAFETOARM] = "CFG:UNSAFE",
[SYSTEMALARMS_CONFIGERROR_LQG] = "CFG:LQG",
[SYSTEMALARMS_CONFIGERROR_UNDEFINED] = "CFG:UNDEF",
[SYSTEMALARMS_CONFIGERROR_NONE] = {0},
}

Definition at line 275 of file alarms.c.

float decimal_date
static

Definition at line 62 of file WorldMagModel.c.

WMMtype_Ellipsoid Ellip
static

Definition at line 60 of file WorldMagModel.c.

float F[NUMX][NUMX]
static

Definition at line 60 of file insgps13state.c.

float G[NUMX][NUMW]
static

Definition at line 60 of file insgps13state.c.

float H[NUMV][NUMX]
static

Definition at line 60 of file insgps13state.c.

struct pios_thread* handles[TASKINFO_RUNNING_NUMELEM]
static

Definition at line 37 of file taskmonitor.c.

uint8_t __attribute__::hour

Definition at line 36 of file timeutils.h.

float K[NUMX][NUMV]
static

Definition at line 64 of file insgps13state.c.

uint32_t lastMonitorTime
static

Definition at line 38 of file taskmonitor.c.

struct pios_mutex* lock
static

Definition at line 36 of file taskmonitor.c.

struct pios_mutex* lock
static

Definition at line 43 of file alarms.c.

WMMtype_MagneticModel MagneticModel
static

Definition at line 61 of file WorldMagModel.c.

const char manual_control_names[][13]
static
Initial value:
= {
[SYSTEMALARMS_MANUALCONTROL_SETTINGS] = "MAN:SETTINGS",
[SYSTEMALARMS_MANUALCONTROL_NORX] = "MAN:NO RX",
[SYSTEMALARMS_MANUALCONTROL_ACCESSORY] = "MAN:ACC",
[SYSTEMALARMS_MANUALCONTROL_ALTITUDEHOLD] = "MAN:A-HOLD",
[SYSTEMALARMS_MANUALCONTROL_PATHFOLLOWER] = "MAN:PATH-F",
[SYSTEMALARMS_MANUALCONTROL_CHANNELCONFIGURATION] = "MAN:INPUT",
[SYSTEMALARMS_MANUALCONTROL_UNDEFINED] = "MAN:UNDEF",
[SYSTEMALARMS_MANUALCONTROL_NONE] = {0},
}

Definition at line 292 of file alarms.c.

uint8_t __attribute__::mday

Definition at line 37 of file timeutils.h.

uint8_t __attribute__::min

Definition at line 35 of file timeutils.h.

uint8_t __attribute__::mon

Definition at line 38 of file timeutils.h.

float P[NUMX][NUMX]
static

Definition at line 62 of file insgps13state.c.

float Q[NUMW]
static

Definition at line 63 of file insgps13state.c.

float R[NUMV]
static

Definition at line 63 of file insgps13state.c.

uint8_t __attribute__::sec

Definition at line 34 of file timeutils.h.

uint8_t __attribute__::wday

Definition at line 39 of file timeutils.h.

float X[NUMX]
static

Definition at line 62 of file insgps13state.c.

uint8_t __attribute__::year

Definition at line 40 of file timeutils.h.