Diff: XBee_Robot.h
- Revision:
- 12:a7ec1238373e
- Parent:
- 11:6b699617fc7f
--- a/XBee_Robot.h Tue Feb 02 11:02:48 2016 +0000 +++ b/XBee_Robot.h Fri Mar 04 18:46:05 2016 +0000 @@ -8,9 +8,9 @@ std::vector<uint8_t> addr; //16 bit network address vector std::vector<uint8_t> addr64; //64 bit network address vector int nodeNum; //index - int x; - int y; - int heading; + int x; //x coordinate + int y; //y coordinate + int heading; //heading public: NetworkNode(std::vector<uint8_t> & addrIn, int indexIn); //constructor @@ -50,6 +50,8 @@ class XBee_Robot { private: + std::vector< vector <int> > obstacles; // 2D vector to hold positions of obstacles + int currentIndex; //current index of NetworkNode for received packet, allows coordinates to be updated std::vector< NetworkNode > node_list; //list of network nodes @@ -62,14 +64,13 @@ int commandFlag; // flag that indicates if coordinates from the coordinator have been received + int finishedFlag; // flag that indictates if the router robots have finished their journey (coordinator use only) + public: XBee_Robot(PinName _txIn, PinName _rxIn); //constructor for XBee - void setRxInterrupt(); - //enables interrupt for receive pin - void Rx_interrupt(); //ISR for receive pin @@ -103,6 +104,18 @@ int getCommandFlag(); //used by main program to poll command flag + int getFinishedFlag(); + //used by main program to poll finished flag (coordinator use only) + + void resetFinishedFlag(); + //used by main program to reset finished flag (coordinator use only) + void resetCommandFlag(); //used by main program to reset command flag + + int checkObstacle(int x_in, int y_in); + //used by main program to check if an obstacle exists at given coordinates (coordinator use only) + + int convSigned(int int_in); + //used to convert unsigned 8 bit integers to signed integers };