yokokawa

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

Fork of aigamozu_program_ver2 by aigamozu

Files at this revision

API Documentation at this revision

Comitter:
m5171135
Date:
Sun Jun 08 15:09:17 2014 +0000
Parent:
5:940424ec98a8
Child:
7:bfc65eac624e
Commit message:
ver 2.0

Changed in this revision

AigamozuControlPackets.lib Show annotated file Show diff for this revision Revisions of this file
VNH5019.lib 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	Sun Jun 08 11:55:07 2014 +0000
+++ b/AigamozuControlPackets.lib	Sun Jun 08 15:09:17 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/aigamozu/code/AigamozuControlPackets/#04dadf67ecb6
+http://mbed.org/teams/aigamozu/code/AigamozuControlPackets/#3f51eeb5aedc
--- a/VNH5019.lib	Sun Jun 08 11:55:07 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/teams/aigamozu/code/VNH5019/#656efbc86da4
--- a/main.cpp	Sun Jun 08 11:55:07 2014 +0000
+++ b/main.cpp	Sun Jun 08 15:09:17 2014 +0000
@@ -14,7 +14,6 @@
 #include "XBee.h"
 #include "MBed_Adafruit_GPS.h"
 #include "AigamozuControlPackets.h"
-#include "VNH5019.h"
 #include "agzIDLIST.h"
 #include "aigamozuSetting.h"
 
@@ -40,14 +39,8 @@
 //Pin Setting
 //
 /////////////////////////////////////////
-
-//Motor Contorol Pin Setting
-VNH5019 motorShield(p21,p22,p23,p24,p25,p26);
-
-
-//Interrupt Setting
-Ticker axis;
-Ticker auth_axis;
+Ticker hogehoge;
+VNH5019 agz_motorShield(p21,p22,p23,p24,p25,p26);
 
 /////////////////////////////////////////
 //
@@ -72,51 +65,6 @@
 int manual_count = 0;
 int manual_flag = 0;
 
-/////////////////////////////////////////
-//
-//Interruption processing 1: time -> 0.1s
-//
-/////////////////////////////////////////
-void axisRenovation(){
-        
-    if(manual_count > 100){
-        motorShield.changeSpeed(0,0,0,0);
-        manual_count = 0;
-    }
-    if(my_mode == 1) manual_count++;
-    }
-    
-/////////////////////////////////////////
-//
-//Interruption processing: time -> 1.0s
-//
-/////////////////////////////////////////
- 
- void normalRandomMode(){
-    
-    if(count < 20){
-        motorShield.changeSpeed(1,127,1,127);
-    }
-    else{
-        motorShield.changeSpeed(1,64,2,64);
-        if(count > 21) {
-            count = 0;
-            motorShield.changeSpeed(1,127,1,127);
-            }
-        } 
-    count++;
-    }
-    
-void gpsRandomMode(){
-    
-        
-            
-
-    }   
-
-
-
-
 
 /////////////////////////////////////////
 //
@@ -146,8 +94,7 @@
     wait(2);
        
     //interrupt start
-    axis.attach(&axisRenovation, 0.1);
-    AigamozuControlPackets agz(axis);
+    AigamozuControlPackets agz(agz_motorShield);
     refresh_Timer.start();
     
     
@@ -165,19 +112,7 @@
                  switch(agz.checkCommnadType(buf)){
                     //CommandType -> ChanegeMode
                     case CHANGE_MODE :{
-                        //Change Mode
-                        agz.changeMode(buf);
-                        //Motor Stop 
-                        motorShield.changeSpeed(0,0,0,0);
-                        //case: AUTO1
-                        if(agz.nowMode == AUTO_MODE)  auth_axis.attach(&normalRandomMode, 1.0);
-                        else if(agz.nowMode ==AUTO_GPS_MODE) auth_axis.attach(&gpsRandomMode, 1.0);
-                        else auth_axis.detach();
-                        
-                        //case:AUTO2
-                        
-                            
-                                        
+                        agz.changeMode(buf);                                        
                         break;
                         }
 
@@ -185,9 +120,7 @@
                     case MANUAL:{  
                         //Check now Mode
                         if(agz.nowMode == MANUAL_MODE){ 
-                                //manual_count = 0;
-                                //Change Motor Behavior
-                                motorShield.changeSpeed(buf[20],buf[21],buf[23],buf[24]);
+                            agz.changeSpeed(buf);
                             }
                         break;
                         }
@@ -198,7 +131,6 @@
                             agz.createReceiveStatusCommand('B','a',myGPS.longitudeH,myGPS.longitudeL,myGPS.latitudeH,myGPS.latitudeL);
                             //Select Destination
                             ZBTxRequest tx64request(remoteAddress,agz.packetData,agz.getPacketLength());
-                            
                             //Send -> Base
                             xbee.send(tx64request);
                             break;