Update flatbuffers to match shooter logic
Gives more info about the state of the turret and sets up things needed
to make the turret not move until we're loaded.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I34cd819bd076a2535acbbe4440e8d990c5554fb4
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index 554f1e8..3fc95fe 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -5,7 +5,9 @@
"distance_from_goal": 0.0,
"shot_params": {
"shot_velocity": 0.0,
- "shot_angle": 0.0
+ "shot_altitude_angle": 0.0,
+ "shot_catapult_angle": 0.0,
+ "shot_speed_over_ground": 0.0
}
}
],
@@ -78,5 +80,7 @@
"upper": 2.0
},
"loop": {% include 'y2024/control_loops/superstructure/climber/integral_climber_plant.json' %}
- }
+ },
+ "turret_loading_position": 0.0,
+ "catapult_return_position": 0.0
}
diff --git a/y2024/constants/constants.fbs b/y2024/constants/constants.fbs
index 40d609f..a3ddb0b 100644
--- a/y2024/constants/constants.fbs
+++ b/y2024/constants/constants.fbs
@@ -12,7 +12,15 @@
table ShotParams {
shot_velocity: double (id: 0);
- shot_angle: double (id: 1);
+
+ // Angle of the altitude
+ shot_altitude_angle: double (id: 1);
+
+ // Angle of the catapult
+ shot_catapult_angle: double (id: 2);
+
+ // Speed over ground to use for shooting on the fly
+ shot_speed_over_ground: double (id: 3);
}
table InterpolationTablePoint {
@@ -88,6 +96,8 @@
transfer_roller_voltages:TransferRollerVoltages (id: 7);
climber:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 8);
climber_set_points:ClimberSetPoints (id: 9);
+ turret_loading_position: double (id: 10);
+ catapult_return_position: double (id: 11);
}
table Constants {
diff --git a/y2024/control_loops/superstructure/superstructure_goal.fbs b/y2024/control_loops/superstructure/superstructure_goal.fbs
index bb7b706..6ec954f 100644
--- a/y2024/control_loops/superstructure/superstructure_goal.fbs
+++ b/y2024/control_loops/superstructure/superstructure_goal.fbs
@@ -35,11 +35,25 @@
RETRACT = 2,
}
+table ShooterGoal {
+ catapult_goal:frc971.control_loops.catapult.CatapultGoal (id: 0);
+ fire: bool (id: 1);
+ // If true we ignore the other provided positions
+ auto_aim: bool (id: 2);
+
+ // Position for the turret when we aren't auto aiming
+ turret_position: frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal (id: 3);
+
+ // Position for the altitude when we aren't auto aiming
+ altitude_position: frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal (id: 4);
+}
+
table Goal {
intake_roller_goal:IntakeRollerGoal (id: 0);
intake_pivot_goal:IntakePivotGoal (id: 1);
catapult_goal:frc971.control_loops.catapult.CatapultGoal (id: 2);
transfer_roller_goal:TransferRollerGoal (id: 3);
climber_goal:ClimberGoal (id: 4);
+ shooter_goal:ShooterGoal (id: 5);
}
root_type Goal;
diff --git a/y2024/control_loops/superstructure/superstructure_position.fbs b/y2024/control_loops/superstructure/superstructure_position.fbs
index cd12da0..6f253b0 100644
--- a/y2024/control_loops/superstructure/superstructure_position.fbs
+++ b/y2024/control_loops/superstructure/superstructure_position.fbs
@@ -22,6 +22,9 @@
// Values of the encoder and potentiometer at the climber.
// Zero is fully retracted, positive is extended upward.
climber:frc971.PotAndAbsolutePosition (id: 5);
+
+ // True if there is a game piece in the catapult
+ catapult_beam_break:bool (id: 6);
}
root_type Position;
diff --git a/y2024/control_loops/superstructure/superstructure_status.fbs b/y2024/control_loops/superstructure/superstructure_status.fbs
index cd727ac..40b792f 100644
--- a/y2024/control_loops/superstructure/superstructure_status.fbs
+++ b/y2024/control_loops/superstructure/superstructure_status.fbs
@@ -10,6 +10,15 @@
INTAKING = 2,
}
+enum CatapultStatus: ubyte {
+ // Means we are waiting for a game piece
+ IDLE = 0,
+ // Means we have a game piece
+ LOADED = 1,
+ // Means we are firing a game piece
+ FIRING = 2,
+}
+
table ShooterStatus {
// Estimated angle and angular velocitiy of the turret.
turret_state:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 0);
@@ -19,6 +28,8 @@
// Estimated angle and angular velocitiy of the altitude.
altitude_state:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2);
+
+ catapult_status: CatapultStatus (id: 3);
}
// Contains status of transfer rollers