Is this a sensible way to do it?
Fragment of a discussion from User talk:Cbrowne
Jump to navigation
Jump to search
I think rather just go with this:
public void turnGunTo(double newHeading) { double oldHeading = getGunHeadingRadians(); // use of normalRelativeAngle means we don't have to decide left or right setTurnGunLeft(Utils.normalRelativeAngle(newHeading-oldHeading)); }
You can even move the getGunHeadingRadians() into the brackets if you want, and get rid of oldHeading, although that might be going a bit far =). Utils.normalRelativeAngle() will automatically clean up the full circle/double circle/no circle thing for you.
It might be setTurnGunRight though... you'll have to check.