Combine intake and spit in superstructure goal
With how the superstructure goal worked before there could be a goal to
both intake and spit. So I moved them into an enum with an IDLE state
if its not intaking or spitting.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I51d893a9f62a8a0b9621f89ca01da91f4b9491d1
diff --git a/y2023/joystick_reader.cc b/y2023/joystick_reader.cc
index 3caaa41..adeda2b 100644
--- a/y2023/joystick_reader.cc
+++ b/y2023/joystick_reader.cc
@@ -30,6 +30,7 @@
using frc971::input::driver_station::ControlBit;
using frc971::input::driver_station::JoystickAxis;
using frc971::input::driver_station::POVLocation;
+using y2023::control_loops::superstructure::RollerGoal;
namespace y2023 {
namespace input {
@@ -66,16 +67,15 @@
return;
}
- bool intake = false;
- bool spit = false;
+ RollerGoal roller_goal = RollerGoal::IDLE;
// TODO(milind): add more actions and paths
if (data.IsPressed(kIntake)) {
- intake = true;
- arm_goal_position_ = arm::PickupPosIndex();
+ roller_goal = RollerGoal::INTAKE;
+ arm_goal_position_ = arm::ScorePosIndex();
} else if (data.IsPressed(kSpit)) {
- spit = true;
- arm_goal_position_ = arm::PickupPosIndex();
+ roller_goal = RollerGoal::SPIT;
+ arm_goal_position_ = arm::ScorePosIndex();
} else if (data.IsPressed(kScore)) {
arm_goal_position_ = arm::ScorePosIndex();
}
@@ -86,8 +86,7 @@
superstructure::Goal::Builder superstructure_goal_builder =
builder.MakeBuilder<superstructure::Goal>();
superstructure_goal_builder.add_arm_goal_position(arm_goal_position_);
- superstructure_goal_builder.add_intake(intake);
- superstructure_goal_builder.add_spit(spit);
+ superstructure_goal_builder.add_roller_goal(roller_goal);
if (builder.Send(superstructure_goal_builder.Finish()) !=
aos::RawSender::Error::kOk) {
AOS_LOG(ERROR, "Sending superstructure goal failed.\n");