carte esclave petit robot
Dependencies: mbed Herkulex_Library_2019 actions_Gr ident_crac actions_Pr
Actionneurs/herkulex_rob.cpp@23:93a427b242ce, 2019-05-22 (annotated)
- Committer:
- kyxstark
- Date:
- Wed May 22 20:07:49 2019 +0000
- Revision:
- 23:93a427b242ce
- Child:
- 25:9627700d989f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kyxstark | 23:93a427b242ce | 1 | #include "main.h" |
kyxstark | 23:93a427b242ce | 2 | #include "herkulex_rob.h" |
kyxstark | 23:93a427b242ce | 3 | |
kyxstark | 23:93a427b242ce | 4 | |
kyxstark | 23:93a427b242ce | 5 | //---------------------------------------Petit robot--------------------------------------------------------- |
kyxstark | 23:93a427b242ce | 6 | /*void gros_robot_init(void) |
kyxstark | 23:93a427b242ce | 7 | { |
kyxstark | 23:93a427b242ce | 8 | void palet_accelerateur(){ |
kyxstark | 23:93a427b242ce | 9 | compteTour(ID,1000,1,1,PLED_ON,serialbarillet); |
kyxstark | 23:93a427b242ce | 10 | } |
kyxstark | 23:93a427b242ce | 11 | void palet_balance(){ |
kyxstark | 23:93a427b242ce | 12 | compteTour(ID,-1000,1,1,PLED_ON,serialbarillet); |
kyxstark | 23:93a427b242ce | 13 | } |
kyxstark | 23:93a427b242ce | 14 | void sortie_balance() |
kyxstark | 23:93a427b242ce | 15 | { |
kyxstark | 23:93a427b242ce | 16 | |
kyxstark | 23:93a427b242ce | 17 | } |
kyxstark | 23:93a427b242ce | 18 | |
kyxstark | 23:93a427b242ce | 19 | */ |
kyxstark | 23:93a427b242ce | 20 | |
kyxstark | 23:93a427b242ce | 21 | |
kyxstark | 23:93a427b242ce | 22 | #ifdef ROBOT_SMALL |
kyxstark | 23:93a427b242ce | 23 | //--------------------------------------------------------------------------------------------- |
kyxstark | 23:93a427b242ce | 24 | void deverouillage_torque (void) //débloquer les servomoteurs |
kyxstark | 23:93a427b242ce | 25 | { |
kyxstark | 23:93a427b242ce | 26 | deverouillage_torque_avant(); |
kyxstark | 23:93a427b242ce | 27 | deverouillage_torque_arriere(); |
kyxstark | 23:93a427b242ce | 28 | deverouillage_torque_sol(); |
kyxstark | 23:93a427b242ce | 29 | } |
kyxstark | 23:93a427b242ce | 30 | void deverouillage_torque_avant (void) |
kyxstark | 23:93a427b242ce | 31 | { |
kyxstark | 23:93a427b242ce | 32 | clear(AV_EP_G, 3); |
kyxstark | 23:93a427b242ce | 33 | clear(AV_poigne_G,3); |
kyxstark | 23:93a427b242ce | 34 | clear(AV_EP_C, 2); |
kyxstark | 23:93a427b242ce | 35 | clear(AV_poigne_C, 2); |
kyxstark | 23:93a427b242ce | 36 | clear(AV_EP_D, 1); |
kyxstark | 23:93a427b242ce | 37 | clear(AV_poigne_D,1); |
kyxstark | 23:93a427b242ce | 38 | |
kyxstark | 23:93a427b242ce | 39 | setTorque(AV_EP_G, TORQUE_ON,3); |
kyxstark | 23:93a427b242ce | 40 | setTorque(AV_poigne_G, TORQUE_ON,3); |
kyxstark | 23:93a427b242ce | 41 | setTorque(AV_EP_C, TORQUE_ON,2); |
kyxstark | 23:93a427b242ce | 42 | setTorque(AV_poigne_C, TORQUE_ON,2); |
kyxstark | 23:93a427b242ce | 43 | setTorque(AV_EP_D, TORQUE_ON,1); |
kyxstark | 23:93a427b242ce | 44 | setTorque(AV_poigne_D, TORQUE_ON,1); |
kyxstark | 23:93a427b242ce | 45 | } |
kyxstark | 23:93a427b242ce | 46 | |
kyxstark | 23:93a427b242ce | 47 | void deverouillage_torque_arriere (void) |
kyxstark | 23:93a427b242ce | 48 | { |
kyxstark | 23:93a427b242ce | 49 | clear(AR_EP_G, 3); |
kyxstark | 23:93a427b242ce | 50 | clear(AR_poigne_G,3); |
kyxstark | 23:93a427b242ce | 51 | clear(AR_EP_C, 2); |
kyxstark | 23:93a427b242ce | 52 | clear(AR_poigne_C, 2); |
kyxstark | 23:93a427b242ce | 53 | clear(AR_EP_D, 1); |
kyxstark | 23:93a427b242ce | 54 | clear(AR_poigne_D,1); |
kyxstark | 23:93a427b242ce | 55 | |
kyxstark | 23:93a427b242ce | 56 | setTorque(AR_EP_G, TORQUE_ON,1); |
kyxstark | 23:93a427b242ce | 57 | setTorque(AR_poigne_G, TORQUE_ON,1); |
kyxstark | 23:93a427b242ce | 58 | setTorque(AR_EP_C, TORQUE_ON,2); |
kyxstark | 23:93a427b242ce | 59 | setTorque(AR_poigne_C, TORQUE_ON,2); |
kyxstark | 23:93a427b242ce | 60 | setTorque(AR_EP_D, TORQUE_ON,3); |
kyxstark | 23:93a427b242ce | 61 | setTorque(AR_poigne_D, TORQUE_ON,3); |
kyxstark | 23:93a427b242ce | 62 | } |
kyxstark | 23:93a427b242ce | 63 | |
kyxstark | 23:93a427b242ce | 64 | |
kyxstark | 23:93a427b242ce | 65 | void deverouillage_torque_sol (void) |
kyxstark | 23:93a427b242ce | 66 | { |
kyxstark | 23:93a427b242ce | 67 | |
kyxstark | 23:93a427b242ce | 68 | clear(AR_sol,4); |
kyxstark | 23:93a427b242ce | 69 | clear(AV_sol,4); |
kyxstark | 23:93a427b242ce | 70 | |
kyxstark | 23:93a427b242ce | 71 | setTorque(AR_sol, TORQUE_ON,4); |
kyxstark | 23:93a427b242ce | 72 | setTorque(AV_sol, TORQUE_ON,4); |
kyxstark | 23:93a427b242ce | 73 | |
kyxstark | 23:93a427b242ce | 74 | } |
kyxstark | 23:93a427b242ce | 75 | |
kyxstark | 23:93a427b242ce | 76 | #endif |
kyxstark | 23:93a427b242ce | 77 | |
kyxstark | 23:93a427b242ce | 78 | #ifdef ROBOT_BIG |
kyxstark | 23:93a427b242ce | 79 | |
kyxstark | 23:93a427b242ce | 80 | void deverouillage_torque (void) //débloquer les servomoteurs |
kyxstark | 23:93a427b242ce | 81 | { |
kyxstark | 23:93a427b242ce | 82 | deverouillage_torque_bras(); |
kyxstark | 23:93a427b242ce | 83 | deverouillage_torque_convoyeurs(); |
kyxstark | 23:93a427b242ce | 84 | deverouillage_torque_doight(); |
kyxstark | 23:93a427b242ce | 85 | deverouillage_torque_roues(); |
kyxstark | 23:93a427b242ce | 86 | } |
kyxstark | 23:93a427b242ce | 87 | |
kyxstark | 23:93a427b242ce | 88 | |
kyxstark | 23:93a427b242ce | 89 | void deverouillage_torque_bras(void) |
kyxstark | 23:93a427b242ce | 90 | { |
kyxstark | 23:93a427b242ce | 91 | clear(AV_EP_C,2); |
kyxstark | 23:93a427b242ce | 92 | clear(AV_poigne_C,2); |
kyxstark | 23:93a427b242ce | 93 | |
kyxstark | 23:93a427b242ce | 94 | setTorque(AV_EP_C, TORQUE_ON,2); |
kyxstark | 23:93a427b242ce | 95 | setTorque(AV_poigne_C, TORQUE_ON,2); |
kyxstark | 23:93a427b242ce | 96 | } |
kyxstark | 23:93a427b242ce | 97 | |
kyxstark | 23:93a427b242ce | 98 | void deverouillage_torque_convoyeurs(void) |
kyxstark | 23:93a427b242ce | 99 | { |
kyxstark | 23:93a427b242ce | 100 | clear(stockage_D,3); |
kyxstark | 23:93a427b242ce | 101 | clear(stockage_G,1); |
kyxstark | 23:93a427b242ce | 102 | |
kyxstark | 23:93a427b242ce | 103 | setTorque(stockage_D, TORQUE_ON,3); |
kyxstark | 23:93a427b242ce | 104 | setTorque(stockage_G, TORQUE_ON,1); |
kyxstark | 23:93a427b242ce | 105 | } |
kyxstark | 23:93a427b242ce | 106 | |
kyxstark | 23:93a427b242ce | 107 | void deverouillage_torque_roues(void) |
kyxstark | 23:93a427b242ce | 108 | { |
kyxstark | 23:93a427b242ce | 109 | clear(roue_D,3); |
kyxstark | 23:93a427b242ce | 110 | clear(roue_G,1); |
kyxstark | 23:93a427b242ce | 111 | |
kyxstark | 23:93a427b242ce | 112 | setTorque(roue_D, TORQUE_ON,3); |
kyxstark | 23:93a427b242ce | 113 | setTorque(roue_G, TORQUE_ON,1); |
kyxstark | 23:93a427b242ce | 114 | } |
kyxstark | 23:93a427b242ce | 115 | |
kyxstark | 23:93a427b242ce | 116 | |
kyxstark | 23:93a427b242ce | 117 | void deverouillage_torque_doigt(void) |
kyxstark | 23:93a427b242ce | 118 | { |
kyxstark | 23:93a427b242ce | 119 | clear(doigt,2); |
kyxstark | 23:93a427b242ce | 120 | setTorque(doigt, TORQUE_ON,2); |
kyxstark | 23:93a427b242ce | 121 | } |
kyxstark | 23:93a427b242ce | 122 | |
kyxstark | 23:93a427b242ce | 123 | #endif |