Our robots pigeon is giving delay information about the heading of the robot while we are driving. This has resulted in our robot not driving properly in field oriented mode. The robots direction will slowly become further from direction it should be. Any thoughts?
Our Field Oriented Code:
if (fieldOrientedFunction.get()) {
chassisSpeeds = ChassisSpeeds.fromFieldRelativeSpeeds(
xSpeed, ySpeed, turningSpeed, new Rotation2d(drivetrain.getRotation2d().getRadians()));
} else {
// Relative to robot
chassisSpeeds = new ChassisSpeeds(xSpeed, ySpeed, turningSpeed);
}
Ty for any and all help