Merge "Add flatbuffers to y2024_bot3" into main
diff --git a/y2024_bot3/control_loops/superstructure/superstructure_can_position.fbs b/y2024_bot3/control_loops/superstructure/superstructure_can_position.fbs
index 15a0565..d34cd9b 100644
--- a/y2024_bot3/control_loops/superstructure/superstructure_can_position.fbs
+++ b/y2024_bot3/control_loops/superstructure/superstructure_can_position.fbs
@@ -11,6 +11,12 @@
// The ctre::phoenix::StatusCode of the measurement
// Should be OK = 0
status:int (id: 1);
+
+ // CAN Position of the roller falcon
+ intake_roller:frc971.control_loops.CANTalonFX (id: 2);
+
+ // CAN Position of the arm pivot falcon
+ arm_pivot:frc971.control_loops.CANTalonFX (id: 3);
}
root_type CANPosition;
diff --git a/y2024_bot3/control_loops/superstructure/superstructure_goal.fbs b/y2024_bot3/control_loops/superstructure/superstructure_goal.fbs
index 947f740..66ecfdf 100644
--- a/y2024_bot3/control_loops/superstructure/superstructure_goal.fbs
+++ b/y2024_bot3/control_loops/superstructure/superstructure_goal.fbs
@@ -2,6 +2,33 @@
namespace y2024_bot3.control_loops.superstructure;
-table Goal {
+// Represents goal for the intake rollers
+// INTAKE will turn on the rollers to intake the note.
+// SCORE will turn on the rollers to shoot the note.
+// SPIT will turn on the rollers (in reverse) to spit out the note.
+enum IntakeGoal : ubyte {
+ NONE = 0,
+ INTAKE = 1,
+ SCORE = 2,
+ SPIT = 3,
}
+
+// Represents goal for the intake arm
+// IDLE will place the arm at the resting position.
+// INTAKE will place the arm at the intake position.
+// AMP will place the arm at the amp scoring position.
+enum PivotGoal: ubyte {
+ IDLE = 0,
+ INTAKE = 1,
+ AMP = 2,
+}
+
+table Goal {
+ // Intake roller goal
+ roller_goal: IntakeGoal = NONE (id: 0);
+
+ // Arm position goal
+ arm_position: PivotGoal (id: 1);
+}
+
root_type Goal;
diff --git a/y2024_bot3/control_loops/superstructure/superstructure_output.fbs b/y2024_bot3/control_loops/superstructure/superstructure_output.fbs
index 28799de..faaa21e 100644
--- a/y2024_bot3/control_loops/superstructure/superstructure_output.fbs
+++ b/y2024_bot3/control_loops/superstructure/superstructure_output.fbs
@@ -1,6 +1,11 @@
namespace y2024_bot3.control_loops.superstructure;
table Output {
+ // Roller voltage, positive is for intake and scoring
+ roller_voltage: double (id: 0);
+
+ // Arm voltage, positive is moving arm up
+ arm_voltage: double (id: 1);
}
root_type Output;
diff --git a/y2024_bot3/control_loops/superstructure/superstructure_position.fbs b/y2024_bot3/control_loops/superstructure/superstructure_position.fbs
index f0553a5..6f2614b 100644
--- a/y2024_bot3/control_loops/superstructure/superstructure_position.fbs
+++ b/y2024_bot3/control_loops/superstructure/superstructure_position.fbs
@@ -4,6 +4,11 @@
namespace y2024_bot3.control_loops.superstructure;
table Position {
+ // Zero for the intake position value is horizontal, positive is up.
+ arm:frc971.PotAndAbsolutePosition (id: 0);
+
+ // Beambreak for the intake, 1 means note is present.
+ intake_beambreak:bool (id: 1);
}
root_type Position;
diff --git a/y2024_bot3/control_loops/superstructure/superstructure_status.fbs b/y2024_bot3/control_loops/superstructure/superstructure_status.fbs
index ca5876e..407af5f 100644
--- a/y2024_bot3/control_loops/superstructure/superstructure_status.fbs
+++ b/y2024_bot3/control_loops/superstructure/superstructure_status.fbs
@@ -3,12 +3,36 @@
namespace y2024_bot3.control_loops.superstructure;
-table Status {
- // All subsystems know their location.
- zeroed:bool (id: 0);
+// Equivalent to IntakeGoal enum in goal flatbuffer
+enum IntakeRollerStatus : ubyte {
+ NONE = 0,
+ INTAKE = 1,
+ SCORE = 2,
+ SPIT = 3,
+}
- // If true, we have aborted. This is the or of all subsystem estops.
- estopped:bool (id: 1);
+// Equivalent to PivotGoal enum in goal flatbuffer
+enum ArmStatus: ubyte {
+ IDLE = 0,
+ INTAKE = 1,
+ AMP = 2,
+}
+
+table Status {
+ // All subsystems know their location.
+ zeroed:bool (id: 0);
+
+ // If true, we have aborted. This is the or of all subsystem estops.
+ estopped:bool (id: 1);
+
+ // Estimated Angles + Velocities of the Intake
+ arm:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2);
+
+ // Tells us what IntakeGoal is
+ intake_roller_status: IntakeRollerStatus (id: 3);
+
+ // Tells us what PivotGoal is
+ arm_status: ArmStatus (id: 4);
}
root_type Status;