ver2
Dependencies: ADXL345 AigamozuControlPackets HMC5843 ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST agz_common mbed
Fork of aigamozu_auto_ver1 by
Diff: main.cpp
- Revision:
- 2:e9a8664b52ff
- Parent:
- 1:a5f98c7e1feb
- Child:
- 3:7affc8af6db6
--- a/main.cpp Sat Apr 11 12:25:34 2015 +0000 +++ b/main.cpp Mon Apr 13 10:09:42 2015 +0000 @@ -120,7 +120,7 @@ //CommandType -> Send Status case STATUS_REQUEST:{ //Create GPS Infomation Packet - agz.createReceiveStatusCommand('B','a',myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL); + agz.createReceiveStatusCommand('D','a',myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL); //Select Destination ZBTxRequest tx64request(robot_Address,agz.packetData,agz.getPacketLength()); //Send -> Base @@ -133,12 +133,14 @@ printf("Receive Status\n"); - id = buf1[6] - 'A'; + id = buf1[5] - 'A'; robot[id].set_state(buf1[9]); robot[id].set_LatitudeH(&buf1[13]); robot[id].set_LatitudeL(&buf1[17]); robot[id].set_LongitudeH(&buf1[21]); robot[id].set_LongitudeL(&buf1[25]); + + agz.reNewBasePoint(id,robot[id].get_LatitudeH(),robot[id].get_LatitudeL(),robot[id].get_LongitudeH(),robot[id].get_LongitudeL()); printf("%d\n", id); printf("%ld, %ld, %ld, %ld\n", robot[id].get_LatitudeH(), robot[id].get_LatitudeL(), robot[id].get_LongitudeH(), robot[id].get_LongitudeL()); @@ -167,8 +169,8 @@ refresh_Timer.reset(); if (myGPS.fix) { agz.nowStatus = GPS_AVAIL; - agz.reNewPoint(myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL); - + agz.reNewRobotPoint(myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL); + printf("state = %d\n",agz.nowMode); printf("my %ld, %ld, %ld, %ld\n", myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL); } else agz.nowStatus = GPS_UNAVAIL; @@ -179,7 +181,7 @@ if( collect_Timer.read_ms() >= collect_Time){ collect_Timer.reset(); - printf("Send Request\n"); + printf("Send Request:%d,%d\n",collect_flag,collect_state); agz.createRequestCommand('A', collect_state); //Select Destination