Add intake flatbuffers
Signed-off-by: Aryan Khanna <aryankhanna0312@gmail.com>
Change-Id: I518b5e073abb92868b5e7b8a4fe6971e774c8b21
diff --git a/y2024/control_loops/superstructure/BUILD b/y2024/control_loops/superstructure/BUILD
index 996d28b..8ef0717 100644
--- a/y2024/control_loops/superstructure/BUILD
+++ b/y2024/control_loops/superstructure/BUILD
@@ -56,6 +56,19 @@
],
)
+static_flatbuffer(
+ name = "superstructure_can_position_fbs",
+ srcs = ["superstructure_can_position.fbs"],
+ deps = ["//frc971/control_loops:can_talonfx_fbs"],
+)
+
+flatbuffer_ts_library(
+ name = "superstructure_can_position_ts_fbs",
+ srcs = ["superstructure_can_position.fbs"],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = ["//frc971/control_loops:can_talonfx_ts_fbs"],
+)
+
cc_library(
name = "superstructure_lib",
srcs = [
diff --git a/y2024/control_loops/superstructure/superstructure_can_position.fbs b/y2024/control_loops/superstructure/superstructure_can_position.fbs
new file mode 100644
index 0000000..04daa2b
--- /dev/null
+++ b/y2024/control_loops/superstructure/superstructure_can_position.fbs
@@ -0,0 +1,10 @@
+include "frc971/control_loops/can_talonfx.fbs";
+
+namespace y2024.control_loops.superstructure;
+
+table CANPosition {
+ // CAN Position of the roller falcon
+ intake_roller:frc971.control_loops.CANTalonFX (id: 0);
+}
+
+root_type CANPosition;
\ No newline at end of file
diff --git a/y2024/control_loops/superstructure/superstructure_goal.fbs b/y2024/control_loops/superstructure/superstructure_goal.fbs
index 1c4b3dd..25fc8ca 100644
--- a/y2024/control_loops/superstructure/superstructure_goal.fbs
+++ b/y2024/control_loops/superstructure/superstructure_goal.fbs
@@ -2,8 +2,22 @@
namespace y2024.control_loops.superstructure;
-table Goal {
+// Represents goal for intake rollers
+enum IntakeRollerGoal : ubyte {
+ NONE = 0,
+ SPIT = 1,
+ INTAKE = 2,
}
+// Represents goal for pivot on intake
+enum IntakePivotGoal : ubyte {
+ EXTENDED = 0,
+ RETRACTED = 1,
+}
+
+table Goal {
+ intake_roller_goal:IntakeRollerGoal (id: 0);
+ intake_pivot_goal:IntakePivotGoal (id: 1);
+}
root_type Goal;
diff --git a/y2024/control_loops/superstructure/superstructure_output.fbs b/y2024/control_loops/superstructure/superstructure_output.fbs
index 6f0df4a..d54e608 100644
--- a/y2024/control_loops/superstructure/superstructure_output.fbs
+++ b/y2024/control_loops/superstructure/superstructure_output.fbs
@@ -1,6 +1,11 @@
namespace y2024.control_loops.superstructure;
table Output {
+ // Voltage of rollers on intake
+ intake_roller_voltage:double (id: 0);
+
+ // Voltage of intake pivot
+ intake_pivot_voltage:double (id: 1);
}
root_type Output;
diff --git a/y2024/control_loops/superstructure/superstructure_position.fbs b/y2024/control_loops/superstructure/superstructure_position.fbs
index 83d3d23..0bb5ae8 100644
--- a/y2024/control_loops/superstructure/superstructure_position.fbs
+++ b/y2024/control_loops/superstructure/superstructure_position.fbs
@@ -1,8 +1,11 @@
include "frc971/control_loops/control_loops.fbs";
+include "frc971/control_loops/profiled_subsystem.fbs";
namespace y2024.control_loops.superstructure;
table Position {
+ // Values of the encoder and potentiometer at the intake pivot
+ intake_pivot:frc971.PotAndAbsolutePosition (id: 0);
}
root_type Position;
diff --git a/y2024/control_loops/superstructure/superstructure_status.fbs b/y2024/control_loops/superstructure/superstructure_status.fbs
index 7e8cc27..98134bd 100644
--- a/y2024/control_loops/superstructure/superstructure_status.fbs
+++ b/y2024/control_loops/superstructure/superstructure_status.fbs
@@ -3,12 +3,25 @@
namespace y2024.control_loops.superstructure;
+// Contains if intake is intaking
+enum IntakeRollerState : ubyte {
+ NONE = 0,
+ SPITTING = 1,
+ INTAKING = 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);
+
+ // State of the rollers
+ intake_roller_state:IntakeRollerState (id: 2);
+
+ // Estimated angle and angular velocitiy of the intake.
+ intake_pivot_state:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 3);
}
root_type Status;