code petit robot pour homologation

Fork of CRAC-Strat_2017_V2 by CRAC Team

Revision:
9:d0042422d95a
Parent:
6:eddfa414fd11
Child:
11:ed13a480ddca
--- a/Asservissement/Asservissement.cpp	Wed Apr 27 13:05:03 2016 +0000
+++ b/Asservissement/Asservissement.cpp	Thu Apr 28 08:11:36 2016 +0000
@@ -134,3 +134,24 @@
 
     can1.write(msgTx);
 }
+
+void SetOdometrie (unsigned short canId, unsigned short x,unsigned short y,signed short theta)
+{
+    CANMessage msgTx=CANMessage();
+    msgTx.id=canId;
+    msgTx.format=CANStandard;
+    msgTx.type=CANData;
+    msgTx.len=6;
+
+        // x sur 2 octets
+    msgTx.data[0]=(unsigned char)x;
+    msgTx.data[1]=(unsigned char)(x>>8);
+    // y sur 2 octets
+    msgTx.data[2]=(unsigned char)y;
+    msgTx.data[3]=(unsigned char)(y>>8);
+    // theta signé sur 2 octets
+    msgTx.data[4]=(unsigned char)theta;
+    msgTx.data[5]=(unsigned char)(theta>>8);
+
+    can1.write(msgTx);
+}