This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobotModel.h
131 lines (103 loc) · 2.67 KB
/
RobotModel.h
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include "WPILib.h"
#include "ini.h"
#include "Debugging.h"
#include "RobotPorts2014.h"
#ifndef ROBOTMODEL_H_
#define ROBOTMODEL_H_
#define PI 3.1415927
class RobotModel
{
public:
enum Wheels { kLeftWheel, kRightWheel, kBothWheels };
Ini *pini;
Encoder *rightWheelEncoder;
Encoder *leftWheelEncoder;
Encoder *catapultEncoder;
#ifdef USE_CAMERA
AxisCamera *camera;
#endif
Compressor* compressor;
DriverStationLCD* dsLCD;
// ADXL345_I2C* accel;
Gyro* gyro;
Timer* timer;
DigitalInput* limitSwitch;
DigitalInput* opticalSensor;
RobotModel();
void ResetGyro();
float GetGyroAngle();
// void PrintToLCD(int line, char message);
double GetLeftWheelEncoderSpeed();
double GetRightWheelEncoderSpeed();
double GetWheelEncoderSpeed(); //average
double GetWheelEncoderDistance(Wheels w);
void ResetEncoder(Encoder *e);
void EnableCompressor();
void DisableCompressor();
bool GetCompressorState();
// void ResetWheelEncoder(RobotModel::Wheels w = RobotModel::kBothWheels);
void SetWheelSpeed(Wheels w, double speed);
void SetCatapultMotorSpeed(double speed);
bool IsLowGear();
void ShiftToHighGear();
void ShiftToLowGear();
void ShiftGear();
#ifdef NEWBOT
void ShiftCatapultToLowGear();
void ShiftCatapultToHighGear();
void EngageLatch();
void ReleaseLatch();
bool IsLowerIntakeIn();
void LowerIntakeArmIn(bool in);
Solenoid* GetLowerIntakePiston();
void MoveLowerIntakeArmIn();
void MoveLowerIntakeArmOut();
bool IsUpperIntakeIn();
void UpperIntakeArmIn(bool in);
Solenoid* GetUpperIntakePiston();
void MoveUpperIntakeArmIn();
void MoveUpperIntakeArmOut();
Solenoid* GetPopBallPiston();
void MovePopBallPistonIn();
void MovePopBallPistonOut();
void SetIntakeSpeed(double speed);
#endif
#ifdef USE_CAMERA
HSLImage *GetCameraImage();
#endif
bool OpticalSensorActivated();
//bool hasCamera();
double GetCurrentTimeInSeconds();
void ResetTimer();
void RefreshIni();
virtual ~RobotModel();
#ifdef USE_CAMERA
bool HasCamera() { return hasCamera; }
bool CheckCameraConnection();
#endif
#ifdef NEWBOT
Talon *driveLeftA, *driveLeftB, *driveRightA, *driveRightB;
Talon *catapultMotorA, *catapultMotorB;
Talon *intakeMotorA, *intakeMotorB;
#else
Victor *driveLeftA, *driveLeftB, *driveRightA, *driveRightB;
#endif
private:
bool isLowGear;
Solenoid* shifterSolenoid;
#ifdef NEWBOT
Solenoid* catapultShifterSolenoid;
Solenoid* latchSolenoid;
Solenoid* popBallSolenoid;
Solenoid* intakeUpperArmSolenoidA;
Solenoid* intakeLowerArmSolenoidA;
Solenoid* intakeUpperArmSolenoidB;
Solenoid* intakeLowerArmSolenoidB;
bool isLowerIntakeIn;
bool isUpperIntakeIn;
#endif
#ifdef USE_CAMERA
bool hasCamera;
#endif
};
#endif /*ROBOTMODEL_H_*/