View Single Post
  #22   Spotlight this post!  
Unread 23-01-2007, 00:35
prograid's Avatar
prograid prograid is offline
Registered User
AKA: Ben Cherian
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Oct 2004
Rookie Year: 2004
Location: San Jose
Posts: 80
prograid will become famous soon enough
Re: mecanum programming

Just as an general guideline for programming with the RC: Avoid the use of floating-point numbers whenever possible. It seems as if you have calculated everything as doubles for the sake of rounding accuracy later on. It is not very helpful to use doubles in your actual robot code, because a difference in the PWM outputs by 1, will be extremely negligible.

As for the whole max joystick value issue, you can always just quickly check it by printing out the value of the joystick inputs in your code. Either way, you can simply just check to see if your variables have overflowed at the end of your code.

Another suggestion: If you are going to use a temporary variable to hold your PWM outputs while they are being calculated, it may make more sense to store them as signed chars instead of unsigned chars, since they intuitively make more sense. Then at the end just add 127 to your values.