v2019
Dependencies: CRAC-Strat_2019 SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Dependents: Codeprincipal_2019 CRAC-Strat_2019
Diff: Asservissement/Asservissement.cpp
- Revision:
- 12:14729d584500
- Parent:
- 11:ed13a480ddca
- Child:
- 14:c8fc06c4887f
--- a/Asservissement/Asservissement.cpp Mon May 02 19:40:59 2016 +0000 +++ b/Asservissement/Asservissement.cpp Mon May 09 09:10:17 2016 +0000 @@ -156,3 +156,40 @@ can1.write(msgTx); } + +/****************************************************************************************/ +/* FUNCTION NAME: setAsservissementEtat */ +/* DESCRIPTION : Activer ou désactiver l'asservissement */ +/****************************************************************************************/ +void setAsservissementEtat(unsigned char enable) +{ + CANMessage msgTx=CANMessage(); + msgTx.id=ASSERVISSEMENT_ENABLE; // Tx rotation autour du centre du robot + msgTx.len=1; + msgTx.format=CANStandard; + msgTx.type=CANData; + // Angle signé sur 2 octets + msgTx.data[0]=(unsigned char)((enable==0)?0:1); + + can1.write(msgTx); +} + + +/****************************************************************************************/ +/* FUNCTION NAME: SendSpeed */ +/* DESCRIPTION : Envoie un asservissement paramètre retournant à une vitesse */ +/****************************************************************************************/ +void SendSpeed (unsigned short vitesse, unsigned short acceleration) +{ + CANMessage msgTx=CANMessage(); + msgTx.id=ASSERVISSEMENT_CONFIG; + msgTx.format=CANStandard; + msgTx.type=CANData; + msgTx.len=4; + msgTx.data[0]=(unsigned char)(vitesse&0x00FF); + msgTx.data[1]=(unsigned char)((vitesse&0xFF00)>>8); + msgTx.data[2]=(unsigned char)(acceleration&0x00FF); + msgTx.data[3]=(unsigned char)((acceleration&0xFF00)>>8); + + can1.write(msgTx); +} \ No newline at end of file