-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSensors.cpp
More file actions
74 lines (59 loc) · 1.34 KB
/
Sensors.cpp
File metadata and controls
74 lines (59 loc) · 1.34 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
64
65
66
67
68
69
70
71
72
73
74
/*
* @File: Sensors.cpp
* @Description: Sensors class handles all input from various sensors and inputs.
* All input values can be accesed via methods contained in this class
* For more descriptive comments, look in the header file
* @Author: Roman S.
*
*/
#include "Sensors.h"
#include "Data.h"
using namespace std;
Sensors::Sensors()
{
// Sensors constructor
base_control = new Joystick(0);
secondary_control = new Joystick(1)
intake_sensor = new DigitalInput(0);
library = Data::getInstance();
}
Sensors::~Sensors()
{
// sensors destructor
delete base_control;
delete library;
}
double Sensors::getBaseMovementInputX()
{
// returns: x-axis of joystick for base
return base_control->GetRawAxis(0);
}
double Sensors::getBaseMovementInputY()
{
// returns: y-axis of joystick for base
return base_control->GetRawAxis(1);
}
bool Sensors::getDriveControllerAButton()
{
return base_control->GetRawButton(1);
}
bool Sensors::getSecondaryTrigger()
{
return secondary_control->GetRawButton(1);
}
bool Sensors::getSecondarySideButton()
{
return secondary_control->GetRawButton(2);
}
bool Sensors::getSecondaryPistonUp()
{
return secondary_control->GetRawButton(5);
}
bool Sensors::getSecondaryPistonDown()
{
return secondary_control->GetRawButton(3);
}
bool Sensors::getIntakeSensor()
{
return intake_sensor->Get()
}