to Mineta

Dependencies:   VNH5019

Dependents:   agz_base_ver2 agz_base_ver2 get_GPS_data_ver1 aigamozu_program_ver2 ... more

Committer:
m5171135
Date:
Sun Jun 08 09:44:19 2014 +0000
Revision:
2:3f2d4f53ceed
Parent:
1:80448565c15c
Child:
3:282dad679fca
Child:
4:04dadf67ecb6
AiagmozuControlPackets ver1.2 Atsunori Maruyama

Who changed what in which revision?

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