JasonMewes
asked on
Reversing the Kiwi-Drive formula
We've recently build a kiwidrive robot, and now we want to use it as a musical instrument.
It has three wheels, each with a motor that produces a distinct tone.
The formulas used to calculate motor speeds are as follows:
M1 = 0.5 * X - 0.866 * Y + R
M2 = 0.5 * X + 0.866 * Y + R
M3 = X + R
Since we are no good at math, we need help reversing these formulas so that for a given M1, M2 and M3, we want to calculate X, Y and R.
Thanks!
It has three wheels, each with a motor that produces a distinct tone.
The formulas used to calculate motor speeds are as follows:
M1 = 0.5 * X - 0.866 * Y + R
M2 = 0.5 * X + 0.866 * Y + R
M3 = X + R
Since we are no good at math, we need help reversing these formulas so that for a given M1, M2 and M3, we want to calculate X, Y and R.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the original question stated:
M1 = 0.5 * X - 0.866 * Y + R
M2 = 0.5 * X + 0.866 * Y + R
M3 = X + R
now you indicate that the 'correct' formula should have been
M1 = -0.5 * X - ( sqrt( 3 ) / 2 ) * Y + R
M2 = -0.5 * X + ( sqrt( 3 ) / 2 ) * Y + R
M3 = X + R
notice the sign difference on the first factor of M2.
with the new formulae,
M1 +M2 = -X + 2 * R
M3 = X + R
hence R = (M1 + M2 + M3)/3
X = - (M1 + M2) + 2 *(M1 + M2 + M3)/3 = (2 * M3 - M1 - M2)/3 (which is the same as ( -2 * M3 + M2 + M1 ) / -3)
Y = (M2 - M1) /sqrt(3) = (M2 - M1) * Sqrt(3)/3 which is the same as ( M1 - M2 ) * ( sqrt( 3 ) / -3 )
AW
M1 = 0.5 * X - 0.866 * Y + R
M2 = 0.5 * X + 0.866 * Y + R
M3 = X + R
now you indicate that the 'correct' formula should have been
M1 = -0.5 * X - ( sqrt( 3 ) / 2 ) * Y + R
M2 = -0.5 * X + ( sqrt( 3 ) / 2 ) * Y + R
M3 = X + R
notice the sign difference on the first factor of M2.
with the new formulae,
M1 +M2 = -X + 2 * R
M3 = X + R
hence R = (M1 + M2 + M3)/3
X = - (M1 + M2) + 2 *(M1 + M2 + M3)/3 = (2 * M3 - M1 - M2)/3 (which is the same as ( -2 * M3 + M2 + M1 ) / -3)
Y = (M2 - M1) /sqrt(3) = (M2 - M1) * Sqrt(3)/3 which is the same as ( M1 - M2 ) * ( sqrt( 3 ) / -3 )
AW
ASKER
x = 50, y = 12, r = 97
M1 = 0.5 * x - 0.866 * y + r
M2 = 0.5 * x + 0.866 * y + r
M3 = x + r
r = 0.5 * M1 + 1.5 * M2 - M3
x = -0.5 * M1 - 1.5 * M2 + 2 * M3
y = (1 / 1.732) * (M2 - M3)
yields: x = 39.608, y = -8,43418013856813, z = 107,392
In any case my initial formula was wrong but I would have given you your points anyways if the answer had been correct, but as demonstrated above it doesn't seem to be. Correct me if I made a mistake.
The correct formula should have been:
M1 = -0.5 * X - ( sqrt( 3 ) / 2 ) * Y + R
M2 = -0.5 * X + ( sqrt( 3 ) / 2 ) * Y + R
M3 = X + R
For which the solution seems to be:
X = ( -2 * M3 + M2 + M1 ) / -3
Y = ( M1 - M2 ) * ( sqrt( 3 ) / -3 )
R = ( M3 + M2 + M1 ) / 3
Points to anyone who can verify the validity of the solution.