To avoid turret jitter and energy loss from the PID trying to get the turret to sub-degree accuracy but actually just causing it to jitter, the TurretSubsystem should have a distance-to-target scaled deadband where the turret motor is set to NeutralOut.
Similar to the turretAtTarget in the LauncherSubsystem, in rotateToTargetWithCalc the turret should get the current distance to the target, use Math.atan() to determine the radian size of a ~2cm (or similar size much smaller than the LauncherSubsystem 'at target' size). It should then send a NeutralOut request to the turret if the current position is within that range of the requested finalTarget and the FFV value is "small" (say, 0.05 radians / sec). The deadband should have fixed minimum and maximum sizes (in degrees) to ensure its size is reasonable at very far distances and very short distances, such as 0.1 and 1.0.
If jitter is still seen from the turret frequency crossing over the deadband and flipping between NeutralOut and PositionVoltage, consider adding some hysteresis where the turret exits the deadband if the error is 1.5x of the deadband size and enters it when the error is smaller than the deadband size.
To avoid turret jitter and energy loss from the PID trying to get the turret to sub-degree accuracy but actually just causing it to jitter, the TurretSubsystem should have a distance-to-target scaled deadband where the turret motor is set to NeutralOut.
Similar to the turretAtTarget in the LauncherSubsystem, in
rotateToTargetWithCalcthe turret should get the current distance to the target, useMath.atan()to determine the radian size of a ~2cm (or similar size much smaller than the LauncherSubsystem 'at target' size). It should then send aNeutralOutrequest to the turret if the current position is within that range of the requestedfinalTargetand theFFVvalue is "small" (say, 0.05 radians / sec). The deadband should have fixed minimum and maximum sizes (in degrees) to ensure its size is reasonable at very far distances and very short distances, such as 0.1 and 1.0.If jitter is still seen from the turret frequency crossing over the deadband and flipping between NeutralOut and PositionVoltage, consider adding some hysteresis where the turret exits the deadband if the error is 1.5x of the deadband size and enters it when the error is smaller than the deadband size.