Sorfware for Lexy ( Hexapode )
Dependencies: mbed BLE_API X_NUCLEO_IDB0XA1 MODSERIAL
SERVO/Motors.cpp@5:58acbceb4f9e, 2016-08-20 (annotated)
- Committer:
- Essenceia
- Date:
- Sat Aug 20 19:21:54 2016 +0000
- Revision:
- 5:58acbceb4f9e
- Parent:
- 1:8bab9152933e
Now needs to be debugger;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Essenceia | 0:edce82659847 | 1 | #include "Motors.h" |
Essenceia | 1:8bab9152933e | 2 | #include "LOGGER.h" |
Essenceia | 1:8bab9152933e | 3 | |
Essenceia | 1:8bab9152933e | 4 | Motors::Motors(char t, bool mid) |
Essenceia | 1:8bab9152933e | 5 | { |
Essenceia | 0:edce82659847 | 6 | |
Essenceia | 1:8bab9152933e | 7 | if(t<3) { |
Essenceia | 1:8bab9152933e | 8 | type=t; |
Essenceia | 1:8bab9152933e | 9 | middel=mid; |
Essenceia | 1:8bab9152933e | 10 | //on rempli les angles sellon le type |
Essenceia | 1:8bab9152933e | 11 | switch(type) { |
Essenceia | 1:8bab9152933e | 12 | case COAX: |
Essenceia | 1:8bab9152933e | 13 | if(middel) { |
Essenceia | 1:8bab9152933e | 14 | libre[0]=COAX_D1_MIL; |
Essenceia | 1:8bab9152933e | 15 | libre[1]=COAX_D2_MIL; |
Essenceia | 1:8bab9152933e | 16 | } else { |
Essenceia | 1:8bab9152933e | 17 | libre[0]=COAX_D1; |
Essenceia | 1:8bab9152933e | 18 | libre[1]=COAX_D2; |
Essenceia | 1:8bab9152933e | 19 | } |
Essenceia | 1:8bab9152933e | 20 | break; |
Essenceia | 1:8bab9152933e | 21 | case FEMUR: |
Essenceia | 1:8bab9152933e | 22 | libre[0]=FEMUR_D1; |
Essenceia | 1:8bab9152933e | 23 | libre[1]=FEMUR_D2; |
Essenceia | 1:8bab9152933e | 24 | break; |
Essenceia | 1:8bab9152933e | 25 | case TIBIA: |
Essenceia | 1:8bab9152933e | 26 | libre[0]=TIBIA_D1; |
Essenceia | 1:8bab9152933e | 27 | libre[1]=TIBIA_D2; |
Essenceia | 1:8bab9152933e | 28 | break; |
Essenceia | 1:8bab9152933e | 29 | } |
Essenceia | 1:8bab9152933e | 30 | } else Logger::Instance()->log("Erreur, le type donner est invalide"); |
Essenceia | 1:8bab9152933e | 31 | } |
Essenceia | 1:8bab9152933e | 32 | Motors::~Motors() |
Essenceia | 1:8bab9152933e | 33 | { |
Essenceia | 1:8bab9152933e | 34 | }; |
Essenceia | 1:8bab9152933e | 35 | |
Essenceia | 1:8bab9152933e | 36 | char Motors::get_type() |
Essenceia | 1:8bab9152933e | 37 | { |
Essenceia | 1:8bab9152933e | 38 | return type; |
Essenceia | 1:8bab9152933e | 39 | } |
Essenceia | 1:8bab9152933e | 40 | |
Essenceia | 1:8bab9152933e | 41 | bool Motors::is_valide_pos(int pos, bool D) |
Essenceia | 1:8bab9152933e | 42 | { |
Essenceia | 1:8bab9152933e | 43 | int i=1; |
Essenceia | 1:8bab9152933e | 44 | if(D) i=0; |
Essenceia | 1:8bab9152933e | 45 | if(pos>libre[i])return true; |
Essenceia | 1:8bab9152933e | 46 | else return false; |
Essenceia | 1:8bab9152933e | 47 | |
Essenceia | 1:8bab9152933e | 48 | } |