RSeries astromech firmware
TurtleDrive.h
Go to the documentation of this file.
2 {
3 public:
4  inline double getDroidDiameterMM() { return fDroidDiameterMM; }
5  inline double getWheelCircumferenceMM() { return fWheelCircumferenceMM; }
6  inline double getWheelTurnCount() { return fWheelTurnCount; }
7 
8  inline double getDroidCircumference()
9  {
10  return 2 * M_PI * getDroidDiameterMM() / 2;
11  }
12 
13  inline int getMoveDistanceCount(double millimeters)
14  {
15  return millimeters / getWheelCircumferenceMM() * getWheelTurnCount();
16  }
17 
18  inline int getTurnDistanceCount(double turnDegrees)
19  {
21  }
22 
23  inline void moveInches(double inches) { moveMillimeters(inches * 25.4); }
24  inline void moveFeet(double feet) { moveMillimeters(feet * 304.8); }
25  inline void moveMeters(double meters) { moveMillimeters(meters * 1000); }
26  inline void moveCentimeters(double meters) { moveMillimeters(meters * 10); }
27 
28  virtual bool enterCommandMode() = 0;
29  virtual void leaveCommandMode() = 0;
30  virtual bool isCommandModeActive() = 0;
31 
32  virtual void moveMillimeters(double mm, float speed = 0.1) = 0;
33  virtual void turnDegrees(double degrees, float speed = 0.1) = 0;
34  virtual void stop() = 0;
35 
36 protected:
37  double fDroidDiameterMM = 558.8;
38  double fWheelCircumferenceMM = 381;
39  double fWheelTurnCount = 610;
40 };
TurtleDrive::getDroidDiameterMM
double getDroidDiameterMM()
Definition: TurtleDrive.h:4
TurtleDrive
Definition: TurtleDrive.h:1
TurtleDrive::fWheelCircumferenceMM
double fWheelCircumferenceMM
Definition: TurtleDrive.h:38
TurtleDrive::fWheelTurnCount
double fWheelTurnCount
Definition: TurtleDrive.h:39
TurtleDrive::turnDegrees
virtual void turnDegrees(double degrees, float speed=0.1)=0
TurtleDrive::getMoveDistanceCount
int getMoveDistanceCount(double millimeters)
Definition: TurtleDrive.h:13
TurtleDrive::enterCommandMode
virtual bool enterCommandMode()=0
TurtleDrive::leaveCommandMode
virtual void leaveCommandMode()=0
TurtleDrive::getWheelCircumferenceMM
double getWheelCircumferenceMM()
Definition: TurtleDrive.h:5
TurtleDrive::moveFeet
void moveFeet(double feet)
Definition: TurtleDrive.h:24
TurtleDrive::getTurnDistanceCount
int getTurnDistanceCount(double turnDegrees)
Definition: TurtleDrive.h:18
TurtleDrive::isCommandModeActive
virtual bool isCommandModeActive()=0
TurtleDrive::getWheelTurnCount
double getWheelTurnCount()
Definition: TurtleDrive.h:6
TurtleDrive::moveMillimeters
virtual void moveMillimeters(double mm, float speed=0.1)=0
TurtleDrive::getDroidCircumference
double getDroidCircumference()
Definition: TurtleDrive.h:8
TurtleDrive::moveMeters
void moveMeters(double meters)
Definition: TurtleDrive.h:25
TurtleDrive::stop
virtual void stop()=0
TurtleDrive::moveInches
void moveInches(double inches)
Definition: TurtleDrive.h:23
TurtleDrive::moveCentimeters
void moveCentimeters(double meters)
Definition: TurtleDrive.h:26
TurtleDrive::fDroidDiameterMM
double fDroidDiameterMM
Definition: TurtleDrive.h:37