Add a drivetrain can position flatbuffer to frc971
Signed-off-by: Maxwell Henderson <maxwell.henderson@mailbox.org>
Change-Id: I73ab47b47327af0bf189554b030d5e5626f3df13
diff --git a/y2023/control_loops/drivetrain/BUILD b/y2023/control_loops/drivetrain/BUILD
index 063e972..f6b5655 100644
--- a/y2023/control_loops/drivetrain/BUILD
+++ b/y2023/control_loops/drivetrain/BUILD
@@ -116,15 +116,6 @@
)
flatbuffer_cc_library(
- name = "drivetrain_can_position_fbs",
- srcs = [
- "drivetrain_can_position.fbs",
- ],
- gen_reflections = 1,
- visibility = ["//visibility:public"],
-)
-
-flatbuffer_cc_library(
name = "target_selector_status_fbs",
srcs = [
":target_selector_status.fbs",
diff --git a/y2023/control_loops/drivetrain/drivetrain_can_position.fbs b/y2023/control_loops/drivetrain/drivetrain_can_position.fbs
deleted file mode 100644
index 34fbf12..0000000
--- a/y2023/control_loops/drivetrain/drivetrain_can_position.fbs
+++ /dev/null
@@ -1,42 +0,0 @@
-namespace y2023.control_loops.drivetrain;
-
-table CANFalcon {
- // The CAN id of the falcon
- id:int (id: 0);
-
- // In Amps
- supply_current:float (id: 1);
-
- // In Amps
- // Stator current where positive current means torque is applied in
- // the motor's forward direction as determined by its Inverted setting.
- torque_current:float (id: 2);
-
- // In Volts
- supply_voltage:float (id: 3);
-
- // In degrees Celsius
- device_temp:float (id: 4);
-
- // In meters traveled on the drivetrain
- position:float (id: 5);
-
- // Nominal range is -1 to 1, but can be -2 to +2
- duty_cycle: float (id: 6);
-}
-
-// CAN readings from the CAN sensor reader loop
-table CANPosition {
- falcons: [CANFalcon] (id: 0);
-
- // The timestamp of the measurement on the canivore clock in nanoseconds
- // This will have less jitter than the
- // timestamp of the message being sent out.
- timestamp:int64 (id: 1);
-
- // The ctre::phoenix::StatusCode of the measurement
- // Should be OK = 0
- status:int (id: 2);
-}
-
-root_type CANPosition;
diff --git a/y2023/control_loops/superstructure/BUILD b/y2023/control_loops/superstructure/BUILD
index afca18b..861bbf8 100644
--- a/y2023/control_loops/superstructure/BUILD
+++ b/y2023/control_loops/superstructure/BUILD
@@ -58,8 +58,8 @@
deps = [
"//frc971/control_loops:control_loops_fbs",
"//frc971/control_loops:profiled_subsystem_fbs",
+ "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
"//frc971/vision:calibration_fbs",
- "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
],
)
@@ -103,12 +103,12 @@
"//aos/events:event_loop",
"//frc971/constants:constants_sender_lib",
"//frc971/control_loops:control_loop",
+ "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
"//frc971/control_loops/drivetrain:drivetrain_status_fbs",
"//frc971/shooter_interpolation:interpolation",
"//y2023:constants",
"//y2023/constants:constants_fbs",
"//y2023/constants:simulated_constants_sender",
- "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
"//y2023/control_loops/superstructure/arm",
"//y2023/control_loops/superstructure/arm:arm_trajectories_fbs",
],
diff --git a/y2023/control_loops/superstructure/arm/BUILD b/y2023/control_loops/superstructure/arm/BUILD
index 39e549b..a742c50 100644
--- a/y2023/control_loops/superstructure/arm/BUILD
+++ b/y2023/control_loops/superstructure/arm/BUILD
@@ -14,9 +14,9 @@
":generated_graph",
"//frc971/control_loops/double_jointed_arm:ekf",
"//frc971/control_loops/double_jointed_arm:graph",
+ "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
"//frc971/zeroing",
"//y2023:constants",
- "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
"//y2023/control_loops/superstructure:superstructure_position_fbs",
"//y2023/control_loops/superstructure:superstructure_status_fbs",
"//y2023/control_loops/superstructure/arm:arm_constants",
diff --git a/y2023/control_loops/superstructure/superstructure.h b/y2023/control_loops/superstructure/superstructure.h
index 1100b86..fdfef4e 100644
--- a/y2023/control_loops/superstructure/superstructure.h
+++ b/y2023/control_loops/superstructure/superstructure.h
@@ -5,10 +5,10 @@
#include "aos/json_to_flatbuffer.h"
#include "frc971/constants/constants_sender_lib.h"
#include "frc971/control_loops/control_loop.h"
+#include "frc971/control_loops/drivetrain/drivetrain_can_position_generated.h"
#include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
#include "y2023/constants.h"
#include "y2023/constants/constants_generated.h"
-#include "y2023/control_loops/drivetrain/drivetrain_can_position_generated.h"
#include "y2023/control_loops/superstructure/arm/arm.h"
#include "y2023/control_loops/superstructure/arm/arm_trajectories_generated.h"
#include "y2023/control_loops/superstructure/end_effector.h"