this.shooter = shooter;
this.spindexer = spindexer;
//drivepose = drivetrain.getPose();
- drivepose = drivetrain.getPose().rotateBy(new Rotation2d(Math.PI)); // TODO: Revert when robot isn't backwards
+ drivepose = new Pose2d(drivepose.getTranslation(), drivepose.getRotation().plus(new Rotation2d(Math.PI)));
goalState = ShooterPhysics.getShotParams(
FieldConstants.getHubTranslation().minus(new Translation3d(drivepose.getTranslation())),
}
public void updateDrivePose(){
+ Pose2d currentPose = drivetrain.getPose();
+ // Add 180 degrees to the rotation bc robot is backwards
+ drivepose = new Pose2d(
+ currentPose.getTranslation(),
+ currentPose.getRotation().plus(new Rotation2d(Math.PI))
+ );
ChassisSpeeds robotRelVel = drivetrain.getChassisSpeeds();
- drivepose = drivetrain.getPose().exp(
+ drivepose.exp(
new Twist2d(
robotRelVel.vxMetersPerSecond * phaseDelay,
robotRelVel.vyMetersPerSecond * phaseDelay,
/* ---------------- Constants ---------------- */
- private static final double MIN_ANGLE_RAD = Units.degreesToRadians(-90); // Change this later to the actual values
- private static final double MAX_ANGLE_RAD = Units.degreesToRadians(90);
+ private static final double MIN_ANGLE_RAD = Units.degreesToRadians(-180); // Change this later to the actual values
+ private static final double MAX_ANGLE_RAD = Units.degreesToRadians(180);
- //private static final double MAX_VEL_RAD_PER_SEC = 25;
- private static final double MAX_VEL_RAD_PER_SEC = 3.0; // Starting super duper slow for now
+ private static final double MAX_VEL_RAD_PER_SEC = 25;
+ //private static final double MAX_VEL_RAD_PER_SEC = 3.0; // Starting super duper slow for now
private static final double MAX_ACCEL_RAD_PER_SEC2 = 160.0;
private static final double GEAR_RATIO = TurretConstants.TURRET_GEAR_RATIO;