Skip to content

Commit 7e9b5f9

Browse files
committed
Added auto to intake
1 parent 84af45e commit 7e9b5f9

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

src/main/cpp/IntakeBehaviour.cpp

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
#include <frc/XboxController.h>
88

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) {
1110
Controls(intake);
1211
}
1312

@@ -19,38 +18,38 @@ void IntakeManualControl::OnTick(units::second_t dt) {
1918
_rawControl = true;
2019
}
2120
}
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+
}
2933
} else {
3034
_intake->setRaw(0_V);
31-
}
32-
} else {
33-
_intake->setRaw(0_V);
34-
}
35+
}
3536
_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-
// }
4637

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+
}
4750

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);
5653
}
54+
55+
void IntakeAutoControl::OnTick(units::second_t dt) {}

0 commit comments

Comments
 (0)