v1
Fork of Communication_Robot by
Revision 13:bc19774be4df, committed 2016-06-07
- Comitter:
- palmdotax
- Date:
- Tue Jun 07 03:14:19 2016 +0000
- Parent:
- 12:3a814b754785
- Commit message:
- 55+
Changed in this revision
diff -r 3a814b754785 -r bc19774be4df Receiver.cpp --- a/Receiver.cpp Sun Jun 05 09:43:16 2016 +0000 +++ b/Receiver.cpp Tue Jun 07 03:14:19 2016 +0000 @@ -1,6 +1,7 @@ #include "mbed.h" #include "Receiver.h" - +#include "rplidar.h" +RPLidar lidar1; DigitalOut rs485_dirc(RS485_DIRC); @@ -380,3 +381,32 @@ return com->sendCommunicatePacket(&package); } +uint8_t Bear_Receiver::sendlidar() +{ + int i=0,j=1,k=0; + uint8_t intData[2]={0x00,0x01},floatData[2]; + ANDANTE_PROTOCOL_PACKET package; + //BUFFER_SIZE=143 + package.robotId = 0x00; + package.length = 22;//122 + package.instructionErrorId = WRITE_DATA; + for(i=0;i<20;i++) + { + package.parameter[i]=0xAA; + } + /* 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]; + package.parameter[j]=intData[1]; + i=i+2; + j=j+2; + k++; + + }*/ + + rs485_dirc=1; + wait_us(RS485_DELAY); + return com->sendCommunicatePacket(&package); + +}
diff -r 3a814b754785 -r bc19774be4df Receiver.h --- a/Receiver.h Sun Jun 05 09:43:16 2016 +0000 +++ b/Receiver.h Tue Jun 07 03:14:19 2016 +0000 @@ -35,6 +35,9 @@ uint8_t sendLowAngleRange(uint8_t,uint8_t*); uint8_t sendUpLinkLength(uint8_t,uint8_t*); uint8_t sendLowLinkLength(uint8_t,uint8_t*); + + + uint8_t sendlidar(); }; #endif
diff -r 3a814b754785 -r bc19774be4df communication.cpp --- a/communication.cpp Sun Jun 05 09:43:16 2016 +0000 +++ b/communication.cpp Tue Jun 07 03:14:19 2016 +0000 @@ -8,6 +8,7 @@ uint8_t COMMUNICATION::sendCommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet) { + uint8_t currentParameter = 0; bool isWholePacket = false; uint8_t encoderState = WAIT_ON_HEADER_0; @@ -16,8 +17,14 @@ Timer timer; timer.start(); +#ifdef ANDANTE_DEBUG + pc->printf("Write: %d ", ANDANTE_PROTOCOL_COMMAND_RESPONSE_TIMEOUT_MS); +#endif while((timer.read_ms() < ANDANTE_PROTOCOL_COMMAND_RESPONSE_TIMEOUT_MS) && (!isWholePacket)) { + + pc->printf("Write: %d ", ANDANTE_PROTOCOL_COMMAND_RESPONSE_TIMEOUT_MS); + if( serialCom->writeable()) {