mirror of
https://github.com/Team4388/2026KPopRobotHunters.git
synced 2026-06-09 00:38:03 -06:00
Improve PIDs and such
This commit is contained in:
@@ -18,7 +18,7 @@ public class ShooterConstants {
|
||||
public static final double SHOOTERMOTOR_GEAR_RATIO = 1.5;
|
||||
public static final double INDEXER_GEAR_RATIO = 1.;
|
||||
|
||||
public static final ConfigurableDouble SHOOTER_ACTIVE_VELOCITY = new ConfigurableDouble("Shooter Active Velocity", -40);
|
||||
// public static final ConfigurableDouble SHOOTER_ACTIVE_VELOCITY = new ConfigurableDouble("Shooter Active Velocity", -40);
|
||||
public static final ConfigurableDouble SHOOTER_MAX_VELOCITY = new ConfigurableDouble("Shooter MAX Velocity", 60);
|
||||
public static final ConfigurableDouble SHOOTER_RESTING_VELOCITY = new ConfigurableDouble("Shooter Resting Velocity", 0.0);
|
||||
|
||||
@@ -28,23 +28,26 @@ public class ShooterConstants {
|
||||
public static final ConfigurableDouble AIM_LEAD_TIME = new ConfigurableDouble("Aim lead time", 0);
|
||||
|
||||
// Shoot mode tolerances
|
||||
public static final ConfigurableDouble ROBOT_MIN_HUB = new ConfigurableDouble("Shoot min dist M", 0);
|
||||
public static final ConfigurableDouble ROBOT_MAX_HUB = new ConfigurableDouble("Shoot max dist M", 99);
|
||||
public static final ConfigurableDouble ROBOT_MIN_HUB = new ConfigurableDouble("Shoot min dist M", 1.8);
|
||||
public static final ConfigurableDouble ROBOT_MAX_HUB = new ConfigurableDouble("Shoot max dist M", 4.8);
|
||||
|
||||
public static final ConfigurableDouble ROBOT_ANG_TOLERANCE = new ConfigurableDouble("Ang tolerance DEG", 360);
|
||||
|
||||
public static final ConfigurableDouble ROBOT_SPEED_TOLERANCE = new ConfigurableDouble("Speed tolerance MS", 1);
|
||||
public static final ConfigurableDouble ROBOT_ANG_SPEED_TOLERANCE = new ConfigurableDouble("Shoot Ang speed tolerance DEG", 3);
|
||||
|
||||
public static final ConfigurableDouble SHOOTER_SPEED_TOLERANCE = new ConfigurableDouble("Shooter speed tolerance RPS", 5);
|
||||
public static final ConfigurableDouble SHOOTER_SPEED_TOLERANCE = new ConfigurableDouble("Shooter speed tolerance RPS", 3);
|
||||
|
||||
//
|
||||
public static AngularVelocity getTargetShooterSpeed(double hubDistMeters) {
|
||||
// Model derived from points
|
||||
// double speed =
|
||||
// 1.11576*hubDistMeters*hubDistMeters +
|
||||
// 0.318464*hubDistMeters +
|
||||
// 30.6293;
|
||||
double speed =
|
||||
1.11576*hubDistMeters*hubDistMeters +
|
||||
0.318464*hubDistMeters +
|
||||
30.6293;
|
||||
5.6939*hubDistMeters +
|
||||
22.76545;
|
||||
|
||||
double max = SHOOTER_MAX_VELOCITY.get();
|
||||
|
||||
@@ -54,6 +57,8 @@ public class ShooterConstants {
|
||||
} else if(speed < -max) {
|
||||
speed = -max;
|
||||
}
|
||||
|
||||
// double speed = SHOOTER_MAX_VELOCITY.get();
|
||||
|
||||
return RotationsPerSecond.of(-speed);
|
||||
}
|
||||
@@ -62,7 +67,7 @@ public class ShooterConstants {
|
||||
public static Slot0Configs SHOOTER_PID = new Slot0Configs()
|
||||
.withKV(0.0)
|
||||
.withKP(0.08)
|
||||
.withKI(0.1)
|
||||
.withKI(0.15)
|
||||
.withKD(0.0);
|
||||
|
||||
|
||||
@@ -71,7 +76,7 @@ public class ShooterConstants {
|
||||
|
||||
|
||||
public static ConfigurableDouble shooter_kP = new ConfigurableDouble("Shooter KP", 0.08);
|
||||
public static ConfigurableDouble shooter_kI = new ConfigurableDouble("Shooter KI", 0.1);
|
||||
public static ConfigurableDouble shooter_kI = new ConfigurableDouble("Shooter KI", 0.15);
|
||||
public static ConfigurableDouble shooter_kD = new ConfigurableDouble("Shooter KD", 0);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user