|
Re: Mecanum Wheels Programming
Magnitude has to be between 0 and 1. The most general way to do it is to have the Y and X axes of one joystick just act as point-and-shoot and use Pythagorean theorem (Magnitude = sqrt(X^2 + Y^2)). However, this results in a scale of 0 to 1.141, which means that with the limiting blocks they have inside Holonomic.vi, when driving while using multiple joystick axes with high values, come of the motor values will get capped, so you won't quite end up with the right vectors (because the over-1 magnitude will cause the motors to try to go faster than they can).
One way to get around this is to multiply the magnitude by .7, which will bring the max value back down to 1. However, this means that you can't go as fast forward or sideways, and you're only getting full speed diagonally. The way I prefer is to measure all of the motor values, and if any of them are out of range, scale all of the motors down to the most out-of-range motor (if the fastest motor is getting a value of 1.141, divide all of the motors by 1.141). This allows you to have full power in all directions, while maintaining correct vectors.
|