Skip to content

Commit 3bf9604

Browse files
PhyXTGears-1720boxofrox
authored andcommitted
Wire operator console to PID hatch commands.
Add three vertical buttons from the operator console. Connect two buttons to Grab and Ready commands. Reuse LowerHatch command for third button. It disables the pid and controls the hatch motor while the button is pressed, which covers all the bases for the third button, no need for an extra command. STATUS: Builds. - Justin C
1 parent 4d1df50 commit 3bf9604

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/main/cpp/Robot.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,22 @@ void Robot::CompetitionJoystickInput() {
265265
m_Bling.SetBling(m_Bling.HatchPattern);
266266
}
267267

268+
if (console.GetHatchTopPositionPressed()) {
269+
std::cout << "Comp Joy Input: Console: Hatch Top Position Pressed" << std::endl;
270+
m_GrabHatchFromLoadingStation->Start();
271+
m_Bling.SetBling(m_Bling.HatchPattern);
272+
} else if (console.GetHatchMidPositionPressed()) {
273+
std::cout << "Comp Joy Input: Console: Hatch Mid Position Pressed" << std::endl;
274+
m_ReadyHatch->Start();
275+
m_Bling.SetBling(m_Bling.HatchPattern);
276+
} else if (console.GetHatchLowerPressed()) {
277+
std::cout << "Comp Joy Input: Console: Hatch Lower Pressed" << std::endl;
278+
m_LowerHatch
279+
->Until([]() { return Robot::m_OI.GetOperatorConsole().GetHatchLowerReleased(); })
280+
->Start();
281+
m_Bling.SetBling(m_Bling.HatchPattern);
282+
}
283+
268284
if (console.GetCargoShootRocketTwoPressed()) {
269285
std::cout << "Comp Joy Input: Console: Rocket Shot (Level 2)" << std::endl;
270286
m_ShootCargoForLevelTwoRocket->Start();

src/main/include/OperatorHID.h

+14
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
#define bCreeperCrawlForward 7
3131
#define bCreeperCrawlBackward 8
3232

33+
// Hatch Buttons (PID) board 2
34+
#define bHatchTopPosition 10
35+
#define bHatchMidPosition 9
36+
#define bHatchLowPosition 8
37+
3338
// A combo class that encapsules our button board and flight stick.
3439
// This is only for our robot operator to use.
3540
class OperatorHID {
@@ -44,6 +49,15 @@ class OperatorHID {
4449
bool GetHatchGrabReleased() { return m_Board2.GetButtonReleased(bHatchGrabberUp); }
4550
bool GetHatchReleasePressed() { return m_Board2.GetButtonPressed(bHatchGrabberDown); }
4651
bool GetHatchReleaseReleased() { return m_Board2.GetButtonReleased(bHatchGrabberDown); }
52+
53+
bool GetHatchTopPositionPressed() { return m_Board2.GetButtonPressed(bHatchTopPosition); }
54+
bool GetHatchTopPositionReleased() { return m_Board2.GetButtonReleased(bHatchTopPosition); }
55+
56+
bool GetHatchMidPositionPressed() { return m_Board2.GetButtonPressed(bHatchMidPosition); }
57+
bool GetHatchMidPositionReleased() { return m_Board2.GetButtonReleased(bHatchMidPosition); }
58+
59+
bool GetHatchLowerPressed() { return m_Board2.GetButtonPressed(bHatchLowPosition); }
60+
bool GetHatchLowerReleased() { return m_Board2.GetButtonReleased(bHatchLowPosition); }
4761

4862
bool GetCargoIntakeCargoPressed() { return m_Board2.GetButtonPressed(bCargoIntakeCargo); }
4963
bool GetCargoShootRocketOnePressed() { return m_Board2.GetButtonPressed(bCargoShootRocketOne); }

0 commit comments

Comments
 (0)