palm and chin / BEAR_Protocol_Edited

Dependencies:   Communication_Robot

Fork of BEAR_Protocol by BE@R lab

Files at this revision

API Documentation at this revision

Comitter:
b0ssiz
Date:
Fri Jan 22 10:21:37 2016 +0000
Parent:
10:2398eeafa967
Child:
12:6296cb35f853
Commit message:
Update; - Change function setBodyLength to setBodyWidth; - Change function getBodyLength to getBodyWidth; - Change macro BODY_LENGTH to BODY_WIDTH

Changed in this revision

BEAR_Protocol.cpp Show annotated file Show diff for this revision Revisions of this file
BEAR_Protocol.h Show annotated file Show diff for this revision Revisions of this file
Command.h Show annotated file Show diff for this revision Revisions of this file
--- a/BEAR_Protocol.cpp	Fri Jan 22 02:25:26 2016 +0000
+++ b/BEAR_Protocol.cpp	Fri Jan 22 10:21:37 2016 +0000
@@ -817,21 +817,21 @@
 
 
 
-uint8_t Bear_Communicate::setBodyLength(uint8_t id,float body_length)
+uint8_t Bear_Communicate::setBodyWidth(uint8_t id,float body_width)
 {
-    uint8_t IntBodyLength[2],FloatBodyLength[2];
-    FloatSep(body_length,IntBodyLength,FloatBodyLength);
+    uint8_t IntBodyWidth[2],FloatBodyWidth[2];
+    FloatSep(body_width,IntBodyWidth,FloatBodyWidth);
 
     ANDANTE_PROTOCOL_PACKET package;
 
     package.robotId = id;
     package.length = 7;
     package.instructionErrorId = WRITE_DATA;
-    package.parameter[0]=BODY_LENGTH;
-    package.parameter[1]=IntBodyLength[0];
-    package.parameter[2]=IntBodyLength[1];
-    package.parameter[3]=FloatBodyLength[0];
-    package.parameter[4]=FloatBodyLength[1];
+    package.parameter[0]=BODY_WIDTH;
+    package.parameter[1]=IntBodyWidth[0];
+    package.parameter[2]=IntBodyWidth[1];
+    package.parameter[3]=FloatBodyWidth[0];
+    package.parameter[4]=FloatBodyWidth[1];
 
     rs485_dirc=1;
     wait_us(RS485_DELAY);
@@ -841,16 +841,16 @@
 
 
 
-uint8_t Bear_Communicate::getBodyLength(uint8_t id,float *body_length)
+uint8_t Bear_Communicate::getBodyWidth(uint8_t id,float *body_width)
 {
-    uint8_t IntBodyLength[2],FloatBodyLength[2];
+    uint8_t IntBodyWidth[2],FloatBodyWidth[2];
     float int_buffer,float_buffer;
     ANDANTE_PROTOCOL_PACKET package;
 
     package.robotId = id;
     package.length = 3;
     package.instructionErrorId = READ_DATA;
-    package.parameter[0]=BODY_LENGTH;
+    package.parameter[0]=BODY_WIDTH;
 
 
     rs485_dirc=1;
@@ -861,13 +861,13 @@
     wait_us(RS485_DELAY);
     uint8_t status=com->receiveCommunicatePacket(&package);
     if(status == ANDANTE_ERRBIT_NONE) {
-        IntBodyLength[0]=package.parameter[0];
-        IntBodyLength[1]=package.parameter[1];
-        FloatBodyLength[0]=package.parameter[2];
-        FloatBodyLength[1]=package.parameter[3];
-        int_buffer=(float)Utilities::ConvertUInt8ArrayToInt16(IntBodyLength);
-        float_buffer=(float)Utilities::ConvertUInt8ArrayToInt16(FloatBodyLength)/FLOAT_CONVERTER;
-        *body_length=int_buffer+float_buffer;
+        IntBodyWidth[0]=package.parameter[0];
+        IntBodyWidth[1]=package.parameter[1];
+        FloatBodyWidth[0]=package.parameter[2];
+        FloatBodyWidth[1]=package.parameter[3];
+        int_buffer=(float)Utilities::ConvertUInt8ArrayToInt16(IntBodyWidth);
+        float_buffer=(float)Utilities::ConvertUInt8ArrayToInt16(FloatBodyWidth)/FLOAT_CONVERTER;
+        *body_width=int_buffer+float_buffer;
     }
     return status;
 }
--- a/BEAR_Protocol.h	Fri Jan 22 02:25:26 2016 +0000
+++ b/BEAR_Protocol.h	Fri Jan 22 10:21:37 2016 +0000
@@ -32,7 +32,7 @@
     uint8_t setWheelPos(uint8_t,float);
     uint8_t setMagData(uint8_t,float,float,float,float,float,float);
     uint8_t setOffset(uint8_t,float,float);
-    uint8_t setBodyLength(uint8_t,float);
+    uint8_t setBodyWidth(uint8_t,float);
     uint8_t setUpAngleRange(uint8_t,float,float);
     uint8_t setLowAngleRange(uint8_t,float,float);
     uint8_t setUpLinkLength(uint8_t,float);
@@ -49,7 +49,7 @@
     uint8_t getWheelPos(uint8_t,float*);
     uint8_t getMagData(uint8_t,float*,float*,float*,float*,float*,float*);
     uint8_t getOffset(uint8_t,float*,float*);
-    uint8_t getBodyLength(uint8_t,float*);
+    uint8_t getBodyWidth(uint8_t,float*);
     uint8_t getUpAngleRange(uint8_t,float*,float*);
     uint8_t getLowAngleRange(uint8_t,float*,float*);
     uint8_t getUpLinkLength(uint8_t,float*);
--- a/Command.h	Fri Jan 22 02:25:26 2016 +0000
+++ b/Command.h	Fri Jan 22 10:21:37 2016 +0000
@@ -21,7 +21,7 @@
 #define WHEELPOS           0x0E
 #define MAG_DATA           0x0F
 #define OFFSET             0x10
-#define BODY_LENGTH        0x11
+#define BODY_WIDTH         0x11
 #define ANGLE_RANGE_UP     0x12
 #define ANGLE_RANGE_LOW    0x13
 #define UP_LINK_LENGTH     0x14