Add shooter and serializer to messages
Change-Id: Ibea4922814886608905d9457f1a08e587af6a3e8
diff --git a/y2020/control_loops/superstructure/superstructure_goal.fbs b/y2020/control_loops/superstructure/superstructure_goal.fbs
index d6693ca..4b1d8e9 100644
--- a/y2020/control_loops/superstructure/superstructure_goal.fbs
+++ b/y2020/control_loops/superstructure/superstructure_goal.fbs
@@ -2,8 +2,18 @@
namespace y2020.control_loops.superstructure;
+table ShooterGoal {
+ // Angular velocity in rad/s of the slowest (lowest) wheel in the kicker.
+ // Positive is shooting the ball.
+ velocity_kicker:double;
+
+ // Angular velocity in rad/s of the flywheel. Positive is shooting.
+ velocity_flywheel:double;
+}
+
table Goal {
// Zero is at the horizontal, positive towards the front (meters on the lead screw).
+ // Only applies if hood_tracking = false.
hood:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal;
//0 = Linkage on sprocket is pointing straight up
@@ -17,6 +27,22 @@
// TODO(Kai): Define which wrap of the shooter is 0 if it can rotate past
// forward more than once.
turret:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal;
+
+ // Only applies if shooter_tracking = false.
+ shooter:ShooterGoal;
+
+ // Whether the robot should be shooting balls. Waits until hood, turret, and
+ // shooter are at goal (as determined by auto-tracking or override).
+ shooting:bool;
+
+ // Whether the hood should adjust its position automatically.
+ hood_tracking:bool;
+
+ // Whether the turret should follow the target automatically.
+ turret_tracking:bool;
+
+ // Whether the kicker and flywheel should choose a velocity automatically.
+ shooter_tracking:bool;
}
root_type Goal;
diff --git a/y2020/control_loops/superstructure/superstructure_output.fbs b/y2020/control_loops/superstructure/superstructure_output.fbs
index abb15dc..9048b33 100644
--- a/y2020/control_loops/superstructure/superstructure_output.fbs
+++ b/y2020/control_loops/superstructure/superstructure_output.fbs
@@ -13,6 +13,21 @@
//Voltage sent to the motors.
//Positive rotates counterclockwise from a birds eye view.
turret_voltage:double;
+
+ // Voltage sent to the feeder belt. Positive is feeding.
+ feeder_voltage:double;
+
+ // Voltage sent to the washing_machine and control panel spinner.
+ // Positive runs the washing machine CCW facing the front of the robot, and
+ // the spinner runs CCW from a top down view.
+ washing_machine_spinner_voltage:double;
+
+ // Voltage sent to the kicker. Positive is shooting.
+ kicker_left_voltage:double;
+ kicker_right_voltage:double;
+
+ // Voltage sent to the flywheel. Positive is shooting.
+ flywheel_voltage:double;
}
root_type Output;
diff --git a/y2020/control_loops/superstructure/superstructure_position.fbs b/y2020/control_loops/superstructure/superstructure_position.fbs
index aabcd43..ed73e52 100644
--- a/y2020/control_loops/superstructure/superstructure_position.fbs
+++ b/y2020/control_loops/superstructure/superstructure_position.fbs
@@ -2,6 +2,16 @@
namespace y2020.control_loops.superstructure;
+table ShooterPosition {
+ // Flywheel angle in radians, positive is shooting.
+ theta_flywheel:double;
+
+ // Kicker angle in radians of the slowest (lowest) wheel, positive is
+ // accelerating the ball toward the shooter.
+ theta_kicker_left:double;
+ theta_kicker_right:double;
+}
+
table Position {
// Zero is at the horizontal, positive towards the front (meters on the lead screw).
hood:frc971.AbsolutePosition;
@@ -11,6 +21,9 @@
// See goal for definition of 0
turret:frc971.PotAndAbsolutePosition;
+
+ // Position of the kicker and flywheel
+ shooter:ShooterPosition;
}
root_type Position;
diff --git a/y2020/control_loops/superstructure/superstructure_status.fbs b/y2020/control_loops/superstructure/superstructure_status.fbs
index f231f17..45dbba8 100644
--- a/y2020/control_loops/superstructure/superstructure_status.fbs
+++ b/y2020/control_loops/superstructure/superstructure_status.fbs
@@ -3,6 +3,29 @@
namespace y2020.control_loops.superstructure;
+table ShooterSegmentStatus {
+ // The current average velocity in radians/second over the last kHistoryLength
+ // in shooter.h
+ avg_angular_velocity:double;
+
+ // The current instantaneous filtered velocity in radians/second.
+ angular_velocity:double;
+
+ // The target speed selected by the lookup table or from manual override
+ // Can be compared to velocity to determine if ready.
+ angular_velocity_goal:double;
+}
+
+table ShooterStatus {
+ // The final wheel shooting the ball
+ flywheel:ShooterSegmentStatus;
+
+ // The subsystem to accelerate the ball before the flywheel
+ // Velocity is the slowest (lowest) wheel
+ kicker_left:ShooterSegmentStatus;
+ kicker_right:ShooterSegmentStatus;
+}
+
table Status {
// All subsystems know their location.
zeroed:bool;
@@ -14,6 +37,9 @@
hood:frc971.control_loops.AbsoluteEncoderProfiledJointStatus;
intake:frc971.control_loops.AbsoluteEncoderProfiledJointStatus;
turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus;
+
+ // Shooter subsystem status.
+ shooter:ShooterStatus;
}
root_type Status;