Skip to content

Commit

Permalink
Eanbled crash/tubled detection. Closes #248
Browse files Browse the repository at this point in the history
I the sitaw module the crash/tumbled detection was enabled in case the
kalman estimator is used. Currently it is automatically used for the
flow and the LPS decks. It checks if the attitude angle is above 60 deg
for a period of time. If so shuts of motors until it comes back below 60
deg again.
  • Loading branch information
tobbeanton committed Aug 17, 2017
1 parent 56c6915 commit 9b8de82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/modules/interface/sitaw.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ void sitAwInit(void);
void sitAwUpdateSetpoint(setpoint_t *setpoint, const sensorData_t *sensorData,
const state_t *state);
/* Enable the situation awareness framework. */
//#define SITAW_ENABLED
#define SITAW_ENABLED
/* Enable the different functions of the situation awareness framework. */
//#define SITAW_FF_ENABLED /* Uncomment to enable */
//#define SITAW_AR_ENABLED /* Uncomment to enable */
#define SITAW_TU_ENABLED /* Uncomment to enable */

/* Configuration options for the 'Free Fall' detection. */
#define SITAW_FF_THRESHOLD 0.1 /* The default tolerance for AccWZ deviations from -1, indicating Free Fall. */
Expand Down
6 changes: 6 additions & 0 deletions src/modules/src/sitaw.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,13 @@ bool sitAwTuDetected(void)
*/
void sitAwInit(void)
{
#ifdef SITAW_FF_ENABLED
sitAwFFInit();
#endif
#ifdef SITAW_AR_ENABLED
sitAwARInit();
#endif
#ifdef SITAW_TU_ENABLED
sitAwTuInit();
#endif
}
7 changes: 4 additions & 3 deletions src/modules/src/stabilizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ void stabilizerInit(StateEstimatorType estimator)
stateEstimatorInit(estimator);
stateControllerInit();
powerDistributionInit();
#if defined(SITAW_ENABLED)
sitAwInit();
#endif
if (estimator == kalmanEstimator)
{
sitAwInit();
}

xTaskCreate(stabilizerTask, STABILIZER_TASK_NAME,
STABILIZER_TASK_STACKSIZE, NULL, STABILIZER_TASK_PRI, NULL);
Expand Down

0 comments on commit 9b8de82

Please sign in to comment.