Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CRAC-Strat_2017_homologation_gros_rob by
Diff: Asservissement/Asservissement.cpp
- Revision:
- 1:116040d14164
- Parent:
- 0:ad97421fb1fb
- Child:
- 4:88431b537477
--- a/Asservissement/Asservissement.cpp Wed Apr 13 22:04:54 2016 +0000 +++ b/Asservissement/Asservissement.cpp Fri Apr 15 10:49:40 2016 +0000 @@ -51,7 +51,7 @@ { CANMessage msgTx=CANMessage(); msgTx.id=ASSERVISSEMENT_ROTATION; // Tx rotation autour du centre du robot - msgTx.len=1; + msgTx.len=2; msgTx.format=CANStandard; msgTx.type=CANData; // Angle signé sur 2 octets @@ -59,4 +59,37 @@ msgTx.data[1]=(unsigned char)(angle>>8); can1.write(msgTx); +} + + +/*********************************************************************************************/ +/* FUNCTION NAME: GoStraight */ +/* DESCRIPTION : Transmission CAN correspondant à une ligne droite, avec ou sans recalage */ +/* recalage : 0 => pas de recalage */ +/* 1 => recalage en X */ +/* 2 => Recalage en Y */ +/* newValue : Uniquement en cas de recalage, indique la nouvelle valeur de l'odo */ +/* isEnchainement : Indique si il faut executer l'instruction en enchainement */ +/* 0 => non */ +/* 1 => oui */ +/*********************************************************************************************/ +void GoStraight (signed short distance,unsigned char recalage, unsigned short newValue, unsigned char isEnchainement) +{ + CANMessage msgTx=CANMessage(); + msgTx.id=ASSERVISSEMENT_RECALAGE; + msgTx.len=6; + msgTx.format=CANStandard; + msgTx.type=CANData; + // x sur 2 octets + msgTx.data[0]=(unsigned char)distance; + msgTx.data[1]=(unsigned char)(distance>>8); + //Recalage sur 1 octet + msgTx.data[2]=recalage; + //Valeur du recalage sur 2 octets + msgTx.data[3]=(unsigned char)newValue; + msgTx.data[4]=(unsigned char)(newValue>>8); + //Enchainement sur 1 octet + msgTx.data[5]=isEnchainement; + + can1.write(msgTx); } \ No newline at end of file