Quote:
Originally Posted by EthanMiller
I do have one question on scaling. If the equations used are (ignoring rotation for now, and with joyX1 being the X axis of the first joystick, and so on)
W1 = joyX1
W2 = (- joyX1 / 2) + sqrt(3) joyY1 / 2
W3 = (- joyX1 / 2) - sqrt(3) joyY1 /2
And the joysticks give a value between -157 and +156, and the motors take a power command of between -100 and 100, I'd divide the results of those equations by 157 and multiply by 100, right?
Then, to add rotation, it would be added to each equation before the scaling, and I'd have to check for out-of-rangeness, and correct it if it was. Would I do that before or after the scaling to correct it? I don't think it would matter, but just in case it does.
|
Whenever you do inverse kinematics to find wheel speeds from joystick commands, you should always normalize the wheel speeds after they are calculated.
So for your example, what I would recommend is this:
1) divide each of the joystick values by 1.57 before plugging them into the inverse kinematic formulas
1) Look at the wheel speed values W1 W2 W3 calculated using the formulas, and find the one that has the maximum absolute value. Call this answer "max"
2) If "max" is less than or equal to 100, you're done. If "max" is greater than 100, divide each wheel speed by "max".
Quote:
|
Then, to add rotation, it would be added to each equation before the scaling, and I'd have to check for out-of-rangeness, and correct it if it was. Would I do that before or after the scaling to correct it? I don't think it would matter, but just in case it does.
|
It does matter.
Quote:
|
The front was planned only until a gyro or compass could acquired.
|
All that is required to do field-oriented control is to run the "forward" and "strafe right" commands through a Cartesian coordinate rotation before feeding them into the inverse kinematic formulas.
There's a paper titled "
1-26-2011 mecanum & omni with gyro for field-centric control"
here that shows how to do this.