Skip to content

Commit

Permalink
[rotorcraft] error on negative gains
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Jun 3, 2014
1 parent 451087f commit 4601197
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
Expand Up @@ -40,7 +40,7 @@ struct Int32AttitudeGains stabilization_gains;
(STABILIZATION_ATTITUDE_PHI_IGAIN < 0) || \
(STABILIZATION_ATTITUDE_THETA_IGAIN < 0) || \
(STABILIZATION_ATTITUDE_PSI_IGAIN < 0)
#warning "ALL control gains are now positive!!!"
#error "ALL control gains have to be positive!!!"
#endif

struct Int32Eulers stabilization_att_sum_err;
Expand Down
Expand Up @@ -50,7 +50,7 @@ struct Int32AttitudeGains stabilization_gains = {
(STABILIZATION_ATTITUDE_PHI_IGAIN < 0) || \
(STABILIZATION_ATTITUDE_THETA_IGAIN < 0) || \
(STABILIZATION_ATTITUDE_PSI_IGAIN < 0)
#warning "ALL control gains are now positive!!!"
#error "ALL control gains have to be positive!!!"
#endif

struct Int32Quat stabilization_att_sum_err_quat;
Expand Down
27 changes: 10 additions & 17 deletions sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.c
Expand Up @@ -40,12 +40,6 @@

#define MAX_SUM_ERR 4000000

#if (STABILIZATION_RATE_GAIN_P < 0) || \
(STABILIZATION_RATE_GAIN_Q < 0) || \
(STABILIZATION_RATE_GAIN_R < 0)
#warning "ALL control gains are now positive!!!"
#endif

#ifndef STABILIZATION_RATE_DDGAIN_P
#define STABILIZATION_RATE_DDGAIN_P 0
#endif
Expand All @@ -58,24 +52,23 @@

#ifndef STABILIZATION_RATE_IGAIN_P
#define STABILIZATION_RATE_IGAIN_P 0
#else
#if (STABILIZATION_RATE_IGAIN_P < 0)
#warning "ALL control gains are now positive!!!"
#endif
#endif

#ifndef STABILIZATION_RATE_IGAIN_Q
#define STABILIZATION_RATE_IGAIN_Q 0
#else
#if (STABILIZATION_RATE_IGAIN_Q < 0)
#warning "ALL control gains are now positive!!!"
#endif
#endif

#ifndef STABILIZATION_RATE_IGAIN_R
#define STABILIZATION_RATE_IGAIN_R 0
#else
#if (STABILIZATION_RATE_IGAIN_R < 0)
#warning "ALL control gains are now positive!!!"
#endif

#if (STABILIZATION_RATE_GAIN_P < 0) || \
(STABILIZATION_RATE_GAIN_Q < 0) || \
(STABILIZATION_RATE_GAIN_R < 0) || \
(STABILIZATION_RATE_IGAIN_P < 0) || \
(STABILIZATION_RATE_IGAIN_Q < 0) || \
(STABILIZATION_RATE_IGAIN_R < 0)
#error "ALL control gains have to be positive!!!"
#endif

#ifndef STABILIZATION_RATE_REF_TAU
Expand Down

0 comments on commit 4601197

Please sign in to comment.