robot

Dependencies:   ADXL345 AigamozuControlPackets HMC5843 ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST mbed agz_common

Files at this revision

API Documentation at this revision

Comitter:
s1200058
Date:
Fri Apr 10 12:59:22 2015 +0000
Parent:
10:4a6059c5c84c
Commit message:
yokokawa;

Changed in this revision

AigamozuControlPackets.lib Show annotated file Show diff for this revision Revisions of this file
agzIDLIST.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/AigamozuControlPackets.lib	Thu Apr 09 11:18:07 2015 +0000
+++ b/AigamozuControlPackets.lib	Fri Apr 10 12:59:22 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/aigamozu/code/AigamozuControlPackets/#aff2d67d31c8
+http://mbed.org/teams/aigamozu/code/AigamozuControlPackets/#4f675487f06b
--- a/agzIDLIST.lib	Thu Apr 09 11:18:07 2015 +0000
+++ b/agzIDLIST.lib	Fri Apr 10 12:59:22 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/aigamozu/code/agzIDLIST/#5f1ff160078d
+http://mbed.org/teams/aigamozu/code/agzIDLIST/#f80f54b11696
--- a/main.cpp	Thu Apr 09 11:18:07 2015 +0000
+++ b/main.cpp	Fri Apr 10 12:59:22 2015 +0000
@@ -70,6 +70,7 @@
     char collect_state = 'a';
     XBeeAddress64 collect_Address[4] = {XBeeAddress64(BASE1_32H,BASE1_32L), XBeeAddress64(BASE2_32H,BASE2_32L), 
                                         XBeeAddress64(BASE3_32H,BASE3_32L), XBeeAddress64(BASE4_32H,BASE4_32L)};
+    XBeeAddress64 robot_Address = XBeeAddress64(ROBOT1_32H, ROBOT1_32L);
     int id;
   
     
@@ -101,6 +102,8 @@
                  //Check Command Type 
                  switch(agz.checkCommnadType(buf)){
                     
+                    printf("%c\n", buf[14]);
+                    
                     //CommandType -> ChanegeMode
                     case CHANGE_MODE :{
                         agz.changeMode(buf);                                        
@@ -121,15 +124,17 @@
                             //Create GPS Infomation Packet
                             agz.createReceiveStatusCommand('B','a',myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL);
                             //Select Destination
-                            ZBTxRequest tx64request(remoteAddress,agz.packetData,agz.getPacketLength());
+                            ZBTxRequest tx64request(robot_Address,agz.packetData,agz.getPacketLength());
                             //Send -> Base
                             xbee.send(tx64request);
                             break;         
           
                         }
                         
-                        case REQUEST_COMMAND:{
+                        case RECEIVE_STATUS:{
                             
+                            printf("ok\n");      
+                           
                             id = buf1[6] - 'A';
                             robot[id].set_state(buf1[9]);
                             robot[id].set_LatitudeH(&buf1[13]);
@@ -137,7 +142,8 @@
                             robot[id].set_LongitudeH(&buf1[21]);
                             robot[id].set_LongitudeL(&buf1[25]); 
                             
-                            printf("%ld, %ld, %ld, %ld\n", 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());
                             break;
                         }
                     
@@ -174,9 +180,8 @@
             collect_Timer.reset();
             
             printf("Send Request\n");
-            
-            //Create GPS Infomation Packet
-            agz.createReceiveStatusCommand('B', collect_state,myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL);
+                      
+            agz.createRequestCommand('A', collect_state);
             //Select Destination
             ZBTxRequest tx64request(collect_Address[collect_flag],agz.packetData,agz.getPacketLength());
             //Send -> Base
@@ -186,6 +191,7 @@
             collect_state++;
 
             if(collect_flag == 4){
+                printf("%d %c\n", collect_flag, collect_state);
                 collect_state = 'a';
                 collect_flag = 0;
             }