carte esclave Petit Robot

Dependencies:   mbed Herkulex_Library_2019 actions_Gr ident_crac actions_Pr

Committer:
Artiom
Date:
Fri May 31 21:03:45 2019 +0000
Revision:
46:85208ab1fa12
Parent:
45:3cb347342a0d
fork PR

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kyxstark 25:9627700d989f 1
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 {
Artiom 45:3cb347342a0d 32
kyxstark 23:93a427b242ce 33 clear(AV_EP_G, 3);
kyxstark 23:93a427b242ce 34 clear(AV_poigne_G,3);
kyxstark 23:93a427b242ce 35 clear(AV_EP_C, 2);
kyxstark 23:93a427b242ce 36 clear(AV_poigne_C, 2);
kyxstark 23:93a427b242ce 37 clear(AV_EP_D, 1);
kyxstark 23:93a427b242ce 38 clear(AV_poigne_D,1);
kyxstark 23:93a427b242ce 39
Artiom 45:3cb347342a0d 40 if(EtatGameEnd==0) {
Artiom 45:3cb347342a0d 41 setTorque(AV_EP_G, TORQUE_ON,3);
Artiom 45:3cb347342a0d 42 setTorque(AV_poigne_G, TORQUE_ON,3);
Artiom 45:3cb347342a0d 43 setTorque(AV_EP_C, TORQUE_ON,2);
Artiom 45:3cb347342a0d 44 setTorque(AV_poigne_C, TORQUE_ON,2);
Artiom 45:3cb347342a0d 45 setTorque(AV_EP_D, TORQUE_ON,1);
Artiom 45:3cb347342a0d 46 setTorque(AV_poigne_D, TORQUE_ON,1);
Artiom 45:3cb347342a0d 47 } else {
Artiom 45:3cb347342a0d 48 setTorque(AV_EP_G, TORQUE_FREE,3);
Artiom 45:3cb347342a0d 49 setTorque(AV_poigne_G, TORQUE_FREE,3);
Artiom 45:3cb347342a0d 50 setTorque(AV_EP_C, TORQUE_FREE,2);
Artiom 45:3cb347342a0d 51 setTorque(AV_poigne_C, TORQUE_FREE,2);
Artiom 45:3cb347342a0d 52 setTorque(AV_EP_D, TORQUE_FREE,1);
Artiom 45:3cb347342a0d 53 setTorque(AV_poigne_D, TORQUE_FREE,1);
Artiom 45:3cb347342a0d 54 }
Artiom 45:3cb347342a0d 55
kyxstark 23:93a427b242ce 56 }
kyxstark 23:93a427b242ce 57
kyxstark 23:93a427b242ce 58 void deverouillage_torque_arriere (void)
kyxstark 23:93a427b242ce 59 {
kyxstark 23:93a427b242ce 60 clear(AR_EP_G, 3);
kyxstark 23:93a427b242ce 61 clear(AR_poigne_G,3);
kyxstark 23:93a427b242ce 62 clear(AR_EP_C, 2);
kyxstark 23:93a427b242ce 63 clear(AR_poigne_C, 2);
kyxstark 23:93a427b242ce 64 clear(AR_EP_D, 1);
kyxstark 23:93a427b242ce 65 clear(AR_poigne_D,1);
kyxstark 23:93a427b242ce 66
Artiom 45:3cb347342a0d 67 if(EtatGameEnd==0) {
Artiom 45:3cb347342a0d 68 setTorque(AR_EP_G, TORQUE_ON,1);
Artiom 45:3cb347342a0d 69 setTorque(AR_poigne_G, TORQUE_ON,1);
Artiom 45:3cb347342a0d 70 setTorque(AR_EP_C, TORQUE_ON,2);
Artiom 45:3cb347342a0d 71 setTorque(AR_poigne_C, TORQUE_ON,2);
Artiom 45:3cb347342a0d 72 setTorque(AR_EP_D, TORQUE_ON,3);
Artiom 45:3cb347342a0d 73 setTorque(AR_poigne_D, TORQUE_ON,3);
Artiom 45:3cb347342a0d 74 } else {
Artiom 45:3cb347342a0d 75 setTorque(AR_EP_G, TORQUE_FREE,1);
Artiom 45:3cb347342a0d 76 setTorque(AR_poigne_G, TORQUE_FREE,1);
Artiom 45:3cb347342a0d 77 setTorque(AR_EP_C, TORQUE_FREE,2);
Artiom 45:3cb347342a0d 78 setTorque(AR_poigne_C, TORQUE_FREE,2);
Artiom 45:3cb347342a0d 79 setTorque(AR_EP_D, TORQUE_FREE,3);
Artiom 45:3cb347342a0d 80 setTorque(AR_poigne_D,TORQUE_FREE,3);
Artiom 45:3cb347342a0d 81 }
kyxstark 23:93a427b242ce 82 }
kyxstark 23:93a427b242ce 83
kyxstark 23:93a427b242ce 84
kyxstark 23:93a427b242ce 85 void deverouillage_torque_sol (void)
kyxstark 23:93a427b242ce 86 {
kyxstark 23:93a427b242ce 87
kyxstark 23:93a427b242ce 88 clear(AR_sol,4);
kyxstark 23:93a427b242ce 89 clear(AV_sol,4);
Artiom 45:3cb347342a0d 90 if(EtatGameEnd==0) {
Artiom 45:3cb347342a0d 91 setTorque(AR_sol, TORQUE_ON,4);
Artiom 45:3cb347342a0d 92 setTorque(AV_sol, TORQUE_ON,4);
Artiom 45:3cb347342a0d 93 } else {
Artiom 45:3cb347342a0d 94 setTorque(AR_sol, TORQUE_FREE,4);
Artiom 45:3cb347342a0d 95 setTorque(AV_sol, TORQUE_FREE,4);
Artiom 45:3cb347342a0d 96 }
kyxstark 23:93a427b242ce 97 }
kyxstark 23:93a427b242ce 98
Artiom 45:3cb347342a0d 99 #endif
kyxstark 23:93a427b242ce 100
kyxstark 23:93a427b242ce 101 #ifdef ROBOT_BIG
kyxstark 23:93a427b242ce 102
kyxstark 23:93a427b242ce 103 void deverouillage_torque (void) //débloquer les servomoteurs
kyxstark 23:93a427b242ce 104 {
kyxstark 23:93a427b242ce 105 deverouillage_torque_bras();
kyxstark 23:93a427b242ce 106 deverouillage_torque_convoyeurs();
kyxstark 26:4a3467da3243 107 deverouillage_torque_doigt();
kyxstark 23:93a427b242ce 108 deverouillage_torque_roues();
kyxstark 23:93a427b242ce 109 }
kyxstark 23:93a427b242ce 110
kyxstark 23:93a427b242ce 111
kyxstark 23:93a427b242ce 112 void deverouillage_torque_bras(void)
kyxstark 23:93a427b242ce 113 {
kyxstark 23:93a427b242ce 114 clear(AV_EP_C,2);
kyxstark 23:93a427b242ce 115 clear(AV_poigne_C,2);
kyxstark 23:93a427b242ce 116
kyxstark 23:93a427b242ce 117 setTorque(AV_EP_C, TORQUE_ON,2);
kyxstark 23:93a427b242ce 118 setTorque(AV_poigne_C, TORQUE_ON,2);
kyxstark 23:93a427b242ce 119 }
kyxstark 23:93a427b242ce 120
kyxstark 23:93a427b242ce 121 void deverouillage_torque_convoyeurs(void)
kyxstark 23:93a427b242ce 122 {
kyxstark 23:93a427b242ce 123 clear(stockage_D,3);
kyxstark 23:93a427b242ce 124 clear(stockage_G,1);
kyxstark 23:93a427b242ce 125
kyxstark 23:93a427b242ce 126 setTorque(stockage_D, TORQUE_ON,3);
kyxstark 23:93a427b242ce 127 setTorque(stockage_G, TORQUE_ON,1);
kyxstark 23:93a427b242ce 128 }
marwanesaich 42:a7300d563596 129 void deverouillage_torque_convoyeurs_gauche(void)
marwanesaich 42:a7300d563596 130 {
marwanesaich 42:a7300d563596 131 clear(stockage_G,1);
marwanesaich 42:a7300d563596 132
marwanesaich 42:a7300d563596 133 setTorque(stockage_G, TORQUE_ON,1);
marwanesaich 42:a7300d563596 134 }
marwanesaich 42:a7300d563596 135 void deverouillage_torque_convoyeurs_droit(void)
marwanesaich 42:a7300d563596 136 {
marwanesaich 42:a7300d563596 137 clear(stockage_D,3);
marwanesaich 42:a7300d563596 138
marwanesaich 42:a7300d563596 139 setTorque(stockage_D, TORQUE_ON,3);
marwanesaich 42:a7300d563596 140 }
kyxstark 23:93a427b242ce 141
kyxstark 23:93a427b242ce 142 void deverouillage_torque_roues(void)
kyxstark 23:93a427b242ce 143 {
kyxstark 23:93a427b242ce 144 clear(roue_D,3);
kyxstark 23:93a427b242ce 145 clear(roue_G,1);
kyxstark 23:93a427b242ce 146
kyxstark 23:93a427b242ce 147 setTorque(roue_D, TORQUE_ON,3);
kyxstark 23:93a427b242ce 148 setTorque(roue_G, TORQUE_ON,1);
kyxstark 23:93a427b242ce 149 }
kyxstark 23:93a427b242ce 150
kyxstark 23:93a427b242ce 151
kyxstark 23:93a427b242ce 152 void deverouillage_torque_doigt(void)
kyxstark 23:93a427b242ce 153 {
kyxstark 23:93a427b242ce 154 clear(doigt,2);
kyxstark 23:93a427b242ce 155 setTorque(doigt, TORQUE_ON,2);
kyxstark 23:93a427b242ce 156 }
kyxstark 23:93a427b242ce 157
kyxstark 23:93a427b242ce 158 #endif