Add JoystickGoal option to swerve Goal message
Change-Id: Ia86633d0c443a939d41131f0c06c03c85a6455e2
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/control_loops/swerve/BUILD b/frc971/control_loops/swerve/BUILD
index 50130e8..6be2604 100644
--- a/frc971/control_loops/swerve/BUILD
+++ b/frc971/control_loops/swerve/BUILD
@@ -14,8 +14,17 @@
)
static_flatbuffer(
+ name = "swerve_drivetrain_joystick_goal_fbs",
+ srcs = ["swerve_drivetrain_joystick_goal.fbs"],
+)
+
+static_flatbuffer(
name = "swerve_drivetrain_goal_fbs",
srcs = ["swerve_drivetrain_goal.fbs"],
+ deps = [
+ ":swerve_drivetrain_joystick_goal_fbs",
+ "//frc971/math:matrix_fbs",
+ ],
)
static_flatbuffer(
diff --git a/frc971/control_loops/swerve/swerve_drivetrain_goal.fbs b/frc971/control_loops/swerve/swerve_drivetrain_goal.fbs
index eab0d0d..7cbb11c 100644
--- a/frc971/control_loops/swerve/swerve_drivetrain_goal.fbs
+++ b/frc971/control_loops/swerve/swerve_drivetrain_goal.fbs
@@ -1,3 +1,6 @@
+include "frc971/math/matrix.fbs";
+include "frc971/control_loops/swerve/swerve_drivetrain_joystick_goal.fbs";
+
namespace frc971.control_loops.swerve;
// States what translation control type goal we will care about
@@ -22,11 +25,20 @@
translation_speed:double (id: 3);
}
+attribute "static_length";
+
+table LinearVelocityGoal {
+ state:frc971.fbs.Matrix (id: 0);
+ input:frc971.fbs.Matrix (id: 1);
+}
+
table Goal {
front_left_goal:SwerveModuleGoal (id: 0);
front_right_goal:SwerveModuleGoal (id: 1);
back_left_goal:SwerveModuleGoal (id: 2);
back_right_goal:SwerveModuleGoal (id: 3);
+ linear_velocity_goal:LinearVelocityGoal (id: 4);
+ joystick_goal:JoystickGoal (id: 5);
}
root_type Goal;
diff --git a/frc971/control_loops/swerve/swerve_drivetrain_joystick_goal.fbs b/frc971/control_loops/swerve/swerve_drivetrain_joystick_goal.fbs
new file mode 100644
index 0000000..bf44cdd
--- /dev/null
+++ b/frc971/control_loops/swerve/swerve_drivetrain_joystick_goal.fbs
@@ -0,0 +1,9 @@
+namespace frc971.control_loops.swerve;
+
+table JoystickGoal {
+ vx:float (id: 0);
+ vy:float (id: 1);
+ omega:float (id: 2);
+}
+
+root_type JoystickGoal;