Implement Joystick Reader
Reads the joystick input to set superstructure goal.
This patch also removes the HALF_EXTEND climber goal
because it is not used.
Signed-off-by: Alexander Yee <xander.yee@gmail.com>
Change-Id: I5b23ace0b255024cb1413c62c9306bc856f1fd8e
diff --git a/y2024/control_loops/superstructure/superstructure.cc b/y2024/control_loops/superstructure/superstructure.cc
index ab863eb..fece6e3 100644
--- a/y2024/control_loops/superstructure/superstructure.cc
+++ b/y2024/control_loops/superstructure/superstructure.cc
@@ -83,10 +83,6 @@
climber_position =
robot_constants_->common()->climber_set_points()->full_extend();
break;
- case ClimberGoal::HALF_EXTEND:
- climber_position =
- robot_constants_->common()->climber_set_points()->half_extend();
- break;
case ClimberGoal::RETRACT:
climber_position =
robot_constants_->common()->climber_set_points()->retract();
diff --git a/y2024/control_loops/superstructure/superstructure_goal.fbs b/y2024/control_loops/superstructure/superstructure_goal.fbs
index b346e97..f9dfcaa 100644
--- a/y2024/control_loops/superstructure/superstructure_goal.fbs
+++ b/y2024/control_loops/superstructure/superstructure_goal.fbs
@@ -14,16 +14,16 @@
// Represents goal for climber
// FULL_EXTEND is for fully extending the climber
-// HALF_EXTEND is for partially extending the climber
// RETRACT is for retracting the climber
enum ClimberGoal : ubyte {
FULL_EXTEND = 0,
- HALF_EXTEND = 1,
- RETRACT = 2,
+ RETRACT = 1,
}
table ShooterGoal {
catapult_goal:frc971.control_loops.catapult.CatapultGoal (id: 0);
+
+ // If true we ignore the other provided positions
auto_aim: bool (id: 1);
// Position for the turret when we aren't auto aiming
@@ -32,11 +32,11 @@
// Position for the altitude when we aren't auto aiming
altitude_position: frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal (id: 3);
- // If true, we started with the ball loaded and should proceed to that state.
+ // If true, we started with the ball loaded and should proceed to that state.
preloaded:bool = false (id: 4);
}
-// Represents goal for the note movement through the robot
+// Represents goal for the note movement through the robot
// to various scoring positions
// NONE represents no goal for the note
// AMP represents the goal to move the note and the extend to the AMP scoring position
@@ -53,10 +53,9 @@
table Goal {
intake_goal:IntakeGoal = NONE (id: 0);
- catapult_goal:frc971.control_loops.catapult.CatapultGoal (id: 1);
- climber_goal:ClimberGoal (id: 2);
- shooter_goal:ShooterGoal (id: 3);
- note_goal:NoteGoal (id: 4);
- fire: bool (id: 5);
+ climber_goal:ClimberGoal (id: 1);
+ shooter_goal:ShooterGoal (id: 2);
+ note_goal:NoteGoal (id: 3);
+ fire: bool (id: 4);
}
root_type Goal;
diff --git a/y2024/control_loops/superstructure/superstructure_lib_test.cc b/y2024/control_loops/superstructure/superstructure_lib_test.cc
index d1f6641..0e6498e 100644
--- a/y2024/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2024/control_loops/superstructure/superstructure_lib_test.cc
@@ -454,13 +454,7 @@
set_point = simulated_robot_constants_->common()
->climber_set_points()
->full_extend();
- } else if (superstructure_goal_fetcher_->climber_goal() ==
- ClimberGoal::HALF_EXTEND) {
- set_point = simulated_robot_constants_->common()
- ->climber_set_points()
- ->half_extend();
}
-
EXPECT_NEAR(set_point,
superstructure_status_fetcher_->climber()->position(), 0.001);
}
@@ -859,22 +853,6 @@
Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
- goal_builder.add_climber_goal(ClimberGoal::HALF_EXTEND);
-
- ASSERT_EQ(builder.Send(goal_builder.Finish()), aos::RawSender::Error::kOk);
- }
-
- RunFor(chrono::seconds(5));
-
- VerifyNearGoal();
-
- WaitUntilZeroed();
-
- {
- auto builder = superstructure_goal_sender_.MakeBuilder();
-
- Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
-
goal_builder.add_climber_goal(ClimberGoal::RETRACT);
ASSERT_EQ(builder.Send(goal_builder.Finish()), aos::RawSender::Error::kOk);