Sam Leighton / Navigate_Pololu
Committer:
sleighton
Date:
Sun Jan 31 16:08:34 2016 +0000
Revision:
1:b6c1de65e591
Parent:
0:33c364521d16
Child:
2:1255feea1c59
Sends location above proximity threshold

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sleighton 0:33c364521d16 1 #include "mbed.h"
sleighton 0:33c364521d16 2
sleighton 0:33c364521d16 3 class Navigate_Pololu{
sleighton 0:33c364521d16 4
sleighton 0:33c364521d16 5 private:
sleighton 0:33c364521d16 6 const float PI = 3.14159f;
sleighton 0:33c364521d16 7 const float TWO_PI = PI * 2.0f;
sleighton 0:33c364521d16 8 float distancePerCount;
sleighton 0:33c364521d16 9 float radiansPerCount;
sleighton 0:33c364521d16 10 float X;
sleighton 0:33c364521d16 11 float Y;
sleighton 0:33c364521d16 12 float heading;
sleighton 0:33c364521d16 13 //const float wheelDiameter = 3.2f;
sleighton 0:33c364521d16 14 //const float trackWidth = 8.25f;
sleighton 0:33c364521d16 15 //const int countsPerRevolution = 3;
sleighton 0:33c364521d16 16 int previousLeftCounts;
sleighton 0:33c364521d16 17 int previousRightCounts;
sleighton 0:33c364521d16 18 float deltaDistance;
sleighton 0:33c364521d16 19 float deltaX;
sleighton 0:33c364521d16 20 float deltaY;
sleighton 0:33c364521d16 21 int leftCounts;
sleighton 0:33c364521d16 22 int rightCounts;
sleighton 0:33c364521d16 23 int deltaLeft;
sleighton 0:33c364521d16 24 int deltaRight;
sleighton 0:33c364521d16 25 float deltaHeading;
sleighton 0:33c364521d16 26 InterruptIn leftOpto;
sleighton 0:33c364521d16 27 InterruptIn rightOpto;
sleighton 0:33c364521d16 28
sleighton 0:33c364521d16 29 public:
sleighton 0:33c364521d16 30
sleighton 1:b6c1de65e591 31 Navigate_Pololu(PinName leftIn, PinName rightIn, int countsPerRevolution, float wheelDiameter, float trackWidth,PinName robotTx, PinName robotRx);
sleighton 0:33c364521d16 32
sleighton 0:33c364521d16 33 void leftWheelInterrupt();
sleighton 0:33c364521d16 34 //IRQ for left wheel sensor
sleighton 0:33c364521d16 35
sleighton 0:33c364521d16 36 void rightWheelInterrupt();
sleighton 0:33c364521d16 37 //IRQ for right wheel sensor
sleighton 0:33c364521d16 38
sleighton 0:33c364521d16 39 void UpdatePosition();
sleighton 0:33c364521d16 40 //Updates position based on wheel counts
sleighton 1:b6c1de65e591 41 int getX();
sleighton 0:33c364521d16 42 //returns x coordinate
sleighton 0:33c364521d16 43
sleighton 1:b6c1de65e591 44 int getY();
sleighton 0:33c364521d16 45 //returns y coordinate
sleighton 0:33c364521d16 46
sleighton 1:b6c1de65e591 47 int getHeading();
sleighton 0:33c364521d16 48 //returns heading
sleighton 1:b6c1de65e591 49
sleighton 1:b6c1de65e591 50 void calibratePos(PinName robotTx, PinName robotRx);
sleighton 1:b6c1de65e591 51 //aligns wheels
sleighton 0:33c364521d16 52 };