Add shooter superstructure code
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Change-Id: I559d79e1308c8ec6d434235e16f0273b4ce09f0d
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index e444f8d..cc7ace3 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -2,13 +2,22 @@
"target_map": {% include 'y2024/vision/maps/target_map.json' %},
"shooter_interpolation_table": [
{
- "distance_from_goal": 0.0,
+ "distance_from_goal": 5.0,
"shot_params": {
"shot_velocity": 0.0,
"shot_altitude_angle": 0.0,
"shot_catapult_angle": 0.0,
- "shot_speed_over_ground": 0.0
+ "shot_speed_over_ground": 2.0
}
+ },
+ {
+ "distance_from_goal": 10.0,
+ "shot_params": {
+ "shot_velocity": 0.0,
+ "shot_altitude_angle": 0.0,
+ "shot_catapult_angle": 0.0,
+ "shot_speed_over_ground": 4.0
+ }
}
],
"intake_roller_voltages": {
@@ -93,24 +102,22 @@
},
"loop": {% include 'y2024/control_loops/superstructure/climber/integral_climber_plant.json' %}
},
- "turret_loading_position": 0.0,
- "catapult_return_position": 0.0,
"catapult": {
"zeroing_voltage": 3.0,
"operating_voltage": 12.0,
"zeroing_profile_params": {
- "max_velocity": 0.5,
- "max_acceleration": 3.0
+ "max_velocity": 1.0,
+ "max_acceleration": 6.0
},
"default_profile_params":{
"max_velocity": 6.0,
"max_acceleration": 30.0
},
"range": {
- "lower_hard": -0.85,
- "upper_hard": 1.85,
- "lower": -0.400,
- "upper": 1.57
+ "lower_hard": -0.15971,
+ "upper_hard": 2.85,
+ "lower": -0.020,
+ "upper": 2.5
},
"loop": {% include 'y2024/control_loops/superstructure/catapult/integral_catapult_plant.json' %}
},
@@ -146,10 +153,10 @@
"max_acceleration": 30.0
},
"range": {
- "lower_hard": -0.85,
- "upper_hard": 1.85,
- "lower": -0.400,
- "upper": 1.57
+ "lower_hard": -2.36,
+ "upper_hard": 2.36,
+ "lower": -2.16,
+ "upper": 2.16
},
"loop": {% include 'y2024/control_loops/superstructure/turret/integral_turret_plant.json' %}
},
@@ -171,5 +178,37 @@
"upper": 1.57
},
"loop": {% include 'y2024/control_loops/superstructure/extend/integral_extend_plant.json' %}
+ },
+ "shooter_targets": {
+ "red_alliance": {
+ "pos": {
+ "rows": 3,
+ "cols": 1,
+ "storage_order": "ColMajor",
+ // The data field contains the x, y and z
+ // coordinates of the speaker on the red alliance
+ "data": [-8.0645, -1.4435, 2.0705]
+ },
+ "theta": 0.0
+ },
+ "blue_alliance": {
+ "pos": {
+ "rows": 3,
+ "cols": 1,
+ "storage_order": "ColMajor",
+ // The data field contains the x, y and z
+ // coordinates of the speaker on the blue alliance
+ "data": [8.0645, -1.4435, 2.0705]
+ },
+ "theta": 0.0
+ }
+ },
+ "altitude_loading_position": 0.0,
+ "turret_loading_position": 0.0,
+ "catapult_return_position": 0.0,
+ "min_altitude_shooting_angle": 0.3,
+ "retention_roller_voltages": {
+ "retaining": 1.5,
+ "spitting": -6.0
}
}
diff --git a/y2024/constants/constants.fbs b/y2024/constants/constants.fbs
index 633dc2e..f1c86a0 100644
--- a/y2024/constants/constants.fbs
+++ b/y2024/constants/constants.fbs
@@ -2,6 +2,7 @@
include "frc971/vision/target_map.fbs";
include "frc971/control_loops/profiled_subsystem.fbs";
include "frc971/zeroing/constants.fbs";
+include "frc971/math/matrix.fbs";
include "frc971/control_loops/drivetrain/drivetrain_config.fbs";
namespace y2024;
@@ -106,6 +107,23 @@
extend_constants:PotAndAbsEncoderConstants (id: 5);
}
+table Pose {
+ // Pos is a 3x1 matrix which contains the (x, y, z) component of the Pose.
+ pos: frc971.fbs.Matrix (id: 0);
+ theta: double (id: 1);
+}
+
+table ShooterTargets {
+ // The Pose of the red and blue alliance speakers we are aiming at.
+ red_alliance: Pose (id: 0);
+ blue_alliance: Pose (id: 1);
+}
+
+table RetentionRollerVoltages {
+ retaining:double (id: 0);
+ spitting:double (id: 1);
+}
+
// Common table for constants unrelated to the robot
table Common {
target_map:frc971.vision.TargetMap (id: 0);
@@ -113,7 +131,6 @@
intake_roller_voltages:IntakeRollerVoltages (id : 2);
intake_pivot_set_points:IntakePivotSetPoints (id: 3);
intake_pivot:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 4);
-
drivetrain:frc971.control_loops.drivetrain.fbs.DrivetrainConfig (id: 5);
current_limits:CurrentLimits (id: 6);
transfer_roller_voltages:TransferRollerVoltages (id: 7);
@@ -127,12 +144,17 @@
extend:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 15);
extend_setpoints:ExtendSetPoints (id: 16);
extend_roller_voltages:ExtendRollerVoltages (id: 17);
+ shooter_targets:ShooterTargets (id: 18);
+ altitude_loading_position: double (id: 19);
+ retention_roller_voltages:RetentionRollerVoltages (id: 20);
+
+ min_altitude_shooting_angle: double (id: 21);
}
table Constants {
- robot:RobotConstants (id: 0);
- common:Common (id: 1);
- cameras:[CameraConfiguration] (id: 2);
+ cameras:[CameraConfiguration] (id: 0);
+ robot:RobotConstants (id: 1);
+ common:Common (id: 2);
}
root_type Constants;