6
6
7
7
#include < frc/XboxController.h>
8
8
9
- IntakeManualControl::IntakeManualControl (Intake* intake, frc::XboxController& codriver)
10
- : _intake(intake), _codriver(codriver) {
9
+ IntakeManualControl::IntakeManualControl (Intake* intake, frc::XboxController& codriver) : _intake(intake), _codriver(codriver) {
11
10
Controls (intake);
12
11
}
13
12
@@ -19,38 +18,38 @@ void IntakeManualControl::OnTick(units::second_t dt) {
19
18
_rawControl = true ;
20
19
}
21
20
}
22
- if (_codriver.GetRightTriggerAxis () > 0.1 ) {
23
- _intake->setRaw (_codriver.GetRightTriggerAxis () * 10_V);
24
- } else if (_codriver.GetLeftTriggerAxis () > 0.1 ) {
25
- _intake->setRaw (_codriver.GetLeftTriggerAxis () * -10_V);
26
- } else if (_rawVoltage != 0_V) {
27
- if (_intake->GetConfig ().intakeSensor ->Get () == 1 ) {
28
- _intake->setRaw (0_V);
21
+
22
+ if (_rawControl) {
23
+ if (_codriver.GetRightTriggerAxis () > 0.1 ) {
24
+ _intake->setRaw (_codriver.GetRightTriggerAxis () * 10_V);
25
+ } else if (_codriver.GetLeftTriggerAxis () > 0.1 ) {
26
+ _intake->setRaw (_codriver.GetLeftTriggerAxis () * -10_V);
27
+ } else if (_rawVoltage != 0_V) {
28
+ if (_intake->GetConfig ().intakeSensor ->Get () == 1 ) {
29
+ _intake->setRaw (0_V);
30
+ } else {
31
+ _intake->setRaw (10_V);
32
+ }
29
33
} else {
30
34
_intake->setRaw (0_V);
31
- }
32
- } else {
33
- _intake->setRaw (0_V);
34
- }
35
+ }
35
36
_intake->setState (IntakeState::kRaw );
36
- }
37
-
38
- // } else {
39
- // if (_codriver.GetYButtonPressed()) {
40
- // _intake->setState(IntakeState::kIntake);
41
- // }
42
- // if (_codriver.GetAButtonPressed()) {
43
- // _intake->setState(IntakeState::kPass);
44
- // }
45
- // }
46
37
38
+ } else {
39
+ if (_intake->GetConfig ().intakeSensor ->Get () == 1 ) {
40
+ _intake->setState (IntakeState::kHold );
41
+ } else if (_intake->GetConfig ().intakeSensor ->Get () == 0 ) {
42
+ if (_codriver.GetRightTriggerAxis () > 0.1 ) {
43
+ _intake->setState (IntakeState::kIntake );
44
+ } else {
45
+ _intake->setState (IntakeState::kIdle );
46
+ }
47
+ }
48
+ }
49
+ }
47
50
48
- // IntakeAutoControl::IntakeAutoControl(Intake* intake) : _intake(intake) {}
49
-
50
- void IntakeAutoControl::OnTick (units::second_t dt) {
51
- if (_intake->GetConfig ().intakeSensor ->Get () == 1 ) {
52
- _intake->setState (IntakeState::kPass );
53
- } /* else if (_intake->GetConfig().magSensor->Get() == 0) {
54
- _intake->setState(IntakeState::kIdle);
55
- }*/
51
+ IntakeAutoControl::IntakeAutoControl (Intake* intake) : _intake(intake) {
52
+ Controls (intake);
56
53
}
54
+
55
+ void IntakeAutoControl::OnTick (units::second_t dt) {}
0 commit comments