to Mineta

Dependencies:   VNH5019

Dependents:   agz_base_ver2 agz_base_ver2 get_GPS_data_ver1 aigamozu_program_ver2 ... more

Committer:
kityann
Date:
Wed Jun 18 13:48:02 2014 +0000
Revision:
3:282dad679fca
Parent:
2:3f2d4f53ceed
aigamo get data;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
m5171135 0:2b8b56ac7a82 1 #include "mbed.h"
m5171135 0:2b8b56ac7a82 2
m5171135 0:2b8b56ac7a82 3 #ifndef AIGAMOZU_CONTROL_PACKETS
m5171135 0:2b8b56ac7a82 4 #define AIGAMOZU_CONTROL_PACKETS
m5171135 0:2b8b56ac7a82 5
m5171135 2:3f2d4f53ceed 6 #define MANUAL_COMMAND_LENGTH 17
m5171135 2:3f2d4f53ceed 7 #define REQUEST_COMMNAD_LENGTH 11
m5171135 2:3f2d4f53ceed 8 #define CHANGE_MODE_COMMAND_LENGTH 12
m5171135 2:3f2d4f53ceed 9 #define RECEIVE_STATUS_COMMNAD_LENGTH 32
m5171135 0:2b8b56ac7a82 10
m5171135 0:2b8b56ac7a82 11 enum COMMAND_TYPE {MANUAL = 'M', STATUS_REQUEST = 'S', CHANGE_MODE = 'C', RECEIVE_STATUS = 'R'};
m5171135 1:80448565c15c 12 enum MODE {STANDBY_MODE = 0, MANUAL_MODE = 1,AUTO_MODE = 2};
m5171135 1:80448565c15c 13 enum STATUS {GPS_AVAIL = 0, GPS_UNAVAIL = 1};
m5171135 0:2b8b56ac7a82 14
m5171135 0:2b8b56ac7a82 15 union TEST_T{
m5171135 0:2b8b56ac7a82 16 long a;
m5171135 0:2b8b56ac7a82 17 uint8_t b[4];
m5171135 0:2b8b56ac7a82 18 };
m5171135 2:3f2d4f53ceed 19
m5171135 2:3f2d4f53ceed 20 /////////////////////////////////////////
m5171135 2:3f2d4f53ceed 21 //
m5171135 2:3f2d4f53ceed 22 //Interruption processing 1: time -> 0.1s
m5171135 2:3f2d4f53ceed 23 //
m5171135 2:3f2d4f53ceed 24 /////////////////////////////////////////
m5171135 0:2b8b56ac7a82 25
m5171135 0:2b8b56ac7a82 26 class AigamozuControlPackets{
m5171135 0:2b8b56ac7a82 27
m5171135 0:2b8b56ac7a82 28 public:
m5171135 2:3f2d4f53ceed 29 AigamozuControlPackets();
m5171135 2:3f2d4f53ceed 30
m5171135 2:3f2d4f53ceed 31
m5171135 2:3f2d4f53ceed 32 Ticker autoInt;
m5171135 0:2b8b56ac7a82 33
m5171135 2:3f2d4f53ceed 34 uint8_t* packetData;
m5171135 2:3f2d4f53ceed 35 //Create Packet: Controller/Base -> Robot
m5171135 2:3f2d4f53ceed 36 void createManualCommad(uint8_t fromID,uint8_t toID,uint8_t directionL,uint8_t pwmL,uint8_t directionR, uint8_t pwmR);
kityann 3:282dad679fca 37 void createRequestCommand(uint8_t fromID,uint8_t toID);
kityann 3:282dad679fca 38 void createChangeModeCommand(uint8_t fromID,uint8_t toID,MODE mode);
m5171135 0:2b8b56ac7a82 39
m5171135 2:3f2d4f53ceed 40 //Create Packet: Robot -> Controller/Base
m5171135 2:3f2d4f53ceed 41 void createReceiveStatusCommand(uint8_t fromID,uint8_t toID,long latitudeH,long latitudeL,long longitudeH,long longitudeL);
m5171135 2:3f2d4f53ceed 42 //uint8_t* createAckPacket(uint8_t fromID,uint8_t toID);
m5171135 0:2b8b56ac7a82 43
m5171135 2:3f2d4f53ceed 44 //using create packet
m5171135 2:3f2d4f53ceed 45 uint8_t* getPacketData();
m5171135 2:3f2d4f53ceed 46 int getPacketLength();
m5171135 2:3f2d4f53ceed 47
m5171135 2:3f2d4f53ceed 48
m5171135 2:3f2d4f53ceed 49 //------
m5171135 2:3f2d4f53ceed 50
m5171135 2:3f2d4f53ceed 51 //Change Mode:
m5171135 2:3f2d4f53ceed 52 bool changeMode(uint8_t *buf);
m5171135 0:2b8b56ac7a82 53
m5171135 0:2b8b56ac7a82 54 //
m5171135 0:2b8b56ac7a82 55 bool checkCommandAvilable(COMMAND_TYPE requestCommand);
m5171135 0:2b8b56ac7a82 56 uint8_t checkCommnadType(uint8_t* buf);
m5171135 0:2b8b56ac7a82 57
m5171135 2:3f2d4f53ceed 58
m5171135 0:2b8b56ac7a82 59 MODE nowMode;
m5171135 0:2b8b56ac7a82 60 STATUS nowStatus;
m5171135 2:3f2d4f53ceed 61
m5171135 0:2b8b56ac7a82 62 private:
m5171135 2:3f2d4f53ceed 63 int packetLength;
m5171135 2:3f2d4f53ceed 64
m5171135 2:3f2d4f53ceed 65
m5171135 2:3f2d4f53ceed 66
m5171135 2:3f2d4f53ceed 67
m5171135 0:2b8b56ac7a82 68 };
m5171135 0:2b8b56ac7a82 69
m5171135 0:2b8b56ac7a82 70 #endif