![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
bio robot
Dependencies: MPU6050-DMP QEI_hw mbed-rpc mbed
Fork of MPU6050_Example by
Controls/Gains.h@20:f13b949b623b, 2015-12-11 (annotated)
- Committer:
- amandaghassaei
- Date:
- Fri Dec 11 08:54:32 2015 +0000
- Revision:
- 20:f13b949b623b
- Parent:
- 19:270735e44c98
publish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
amandaghassaei | 2:17b18ea93551 | 1 | #ifndef Gains_h |
amandaghassaei | 2:17b18ea93551 | 2 | #define Gains_h |
amandaghassaei | 2:17b18ea93551 | 3 | |
amandaghassaei | 9:1d9b24d7ac77 | 4 | #include "mbed.h" |
amandaghassaei | 2:17b18ea93551 | 5 | |
amandaghassaei | 9:1d9b24d7ac77 | 6 | class Gains { |
amandaghassaei | 2:17b18ea93551 | 7 | |
amandaghassaei | 2:17b18ea93551 | 8 | public: |
amandaghassaei | 2:17b18ea93551 | 9 | |
amandaghassaei | 2:17b18ea93551 | 10 | Gains(){ |
amandaghassaei | 18:0cfe72d8a006 | 11 | setSwingUpK(30); |
amandaghassaei | 18:0cfe72d8a006 | 12 | setSwingUpD(4); |
amandaghassaei | 19:270735e44c98 | 13 | setDesiredThetaP(0.05); |
amandaghassaei | 19:270735e44c98 | 14 | setSoftLimitsP(0.8); |
amandaghassaei | 18:0cfe72d8a006 | 15 | setTargetingK(1); |
amandaghassaei | 18:0cfe72d8a006 | 16 | setTargetingD(0); |
amandaghassaei | 5:c3d671959ef3 | 17 | } |
amandaghassaei | 5:c3d671959ef3 | 18 | |
amandaghassaei | 9:1d9b24d7ac77 | 19 | void setPC(Serial *pc){ |
amandaghassaei | 9:1d9b24d7ac77 | 20 | _pc = pc; |
amandaghassaei | 9:1d9b24d7ac77 | 21 | } |
amandaghassaei | 9:1d9b24d7ac77 | 22 | |
amandaghassaei | 9:1d9b24d7ac77 | 23 | void setSwingUpK(float k){ |
amandaghassaei | 9:1d9b24d7ac77 | 24 | _swingUpK = k; |
amandaghassaei | 2:17b18ea93551 | 25 | }; |
amandaghassaei | 9:1d9b24d7ac77 | 26 | void setSwingUpD(float d){ |
amandaghassaei | 9:1d9b24d7ac77 | 27 | _swingUpD = d; |
amandaghassaei | 2:17b18ea93551 | 28 | }; |
amandaghassaei | 14:d620415259b1 | 29 | void setDesiredThetaP(float p){ |
amandaghassaei | 14:d620415259b1 | 30 | _desiredThetaP = p; |
amandaghassaei | 2:17b18ea93551 | 31 | }; |
amandaghassaei | 19:270735e44c98 | 32 | void setSoftLimitsP(float p){ |
amandaghassaei | 19:270735e44c98 | 33 | _softLimitsP = p; |
amandaghassaei | 19:270735e44c98 | 34 | }; |
amandaghassaei | 17:8a0e647cf551 | 35 | void setTargetingK(float k){ |
amandaghassaei | 17:8a0e647cf551 | 36 | _targetingK = k; |
amandaghassaei | 17:8a0e647cf551 | 37 | }; |
amandaghassaei | 17:8a0e647cf551 | 38 | void setTargetingD(float d){ |
amandaghassaei | 17:8a0e647cf551 | 39 | _targetingD = d; |
amandaghassaei | 17:8a0e647cf551 | 40 | }; |
amandaghassaei | 2:17b18ea93551 | 41 | |
amandaghassaei | 9:1d9b24d7ac77 | 42 | float getSwingUpK(){ |
amandaghassaei | 9:1d9b24d7ac77 | 43 | return _swingUpK; |
amandaghassaei | 2:17b18ea93551 | 44 | }; |
amandaghassaei | 9:1d9b24d7ac77 | 45 | float getSwingUpD(){ |
amandaghassaei | 9:1d9b24d7ac77 | 46 | return _swingUpD; |
amandaghassaei | 2:17b18ea93551 | 47 | }; |
amandaghassaei | 14:d620415259b1 | 48 | float getDesiredThetaP(){ |
amandaghassaei | 14:d620415259b1 | 49 | return _desiredThetaP; |
amandaghassaei | 2:17b18ea93551 | 50 | }; |
amandaghassaei | 19:270735e44c98 | 51 | float getSoftLimitsP(){ |
amandaghassaei | 19:270735e44c98 | 52 | return _softLimitsP; |
amandaghassaei | 19:270735e44c98 | 53 | }; |
amandaghassaei | 17:8a0e647cf551 | 54 | float getTargetingK(){ |
amandaghassaei | 17:8a0e647cf551 | 55 | return _targetingK; |
amandaghassaei | 17:8a0e647cf551 | 56 | }; |
amandaghassaei | 17:8a0e647cf551 | 57 | float getTargetingD(){ |
amandaghassaei | 17:8a0e647cf551 | 58 | return _targetingD; |
amandaghassaei | 17:8a0e647cf551 | 59 | }; |
amandaghassaei | 2:17b18ea93551 | 60 | |
amandaghassaei | 2:17b18ea93551 | 61 | private: |
amandaghassaei | 2:17b18ea93551 | 62 | |
amandaghassaei | 9:1d9b24d7ac77 | 63 | Serial *_pc; |
amandaghassaei | 9:1d9b24d7ac77 | 64 | |
amandaghassaei | 9:1d9b24d7ac77 | 65 | float _swingUpK; |
amandaghassaei | 9:1d9b24d7ac77 | 66 | float _swingUpD; |
amandaghassaei | 14:d620415259b1 | 67 | float _desiredThetaP; |
amandaghassaei | 19:270735e44c98 | 68 | float _softLimitsP; |
amandaghassaei | 17:8a0e647cf551 | 69 | float _targetingK; |
amandaghassaei | 17:8a0e647cf551 | 70 | float _targetingD; |
amandaghassaei | 2:17b18ea93551 | 71 | |
amandaghassaei | 2:17b18ea93551 | 72 | }; |
amandaghassaei | 2:17b18ea93551 | 73 | |
amandaghassaei | 2:17b18ea93551 | 74 | #endif |