Rules.getTurnRate does not function correctly with negative velocities. Math.abs(velocity) should be performed. This fails at least as early as 1.6.1.4. I only started noticing it recently when I converted my old formulas to use the Rules versions. Many hours were consumed narrowing this down.
Anonymous
Can you please tell me more specific about the problem? Because the turn rate is supposed to be positive if the robot turns right and negative when the robot turns left
Rules.getTurnRate( double velocity ) is supposed to give you the maximum rate of turn, in Degrees, based on your present velocity. Velocity can be between -8.0 and 8.0, with negative being a speed in reverse. Rules.getTurnRateRadians( velocity ) calls the Degrees version and then converts the result to radians.
The formula (going from memory) is something like 10 - 0.75 * velocity. It should be 10 - 0.75 * Math.abs( velocity ) for the method to function correctly regardless of your direction of travel.
Because you can manually cap the rate of turn of your robot, though I doubt it is used much outside sample.Spinbot, there is a Robot.getTurnRate() method to see what you have capped it at, but I am referring to Rules.getTurnRate( double velocity ), not the Robot version.
-- Currection -- "based on your present velocity" is misleading. It should read "based on a given velocity", as the method has no idea about your bot.