-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatapult.h
More file actions
51 lines (38 loc) · 1.11 KB
/
catapult.h
File metadata and controls
51 lines (38 loc) · 1.11 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
#ifndef CATAPULT_H
#define CATAPULT_H
#include <WPILib.h>
class catapult{
public:
catapult(UINT8 talonOnePort, UINT8 talonTwoPort, UINT8 encoderPortA, UINT8 encoderPortB, UINT8 limitSwitchPort);
void ReInit();
//Fires the catapult, automatically cycles back to bottom position after firing
void Fire();
//Sets the number of encoder "clicks" at which power to the catapult is cut
void SetStoppingPoint(int stoppingClicks);
//Sets the power at which the motors are run at when firing
void SetMotorPower(float motorPower);
//Returns the current encoder count
int GetEncoderCount();
//Returns the current shooter state
int GetState();
//Resets the encoder
void ResetEncoder();
//Function to be called every loop, this is where all the "work" is actually done
void Idle();
private:
int stoppingClicks;
float motorPower;
Talon *MotorOneTalon;
Talon *MotorTwoTalon;
DigitalInput *CatapultLimitSwitch;
Encoder *CatapultEncoder;
Timer *LoweringTimer;
enum firingState_t{
waiting,
firing,
lowering,
zeroing,
};
firingState_t firingState;
};
#endif