v2
Fork of Communication_Robot by
Revision 14:cf43df0ddb93, committed 2016-06-07
- Comitter:
- palmdotax
- Date:
- Tue Jun 07 17:22:37 2016 +0000
- Parent:
- 13:bc19774be4df
- Commit message:
- v2
Changed in this revision
Receiver.cpp | Show annotated file Show diff for this revision Revisions of this file |
Receiver.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r bc19774be4df -r cf43df0ddb93 Receiver.cpp --- a/Receiver.cpp Tue Jun 07 03:14:19 2016 +0000 +++ b/Receiver.cpp Tue Jun 07 17:22:37 2016 +0000 @@ -390,11 +390,8 @@ package.robotId = 0x00; package.length = 22;//122 package.instructionErrorId = WRITE_DATA; - for(i=0;i<20;i++) - { - package.parameter[i]=0xAA; - } - /* while(k<60) + + while(k<60) { //PC.printf("i= %d,j= %d,k = %d\n",i,j,k); FloatSep( lidar1.Data[k],intData,floatData); package.parameter[i]=intData[0]; @@ -403,10 +400,127 @@ j=j+2; k++; - }*/ + } rs485_dirc=1; wait_us(RS485_DELAY); return com->sendCommunicatePacket(&package); } +uint8_t Bear_Receiver::sendlidar2() +{ + int i=0,j=1,k=60; + uint8_t intData[2],floatData[2]; + ANDANTE_PROTOCOL_PACKET package; + //BUFFER_SIZE=143 + package.robotId = 0x00; + package.length = 122; + package.instructionErrorId = WRITE_DATA; + + while(k<120) + {//PC.printf("i= %d,j= %d,k = %d\n",i,j,k); + FloatSep( lidar1.Data[k],intData,floatData); + package.parameter[i]=intData[0]; + package.parameter[j]=intData[1]; + i=i+2; + j=j+2; + k++; + + } + //rs485_dirc1=1; + wait_us(RS485_DELAY); + return com->sendCommunicatePacket(&package); + +} +uint8_t Bear_Receiver::sendlidar3() +{ + int i=0,j=1,k=120; + uint8_t intData[2],floatData[2]; + ANDANTE_PROTOCOL_PACKET package; + //BUFFER_SIZE=143 + package.robotId = 0x00; + package.length = 122; + package.instructionErrorId = WRITE_DATA; + while(k<180) + {//PC.printf("i= %d,j= %d,k = %d\n",i,j,k); + FloatSep( lidar1.Data[k],intData,floatData); + package.parameter[i]=intData[0]; + package.parameter[j]=intData[1]; + i=i+2; + j=j+2; + k++; + } + //rs485_dirc1=1; + wait_us(RS485_DELAY); + return com->sendCommunicatePacket(&package); + +} +uint8_t Bear_Receiver::sendlidar4() +{ + int i=0,j=1,k=180; + uint8_t intData[2],floatData[2]; + ANDANTE_PROTOCOL_PACKET package; + //BUFFER_SIZE=143 + package.robotId = 0x00; + package.length = 122; + package.instructionErrorId = WRITE_DATA; + while(k<240) + {//PC.printf("i= %d,j= %d,k = %d\n",i,j,k); + FloatSep( lidar1.Data[k],intData,floatData); + package.parameter[i]=intData[0]; + package.parameter[j]=intData[1]; + i=i+2; + j=j+2; + k++; + } + // rs485_dirc1=1; + wait_us(RS485_DELAY); + return com->sendCommunicatePacket(&package); + +} +uint8_t Bear_Receiver::sendlidar5() +{ + int i=0,j=1,k=240; + uint8_t intData[2],floatData[2]; + ANDANTE_PROTOCOL_PACKET package; + //BUFFER_SIZE=143 + package.robotId = 0x00; + package.length = 122; + package.instructionErrorId = WRITE_DATA; + while(k<300) + {//PC.printf("i= %d,j= %d,k = %d\n",i,j,k); + FloatSep( lidar1.Data[k],intData,floatData); + package.parameter[i]=intData[0]; + package.parameter[j]=intData[1]; + i=i+2; + j=j+2; + k++; + } + + // rs485_dirc1=1; + wait_us(RS485_DELAY); + return com->sendCommunicatePacket(&package); +} +uint8_t Bear_Receiver::sendlidar6() +{ + int i=0,j=1,k=300; + uint8_t intData[2],floatData[2]; + ANDANTE_PROTOCOL_PACKET package; + //BUFFER_SIZE=143 + package.robotId = 0x00; + package.length = 122; + package.instructionErrorId = WRITE_DATA; + while(k<360) + {//PC.printf("i= %d,j= %d,k = %d\n",i,j,k); + FloatSep( lidar1.Data[k],intData,floatData); + package.parameter[i]=intData[0]; + package.parameter[j]=intData[1]; + i=i+2; + j=j+2; + k++; + } + // rs485_dirc1=1; + wait_us(RS485_DELAY); + return com->sendCommunicatePacket(&package); + +} \ No newline at end of file
diff -r bc19774be4df -r cf43df0ddb93 Receiver.h --- a/Receiver.h Tue Jun 07 03:14:19 2016 +0000 +++ b/Receiver.h Tue Jun 07 17:22:37 2016 +0000 @@ -38,6 +38,11 @@ uint8_t sendlidar(); + uint8_t sendlidar2(); + uint8_t sendlidar3(); + uint8_t sendlidar4(); + uint8_t sendlidar5(); + uint8_t sendlidar6(); }; #endif