CRAC Team / Mbed 2 deprecated PHARE2021

Dependencies:   mbed bloc_8_pompe2 Herkulex_library_2022 ident_crac1 bloc_pompe2

Action_bras/actions.cpp

Committer:
ares1999
Date:
2022-03-08
Revision:
2:c7f2e7d8b305
Child:
3:77e937c315f1

File content as of revision 2:c7f2e7d8b305:

#include "actions.h"

uint8_t servos_bras_testeur[2] = {RLED_ON, 1}; 
uint16_t pos_testeur[1] = {400};

void fct_opti(void)
{
    //positionControl_Mul_ensemble_complex(1, 60, servos_bras_testeur, pos_testeur, SERIAL_BAS_DROITE);
//(uint8_t nb_servo, uint8_t playtime, uint8_t* data, uint16_t* pos, uint8_t numero_serial) // uint16_t position, uint8_t setLED, uint8_t id
    //wait_ms(3000);
    positionControl(AR_HAUT, 750, PLAYTIME, GLED_ON, SERIAL_BAS_DROITE);
    positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, GLED_ON, AR_MILIEU, 160, GLED_ON, SERIAL_BAS_DROITE);
    wait_ms(TEMPO_LONGUE);
    positionControl(AR_HAUT, 650, PLAYTIME, GLED_ON, SERIAL_BAS_DROITE);
    positionControl_Mul_ensemble(AR_BASE, 500, PLAYTIME, GLED_ON, AR_MILIEU, 600, GLED_ON, SERIAL_BAS_DROITE);
    wait_ms(TEMPO_LONGUE);
}

void fct_prise_avant(char serial_select)
{
    //Rangement
    positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, serial_select);
    positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
    wait_ms(2000);
    //Pré Prise
    positionControl(AV_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(AV_BASE, 500, PLAYTIME, GLED_ON, AV_MILIEU, 600, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    //Prise
    positionControl(AV_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(AV_BASE, 445, PLAYTIME, GLED_ON, AV_MILIEU, 590, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    //Rangement echantillon
    positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, BLED_ON, AV_MILIEU, 160, BLED_ON, serial_select);
    positionControl(AV_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
    wait_ms(3000);
}

void fct_prise_arriere(char serial_select)
{
    //Rangement
    positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, RLED_ON, AR_MILIEU, 160, RLED_ON, serial_select);
    positionControl(AR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
    wait_ms(2000);
    //Pré Prise
    positionControl(AR_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(AR_BASE, 500, PLAYTIME, GLED_ON, AR_MILIEU, 600, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    //Prise
    positionControl(AR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(AR_BASE, 445, PLAYTIME, GLED_ON, AR_MILIEU, 590, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    //Rangement echantillon
    positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, BLED_ON, AR_MILIEU, 160, BLED_ON, serial_select);
    positionControl(AR_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
    wait_ms(3000);
}

void fct_bras(void)
{
//Rangement bras bas
    positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE);
    positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE);
    wait_ms(TEMPO);
//Rangement bras haut
    positionControl_Mul_ensemble(AV_BASE, 955, PLAYTIME, RLED_ON, AV_MILIEU, 35, RLED_ON, SERIAL_HAUT);
    positionControl(AV_HAUT, 230, PLAYTIME, RLED_ON, SERIAL_HAUT);
    wait_ms(TEMPO_LONGUE);
    
//Prise bras bas
    positionControl(AV_HAUT, 685, PLAYTIME, GLED_ON, SERIAL_BAS_GAUCHE);
    positionControl_Mul_ensemble(AV_BASE, 445, PLAYTIME, GLED_ON, AV_MILIEU, 600, GLED_ON, SERIAL_BAS_GAUCHE);
    wait_ms(TEMPO_LONGUE);
//Passe bras bas
    positionControl_Mul_ensemble(AV_BASE, 470, 40, BLED_ON, AV_MILIEU, 800, BLED_ON, SERIAL_BAS_GAUCHE);
    wait_ms(TEMPO+250);
    positionControl(AV_HAUT, 250, 40, BLED_ON, SERIAL_BAS_GAUCHE);
    wait_ms(TEMPO_LONGUE);
    
//Prise bras haut
    positionControl(AV_HAUT, 630, PLAYTIME, GLED_ON, SERIAL_HAUT);
    wait_ms(500);
    positionControl_Mul_ensemble(AV_BASE, 800, PLAYTIME, GLED_ON, AV_MILIEU, 110, GLED_ON, SERIAL_HAUT);
    wait_ms(TEMPO_LONGUE);
//Pré rangement bras haut
    positionControl_Mul_ensemble(AV_BASE, 920, PLAYTIME, RLED_ON, AV_MILIEU, 70, RLED_ON, SERIAL_HAUT);
    positionControl(AV_HAUT, 650, PLAYTIME, RLED_ON, SERIAL_HAUT);
    
//Pré rangement bras bas
    positionControl_Mul_ensemble(AV_BASE, 520, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE);
    positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE);
    wait_ms(TEMPO_LONGUE);
//Rangement bras bas
    positionControl_Mul_ensemble(AV_HAUT, 750, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE);
    positionControl(AV_BASE, 1000, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE);
    wait_ms(TEMPO);
}