-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKicker.h
93 lines (80 loc) · 2.93 KB
/
Kicker.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
#ifndef KICKER__H
#define KICKER__H
#include "CANJaguar.h"
#include "Input.h"
#include "WPILib.h"
#include "KickerReleaser.h"
#include "Timer.h"
#include "RedAlertJaguar.h"
#define KICK_DELAY_PERIOD (0.5)
#define KICK_TOLERANCE (0.15)
#define KickerState KickerSM.KickerStateVariable
union KickerStateMachine_Tag {
char KickerStateVariable;
struct {
unsigned Bit7:1;
unsigned Bit6:1;
unsigned Bit5:1;
unsigned Bit4:1;
unsigned Bit3:1;
unsigned Bit2:1;
unsigned Bit1:1;
unsigned Bit0:1;
} Bits;
};
class Kicker{
public:
Kicker(); //Constructor
void KickerInit(Input * in, double period); //Colin told me to add this, I think it has something to do w/ the IO
void ProcessKicker(); //WRITE
void KickerStateMachine(); //WRITE
bool Armed(); //WRITE
void Kick(bool trig, bool caught); //Kicks
void SetPosition(float pos); //Sets the position for the 'boot'. Think firing modes
float GetSetPosition(); //Returns what the position 'boot' is supposed to be at
void Chamber(); //Actually chambers the kicker
float GetPosition(); //Returns the current position of the 'boot'
bool Process(); //Finds out if the 'kick' button is pulled. ->RIGHT TRIGGER<-
bool LaunchComplete(); // checks if launch is complete
bool IsArmed(); // checks if arm button has been pressed
int GetState(); // returns the state of Kicker
void DuctTape(); // Fixes EVERYTHING :]
bool IsHome(); // Detects if the kicker is in the home position
void ManualMode(); // allows the user to manually pull back the kicker
double GetEncoderPosition();
int GetCounter();
void SetKickerPower(); // sets the amount of power going to the kicker
void ResetState();
float GetWenchBusVoltage();
float GetWenchTemperature();
float GetWenchOutputCurrent();
inline CANJaguar * GetChamberWench() { return ChamberWench; }
inline KickerReleaser * GetReleaser() { return releaser; }
private:
float position; //The 'boot' position variable (maybe this should be a float?)
float ActPosition; //The 'boot's actual position in meatspace. Is not necessarily the same as position
bool Captured; //The variable telling us if the robot has a ball
bool pull; //Variable telling us if the 'kick' button is pulled
int state; //Contains the state
int counter; //Counter
double period; //Tracks the period
double setPosition;
static const double kArmTime = 1.5; // seconds
static const double kArmPower = -.45;
static const double kMaxKickPower = -2.5;
union KickerStateMachine_Tag KickerSM;
CANJaguar * ChamberWench;
//RedAlertJaguar * ChamberWench;
Input * input;
DriverStationLCD * dsLCD;
KickerReleaser * releaser;
DigitalInput * HomeSensor;
DigitalInput * BallCapturedSensor;
Encoder *shaftEncoder;
//Timer *kickDelay;
//Timer * kickArmTime;
int kickArmCounter;
bool manualBackup;
int kickCounter;
};
#endif