View Single Post
  #25   Spotlight this post!  
Unread 17-02-2008, 14:32
Lesman's Avatar
Lesman Lesman is offline
Registered User
FRC #1014 (Bad Robot)
Team Role: Engineer
 
Join Date: Feb 2008
Rookie Year: 2006
Location: Dublin
Posts: 35
Lesman will become famous soon enough
Re: Code For Mecanum Wheels

Which way is more 'correct'

Basically, my method calculates the angle of motion, and uses that to generate motor outputs. Then scales everything back based on the magnitude of the motion. Afterwards it adds the rotation by simply adding the z axis to the four motor outputs, and then, if necessary, scales them back to fit in 0-255.

The other methods I have seen appropriately add up all the x,y,z inputs and and then, one way or another, scale it back to fit into 0-255 (some do it better than others).

Which of these methods produce a more desirable result (ignoring code complexity and execution time)? I personally feel that my method is more 'correct'. For example: sliding at a 45 degree angle at full magnitude is not full forward + full sideways, as that would result in root(2) magnitude (on a scale of -1 to 1) in that direction, which is obviously not possible. As opposed to my code, which handles angles, and always outputs an appropriate magnitude.

I'm no expert, but that's just my gut feeling.