Gurvan PRIEM
/
RaptorControl
An incomplete quadcopter control programme.
Utils/Utils.h@0:9cb9445a11f0, 2013-07-17 (annotated)
- Committer:
- Gurvan
- Date:
- Wed Jul 17 15:58:25 2013 +0000
- Revision:
- 0:9cb9445a11f0
Pour Zobson, fi(r)st commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gurvan | 0:9cb9445a11f0 | 1 | #ifndef _UTILS_H_ |
Gurvan | 0:9cb9445a11f0 | 2 | #define _UTILS_H_ |
Gurvan | 0:9cb9445a11f0 | 3 | |
Gurvan | 0:9cb9445a11f0 | 4 | #include "mbed.h" |
Gurvan | 0:9cb9445a11f0 | 5 | |
Gurvan | 0:9cb9445a11f0 | 6 | float max(float a, float b){ |
Gurvan | 0:9cb9445a11f0 | 7 | if(a>b) return a; |
Gurvan | 0:9cb9445a11f0 | 8 | else return b; |
Gurvan | 0:9cb9445a11f0 | 9 | } |
Gurvan | 0:9cb9445a11f0 | 10 | |
Gurvan | 0:9cb9445a11f0 | 11 | float min(float a, float b){ |
Gurvan | 0:9cb9445a11f0 | 12 | if(a<b) return a; |
Gurvan | 0:9cb9445a11f0 | 13 | else return b; |
Gurvan | 0:9cb9445a11f0 | 14 | } |
Gurvan | 0:9cb9445a11f0 | 15 | |
Gurvan | 0:9cb9445a11f0 | 16 | float clip(float m, float M, float a){ |
Gurvan | 0:9cb9445a11f0 | 17 | return max(min(M,a),m); |
Gurvan | 0:9cb9445a11f0 | 18 | } |
Gurvan | 0:9cb9445a11f0 | 19 | |
Gurvan | 0:9cb9445a11f0 | 20 | /*float abs(float a){ |
Gurvan | 0:9cb9445a11f0 | 21 | return max(a,-a); |
Gurvan | 0:9cb9445a11f0 | 22 | }*/ |
Gurvan | 0:9cb9445a11f0 | 23 | |
Gurvan | 0:9cb9445a11f0 | 24 | #endif |