CRAC Team / Mbed 2 deprecated carte_esclave201_petit_rob

Dependencies:   mbed Herkulex_Library_2019 actions_Gr ident_crac actions_Pr

Committer:
Artiom
Date:
Thu May 16 10:54:23 2019 +0000
Revision:
7:553f3f1c2c53
Parent:
6:45f9cf44718a
Child:
11:6c11c081c855
ack ventouses fonctionels

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Artiom 0:bc74da1c502f 1 #include "Actionneurs.h"
Artiom 0:bc74da1c502f 2 #include "ident_crac.h"
Artiom 0:bc74da1c502f 3 #include "mbed.h"
Artiom 0:bc74da1c502f 4 #include "fonctions_herkulex.h"
Artiom 1:568955af8c2b 5 #include "main.h"
Artiom 0:bc74da1c502f 6
Artiom 0:bc74da1c502f 7 #ifdef ROBOT_SMALL
Artiom 2:9e63099cca99 8 void gabarit_petit_robot(void)
Artiom 0:bc74da1c502f 9 {
Artiom 0:bc74da1c502f 10
Artiom 0:bc74da1c502f 11 uint8_t servos_av_gauche[4] = {RLED_ON, AV_EP_G, RLED_ON, AV_poigne_G};
Artiom 0:bc74da1c502f 12 uint8_t servos_av_centre[4] = {GLED_ON, AV_EP_C, GLED_ON, AV_poigne_C};
Artiom 0:bc74da1c502f 13 uint8_t servos_av_droite[4] = {BLED_ON, AV_EP_D, BLED_ON, AV_poigne_D};
Artiom 0:bc74da1c502f 14
Artiom 0:bc74da1c502f 15 uint16_t pos_av_gauche[2] = {520,780};//epaule,poigne520,780
Artiom 3:e2336813297b 16 uint16_t pos_av_centre[2] = {550,600};//470,350
Artiom 0:bc74da1c502f 17 uint16_t pos_av_droite[2] = {550,270};
Artiom 0:bc74da1c502f 18
Artiom 0:bc74da1c502f 19 uint8_t servos_ar_gauche[4] = {RLED_ON, AR_EP_G, RLED_ON, AR_poigne_G};
Artiom 0:bc74da1c502f 20 uint8_t servos_ar_centre[4] = {GLED_ON, AR_EP_C, GLED_ON, AR_poigne_C};
Artiom 0:bc74da1c502f 21 uint8_t servos_ar_droite[4] = {BLED_ON, AR_EP_D, BLED_ON, AR_poigne_D};
Artiom 0:bc74da1c502f 22
Artiom 0:bc74da1c502f 23 uint16_t pos_ar_gauche[2] = {530,780};
Artiom 3:e2336813297b 24 uint16_t pos_ar_centre[2] = {600,500};//500,250
Artiom 0:bc74da1c502f 25 uint16_t pos_ar_droite[2] = {430,200};
Artiom 0:bc74da1c502f 26
Artiom 1:568955af8c2b 27
Artiom 1:568955af8c2b 28 uint8_t servos_sol[4] = {GLED_ON, AR_sol, GLED_ON, AV_sol};
Artiom 4:4a79942713fa 29 uint16_t pos_sol[2] = {230,750}; //200 ,800 (90°)
Artiom 1:568955af8c2b 30
Artiom 0:bc74da1c502f 31 int speed=100;
Artiom 1:568955af8c2b 32
Artiom 0:bc74da1c502f 33 deverouillage_torque();
Artiom 0:bc74da1c502f 34 positionControl_Mul_ensemble_complex(2,speed,servos_av_gauche, pos_av_gauche,3);
Artiom 0:bc74da1c502f 35 positionControl_Mul_ensemble_complex(2,speed,servos_av_centre, pos_av_centre,2);
Artiom 0:bc74da1c502f 36 positionControl_Mul_ensemble_complex(2,speed,servos_av_droite, pos_av_droite,1);
Artiom 0:bc74da1c502f 37
Artiom 0:bc74da1c502f 38 positionControl_Mul_ensemble_complex(2,speed,servos_ar_gauche, pos_ar_gauche,1);
Artiom 0:bc74da1c502f 39 positionControl_Mul_ensemble_complex(2,speed,servos_ar_centre, pos_ar_centre,2);
Artiom 0:bc74da1c502f 40 positionControl_Mul_ensemble_complex(2,speed,servos_ar_droite, pos_ar_droite,3);
Artiom 1:568955af8c2b 41
Artiom 1:568955af8c2b 42 positionControl_Mul_ensemble_complex(2,speed,servos_sol, pos_sol,4);
Artiom 0:bc74da1c502f 43 }
Artiom 1:568955af8c2b 44
Artiom 0:bc74da1c502f 45 void presentoir_avant(void)
Artiom 0:bc74da1c502f 46 {
Artiom 0:bc74da1c502f 47 uint8_t servos_av_gauche[4] = {RLED_ON, AV_EP_G, RLED_ON, AV_poigne_G};
Artiom 0:bc74da1c502f 48 uint8_t servos_av_centre[4] = {GLED_ON, AV_EP_C, GLED_ON, AV_poigne_C};
Artiom 0:bc74da1c502f 49 uint8_t servos_av_droite[4] = {BLED_ON, AV_EP_D, BLED_ON, AV_poigne_D};
Artiom 0:bc74da1c502f 50
Artiom 0:bc74da1c502f 51 uint16_t pos_av_gauche[2] = {520,490};
Artiom 0:bc74da1c502f 52 uint16_t pos_av_centre[2] = {470,512};
Artiom 0:bc74da1c502f 53 uint16_t pos_av_droite[2] = {550,540};
Artiom 0:bc74da1c502f 54
Artiom 2:9e63099cca99 55 int speed=1;
Artiom 0:bc74da1c502f 56
Artiom 2:9e63099cca99 57 //deverouillage_torque();
Artiom 0:bc74da1c502f 58 positionControl_Mul_ensemble_complex(2,speed,servos_av_gauche, pos_av_gauche,3);
Artiom 0:bc74da1c502f 59 positionControl_Mul_ensemble_complex(2,speed,servos_av_centre, pos_av_centre,2);
Artiom 0:bc74da1c502f 60 positionControl_Mul_ensemble_complex(2,speed,servos_av_droite, pos_av_droite,1);
Artiom 2:9e63099cca99 61
Artiom 1:568955af8c2b 62 can.write(CANMessage(HACHEUR_GET_PRESENTOIR_AV));
Artiom 1:568955af8c2b 63 }
Artiom 0:bc74da1c502f 64
Artiom 0:bc74da1c502f 65 void presentoir_arriere(void)
Artiom 0:bc74da1c502f 66 {
Artiom 0:bc74da1c502f 67 uint8_t servos_ar_gauche[4] = {RLED_ON, AR_EP_G, RLED_ON, AR_poigne_G};
Artiom 0:bc74da1c502f 68 uint8_t servos_ar_centre[4] = {GLED_ON, AR_EP_C, GLED_ON, AR_poigne_C};
Artiom 0:bc74da1c502f 69 uint8_t servos_ar_droite[4] = {BLED_ON, AR_EP_D, BLED_ON, AR_poigne_D};
Artiom 0:bc74da1c502f 70
Artiom 0:bc74da1c502f 71 uint16_t pos_ar_gauche[2] = {530,512};
Artiom 0:bc74da1c502f 72 uint16_t pos_ar_centre[2] = {500,430};
Artiom 0:bc74da1c502f 73 uint16_t pos_ar_droite[2] = {430,470};
Artiom 0:bc74da1c502f 74
Artiom 2:9e63099cca99 75 int speed=1;
Artiom 0:bc74da1c502f 76
Artiom 2:9e63099cca99 77 //deverouillage_torque();
Artiom 0:bc74da1c502f 78 positionControl_Mul_ensemble_complex(2,speed,servos_ar_gauche, pos_ar_gauche,1);
Artiom 0:bc74da1c502f 79 positionControl_Mul_ensemble_complex(2,speed,servos_ar_centre, pos_ar_centre,2);
Artiom 0:bc74da1c502f 80 positionControl_Mul_ensemble_complex(2,speed,servos_ar_droite, pos_ar_droite,3);
Artiom 0:bc74da1c502f 81
Artiom 1:568955af8c2b 82 can.write(CANMessage(HACHEUR_GET_PRESENTOIR_AR));
Artiom 1:568955af8c2b 83
Artiom 0:bc74da1c502f 84 }
Artiom 1:568955af8c2b 85
Artiom 0:bc74da1c502f 86 void balance_avant(void)
Artiom 0:bc74da1c502f 87 {
Artiom 0:bc74da1c502f 88 uint8_t servos_av_gauche[4] = {RLED_ON, AV_EP_G, RLED_ON, AV_poigne_G};
Artiom 0:bc74da1c502f 89 uint8_t servos_av_centre[4] = {GLED_ON, AV_EP_C, GLED_ON, AV_poigne_C};
Artiom 0:bc74da1c502f 90 uint8_t servos_av_droite[4] = {BLED_ON, AV_EP_D, BLED_ON, AV_poigne_D};
Artiom 0:bc74da1c502f 91
Artiom 0:bc74da1c502f 92 uint16_t pos_av_gauche[2] = {800,780};
Artiom 0:bc74da1c502f 93 uint16_t pos_av_centre[2] = {200,220};
Artiom 0:bc74da1c502f 94 uint16_t pos_av_droite[2] = {250,270};
Artiom 0:bc74da1c502f 95
Artiom 1:568955af8c2b 96 int speed=25;
Artiom 0:bc74da1c502f 97
Artiom 0:bc74da1c502f 98 positionControl_Mul_ensemble_complex(2,speed,servos_av_gauche, pos_av_gauche,3);
Artiom 0:bc74da1c502f 99 positionControl_Mul_ensemble_complex(2,speed,servos_av_centre, pos_av_centre,2);
Artiom 0:bc74da1c502f 100 positionControl_Mul_ensemble_complex(2,speed,servos_av_droite, pos_av_droite,1);
Artiom 0:bc74da1c502f 101
Artiom 0:bc74da1c502f 102 }
Artiom 0:bc74da1c502f 103 void balance_arriere(void)
Artiom 0:bc74da1c502f 104 {
Artiom 0:bc74da1c502f 105 uint8_t servos_ar_gauche[4] = {RLED_ON, AR_EP_G, RLED_ON, AR_poigne_G};
Artiom 0:bc74da1c502f 106 uint8_t servos_ar_centre[4] = {GLED_ON, AR_EP_C, GLED_ON, AR_poigne_C};
Artiom 0:bc74da1c502f 107 uint8_t servos_ar_droite[4] = {BLED_ON, AR_EP_D, BLED_ON, AR_poigne_D};
Artiom 0:bc74da1c502f 108
Artiom 0:bc74da1c502f 109 uint16_t pos_ar_gauche[2] = {820,780};
Artiom 0:bc74da1c502f 110 uint16_t pos_ar_centre[2] = {230,150};
Artiom 0:bc74da1c502f 111 uint16_t pos_ar_droite[2] = {150,200};
Artiom 0:bc74da1c502f 112
Artiom 1:568955af8c2b 113 int speed=25;
Artiom 0:bc74da1c502f 114
Artiom 0:bc74da1c502f 115 positionControl_Mul_ensemble_complex(2,speed,servos_ar_gauche, pos_ar_gauche,1);
Artiom 0:bc74da1c502f 116 positionControl_Mul_ensemble_complex(2,speed,servos_ar_centre, pos_ar_centre,2);
Artiom 0:bc74da1c502f 117 positionControl_Mul_ensemble_complex(2,speed,servos_ar_droite, pos_ar_droite,3);
Artiom 0:bc74da1c502f 118
Artiom 0:bc74da1c502f 119 }
Artiom 0:bc74da1c502f 120
Artiom 1:568955af8c2b 121 void goldenium_avant(void)
Artiom 1:568955af8c2b 122 {
Artiom 1:568955af8c2b 123 uint8_t servos_av_centre[4] = {GLED_ON, AV_EP_C, GLED_ON, AV_poigne_C};
Artiom 1:568955af8c2b 124 uint16_t pos_av_centre[2] = {200,220};
Artiom 1:568955af8c2b 125 int speed=25;
Artiom 1:568955af8c2b 126
Artiom 1:568955af8c2b 127 positionControl_Mul_ensemble_complex(2,speed,servos_av_centre, pos_av_centre,2);
Artiom 1:568955af8c2b 128
Artiom 1:568955af8c2b 129 char pompe=AV_CENTRE;
Artiom 1:568955af8c2b 130 can.write(CANMessage(HACHEUR_GET_ATOM, &pompe,1));
Artiom 2:9e63099cca99 131
Artiom 1:568955af8c2b 132 }
Artiom 1:568955af8c2b 133
Artiom 1:568955af8c2b 134 void goldenium_arriere(void)
Artiom 1:568955af8c2b 135 {
Artiom 1:568955af8c2b 136 uint8_t servos_ar_centre[4] = {GLED_ON, AR_EP_C, GLED_ON, AR_poigne_C};
Artiom 1:568955af8c2b 137 uint16_t pos_ar_centre[2] = {230,150};
Artiom 1:568955af8c2b 138 int speed=25;
Artiom 2:9e63099cca99 139
Artiom 1:568955af8c2b 140 positionControl_Mul_ensemble_complex(2,speed,servos_ar_centre, pos_ar_centre,2);
Artiom 1:568955af8c2b 141
Artiom 1:568955af8c2b 142 char pompe=AR_CENTRE;
Artiom 1:568955af8c2b 143 can.write(CANMessage(HACHEUR_GET_ATOM, &pompe,1));
Artiom 2:9e63099cca99 144
Artiom 1:568955af8c2b 145 }
Artiom 1:568955af8c2b 146
Artiom 1:568955af8c2b 147 void accelerateur_avant(void)
Artiom 1:568955af8c2b 148 {
Artiom 1:568955af8c2b 149 uint8_t servos_av_gauche[4] = {RLED_ON, AV_EP_G, RLED_ON, AV_poigne_G};
Artiom 1:568955af8c2b 150 uint8_t servos_av_centre[4] = {GLED_ON, AV_EP_C, GLED_ON, AV_poigne_C};
Artiom 1:568955af8c2b 151 uint8_t servos_av_droite[4] = {BLED_ON, AV_EP_D, BLED_ON, AV_poigne_D};
Artiom 1:568955af8c2b 152
Artiom 1:568955af8c2b 153 uint16_t pos_av_gauche[2] = {800,490};
Artiom 1:568955af8c2b 154 uint16_t pos_av_centre[2] = {200,220};
Artiom 1:568955af8c2b 155 uint16_t pos_av_droite[2] = {250,540};
Artiom 1:568955af8c2b 156
Artiom 1:568955af8c2b 157 int speed=25;
Artiom 1:568955af8c2b 158
Artiom 1:568955af8c2b 159 positionControl_Mul_ensemble_complex(2,speed,servos_av_gauche, pos_av_gauche,3);
Artiom 1:568955af8c2b 160 positionControl_Mul_ensemble_complex(2,speed,servos_av_centre, pos_av_centre,2);
Artiom 1:568955af8c2b 161 positionControl_Mul_ensemble_complex(2,speed,servos_av_droite, pos_av_droite,1);
Artiom 6:45f9cf44718a 162 /*
Artiom 6:45f9cf44718a 163 for(char pompe=1; pompe<=3; pompe++) {
Artiom 6:45f9cf44718a 164 can.write(CANMessage(HACHEUR_RELEASE_ATOM, &pompe,1));
Artiom 6:45f9cf44718a 165 }*/
Artiom 2:9e63099cca99 166 can.write(CANMessage(HACHEUR_RELEASE_AV));
Artiom 1:568955af8c2b 167 }
Artiom 1:568955af8c2b 168 void accelerateur_arriere(void)
Artiom 1:568955af8c2b 169 {
Artiom 1:568955af8c2b 170 uint8_t servos_ar_gauche[4] = {RLED_ON, AR_EP_G, RLED_ON, AR_poigne_G};
Artiom 1:568955af8c2b 171 uint8_t servos_ar_centre[4] = {GLED_ON, AR_EP_C, GLED_ON, AR_poigne_C};
Artiom 1:568955af8c2b 172 uint8_t servos_ar_droite[4] = {BLED_ON, AR_EP_D, BLED_ON, AR_poigne_D};
Artiom 1:568955af8c2b 173
Artiom 1:568955af8c2b 174 uint16_t pos_ar_gauche[2] = {820,512};
Artiom 1:568955af8c2b 175 uint16_t pos_ar_centre[2] = {230,150};
Artiom 1:568955af8c2b 176 uint16_t pos_ar_droite[2] = {150,470};
Artiom 1:568955af8c2b 177
Artiom 1:568955af8c2b 178 int speed=25;
Artiom 1:568955af8c2b 179
Artiom 1:568955af8c2b 180 positionControl_Mul_ensemble_complex(2,speed,servos_ar_gauche, pos_ar_gauche,1);
Artiom 1:568955af8c2b 181 positionControl_Mul_ensemble_complex(2,speed,servos_ar_centre, pos_ar_centre,2);
Artiom 1:568955af8c2b 182 positionControl_Mul_ensemble_complex(2,speed,servos_ar_droite, pos_ar_droite,3);
Artiom 6:45f9cf44718a 183 /*
Artiom 6:45f9cf44718a 184 for(char pompe=5; pompe<=7; pompe++) {
Artiom 6:45f9cf44718a 185 can.write(CANMessage(HACHEUR_RELEASE_ATOM, &pompe,1));
Artiom 6:45f9cf44718a 186 }*/
Artiom 6:45f9cf44718a 187 can.write(CANMessage(HACHEUR_RELEASE_AR));
Artiom 2:9e63099cca99 188
Artiom 1:568955af8c2b 189 }
Artiom 1:568955af8c2b 190
Artiom 1:568955af8c2b 191
Artiom 1:568955af8c2b 192
Artiom 6:45f9cf44718a 193 void sol_avant_baisser(void)
Artiom 1:568955af8c2b 194 {
Artiom 1:568955af8c2b 195 int speed=1;
Artiom 1:568955af8c2b 196 char pompe=AV_BAS;
Artiom 1:568955af8c2b 197
Artiom 1:568955af8c2b 198 can.write(CANMessage(HACHEUR_GET_ATOM, &pompe,1));
Artiom 1:568955af8c2b 199 positionControl(AV_sol,512,speed,BLED_ON,4);//descend
Artiom 6:45f9cf44718a 200 }
Artiom 6:45f9cf44718a 201 void sol_avant_remonter(void)
Artiom 6:45f9cf44718a 202 {
Artiom 6:45f9cf44718a 203 int speed=1;
Artiom 1:568955af8c2b 204 positionControl(AV_sol,800,speed,BLED_ON,4);//remonte
Artiom 1:568955af8c2b 205 }
Artiom 1:568955af8c2b 206
Artiom 6:45f9cf44718a 207
Artiom 6:45f9cf44718a 208
Artiom 6:45f9cf44718a 209 void sol_arriere_baisser(void)
Artiom 1:568955af8c2b 210 {
Artiom 1:568955af8c2b 211 int speed=1;
Artiom 1:568955af8c2b 212 char pompe=AR_BAS;
Artiom 1:568955af8c2b 213
Artiom 1:568955af8c2b 214 can.write(CANMessage(HACHEUR_GET_ATOM, &pompe,1));
Artiom 1:568955af8c2b 215 positionControl(AR_sol,512,speed,BLED_ON,4);//descend
Artiom 6:45f9cf44718a 216 }
Artiom 6:45f9cf44718a 217 void sol_arriere_remonter(void)
Artiom 6:45f9cf44718a 218 {
Artiom 6:45f9cf44718a 219 int speed=1;
Artiom 1:568955af8c2b 220 positionControl(AR_sol,200,speed,BLED_ON,4);//remonte
Artiom 2:9e63099cca99 221 }
Artiom 2:9e63099cca99 222
Artiom 2:9e63099cca99 223
Artiom 2:9e63099cca99 224 void sol_avant_relache(void)
Artiom 2:9e63099cca99 225 {
Artiom 2:9e63099cca99 226 int speed=1;
Artiom 2:9e63099cca99 227 char pompe=AV_BAS;
Artiom 2:9e63099cca99 228
Artiom 2:9e63099cca99 229 positionControl(AV_sol,512,speed,BLED_ON,4);//descend
Artiom 1:568955af8c2b 230 can.write(CANMessage(HACHEUR_RELEASE_ATOM, &pompe,1));
Artiom 2:9e63099cca99 231
Artiom 7:553f3f1c2c53 232 wait(0.5);//faire automate dans main
Artiom 2:9e63099cca99 233
Artiom 2:9e63099cca99 234 positionControl(AV_sol,800,speed,BLED_ON,4);//remonte
Artiom 2:9e63099cca99 235 }
Artiom 2:9e63099cca99 236
Artiom 2:9e63099cca99 237 void sol_arriere_relache(void)
Artiom 2:9e63099cca99 238 {
Artiom 2:9e63099cca99 239 int speed=1;
Artiom 2:9e63099cca99 240 char pompe=AR_BAS;
Artiom 2:9e63099cca99 241
Artiom 2:9e63099cca99 242 positionControl(AR_sol,512,speed,BLED_ON,4);//descend
Artiom 2:9e63099cca99 243 can.write(CANMessage(HACHEUR_RELEASE_ATOM, &pompe,1));
Artiom 2:9e63099cca99 244
Artiom 7:553f3f1c2c53 245 wait(0.5);//faire automate dans main
Artiom 2:9e63099cca99 246
Artiom 2:9e63099cca99 247 positionControl(AR_sol,200,speed,BLED_ON,4);//remonte
Artiom 1:568955af8c2b 248 }
Artiom 1:568955af8c2b 249
Artiom 7:553f3f1c2c53 250 #endif
Artiom 7:553f3f1c2c53 251
Artiom 7:553f3f1c2c53 252 #ifdef ROBOT_BIG
Artiom 7:553f3f1c2c53 253
Artiom 1:568955af8c2b 254
Artiom 1:568955af8c2b 255
Artiom 1:568955af8c2b 256
Artiom 0:bc74da1c502f 257
Artiom 7:553f3f1c2c53 258 #endif
Artiom 7:553f3f1c2c53 259
Artiom 7:553f3f1c2c53 260