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-04-26
Revision:
3:77e937c315f1
Parent:
2:c7f2e7d8b305

File content as of revision 3:77e937c315f1:

#include "actions.h"

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

/*void fct_prise_avant(char serial_select) //moteurs 1,2,3
{
    //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(TEMPO);
    //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(TEMPO);
}*/

void fct_prise_arriere(char serial_select) //moteurs 4,5,6
{
    //Rangement
    positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
    positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
    wait_ms(2000);
    //Pré Prise
    positionControl(BAR_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(BAR_BASE, 500, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    //Prise
    positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 590, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    //Rangement echantillon
    positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, BLED_ON, BAR_MILIEU, 160, BLED_ON, serial_select);
    positionControl(BAR_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
    wait_ms(3000);
}


void fct_prise(char moteur1, char moteur2, char moteur3,char serial_select)
{
    //Rangement
    positionControl_Mul_ensemble(moteur1, 570, PLAYTIME, RLED_ON, moteur2, 160, RLED_ON, serial_select);
    positionControl(moteur3, 750, PLAYTIME, RLED_ON, serial_select);
    wait_ms(2000);
    //Pré Prise
    positionControl(moteur3, 650, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(moteur1, 500, PLAYTIME, GLED_ON, moteur2, 600, GLED_ON, serial_select);
    wait_ms(2000);
    //Prise
    positionControl(moteur3, 685, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(moteur1, 445, PLAYTIME, GLED_ON, moteur2, 590, GLED_ON, serial_select);
    wait_ms(2000);
    //Rangement echantillon
    positionControl_Mul_ensemble(moteur1, 1000, PLAYTIME, BLED_ON, moteur2, 160, BLED_ON, serial_select);
    positionControl(moteur3, 510, PLAYTIME, BLED_ON, serial_select);
    wait_ms(2000);
}
/*

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);
}*/

void fct_bras_arriere(char serial_select)
{
//Rangement bras bas
    positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
    positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
    wait_ms(TEMPO);
//Rangement bras haut
    positionControl_Mul_ensemble(HAR_BASE, 955, PLAYTIME, RLED_ON, HAR_MILIEU, 35, RLED_ON, serial_select);
    positionControl(HAR_HAUT, 230, PLAYTIME, RLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    
//Prise bras bas
    positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
    positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
//Passe bras bas
    positionControl_Mul_ensemble(BAR_BASE, 470, 40, BLED_ON, BAR_MILIEU, 800, BLED_ON, serial_select);
    wait_ms(TEMPO+250);
    positionControl(BAR_HAUT, 250, 40, BLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
    
//Prise bras haut
    positionControl(HAR_HAUT, 630, PLAYTIME, GLED_ON, serial_select);
    wait_ms(500);
    positionControl_Mul_ensemble(HAR_BASE, 800, PLAYTIME, GLED_ON, HAR_MILIEU, 110, GLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
//Pré rangement bras haut
    positionControl_Mul_ensemble(HAR_BASE, 920, PLAYTIME, RLED_ON, HAR_MILIEU, 70, RLED_ON, serial_select);
    positionControl(HAR_HAUT, 650, PLAYTIME, RLED_ON, serial_select);
    
//Pré rangement bras bas
    positionControl_Mul_ensemble(BAR_BASE, 520, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
    positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
    wait_ms(TEMPO_LONGUE);
//Rangement bras bas
    positionControl_Mul_ensemble(BAR_HAUT, 750, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
    positionControl(BAR_BASE, 1000, PLAYTIME, RLED_ON, serial_select);
    wait_ms(TEMPO);
}

void activer_CN(void)
{
    positionControl_Mul_ensemble(CN_GAUCHE, 790, PLAYTIME, RLED_ON, CN_DROITE, 240, RLED_ON, SERIAL_SPECIAL);
    wait_ms(TEMPO);
}

void desactiver_CN(void)
{
    positionControl_Mul_ensemble(CN_GAUCHE, 240, PLAYTIME, RLED_ON, CN_DROITE, 790, RLED_ON, SERIAL_SPECIAL);
    wait_ms(TEMPO);
}