-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseRobot.h
More file actions
63 lines (46 loc) · 2.74 KB
/
BaseRobot.h
File metadata and controls
63 lines (46 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "vex.h"
#include "Utility/TrapezoidController.cpp"
#include "Utility/PIDController.cpp"
#include "Utility/VisualGraph.cpp"
#include "Buttons.cpp"
using namespace vex;
class BaseRobot {
public:
BaseRobot(int32_t gyroPort);
inertial gyroSensor;
Buttons buttons; // button wrapper class
virtual void teleop() = 0;
virtual void resetEncoderDistance() = 0;
virtual float getLeftEncoderDistance() = 0;
virtual float getRightEncoderDistance() = 0;
float getEncoderDistance() {return (getLeftEncoderDistance() + getRightEncoderDistance()) / 2;}
float getAngle();
void waitGyroCallibrate();
void possiblyResetGyro(float targetAngle, float angleTolerance = 10);
void setMotorVelocity(motor m, directionType d, double percent);
virtual void setLeftVelocity(directionType d, double percent) = 0;
virtual void setRightVelocity(directionType d, double percent) = 0;
virtual void stopLeft() = 0;
virtual void stopRight() = 0;
virtual void setBrakeType(brakeType b) = 0;
virtual float distanceToDegrees(float distInches) = 0;
virtual float degreesToDistance(float distDegrees) = 0;
void goCurve(float distInches, float maxSpeed, float turnPercent, float rampUpFrames, float slowDownInches,
bool stopAfter = true, float rampMinSpeed = 20, float slowMinSpeed = 12);
virtual void goForwardU(float distInches, float maxSpeed, float universalAngle, float rampUpFrames, float slowDownInches,
bool stopAfter = true, float rampMinSpeed = 20, float slowDownMinSpeed = 10, float timeout = 10) = 0;
void goForward(float distInches, float maxSpeed, float rampUpFrames, float slowDownInches, bool stopAfter = true,
float rampMinSpeed = 20, float slowDownMinSpeed = 12, float timeout = 5);
void goForwardTimed(float duration, float speed);
virtual void goTurnU(float universalAngleDegrees, bool stopAfter = true, float timeout = 5, float maxSpeed = 75) = 0;
void basicDriveTeleop();
protected:
void goForwardU_Abstract(float K_P, float distInches, float maxSpeed, float universalAngle, float rampUpFrames, float slowDownInches,
bool stopAfter = true, float rampMinSpeed = 20, float slowDownMinSpeed = 10, float timeout = 10);
void goTurnU_Abstract(float KP, float KI, float KD, float TOLERANCE, float REPEATED, float MINUMUM,
float universalAngleDegrees, bool stopAfter = true, float timeout = 5, float maxSpeed = 75);
void goVision_Abstract(float K_P, float MIN_SPEED, int32_t CAMERA_PORT, float distInches, float speed, Goal goal,
float rampUpFrames, float slowDownInches, bool stopAfter = true, float timeout = 5);
void goAlignVision_Abstract(float K_P, float K_I, float K_D, float TOLERANCE, float REPEATED, float MINIMUM, int32_t CAMERA_PORT,
Goal goal, float timeout = 5, bool stopAfter = true);
};