|
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.
|