0

I'm using a 3-wheeled omni bot which can move in any horizontal direction (example: https://www.robotshop.com/en/3wd-48mm-omni-wheel-mobile-robot.html).

Given an object velocity (velocity at which the entire bot should move) and an angle it should move in (degrees), how can I determine the required speed of each wheel?

I tried the following, but have experienced some strange results:

const int wheel1Deg = (90 - (90 - angle)) %  360;
const int wheel2Deg = (90 - (210 - angle)) % 360;
const int wheel3Deg = (90 - (330 - angle)) % 360;

Setpoint = cos ( wheel1Deg * PI / 180.0 );
.....etc
M-R
  • 769
  • 1
  • 6
  • 19
  • 4
    I'm voting to close this question as off-topic because this is a trigonometry question – Eugene Sh. Feb 26 '18 at 14:56
  • For each wheel, draw a right triangle with the hypotenuse drawn starting at the center of the wheel and pointing in the direction of travel. The length of the hypotenuse is the desired speed. Now, draw two more lines to form a right triangle, one line parallel to the wheel and one perpendicular. Solve the triangle, the parallel side is the speed for that wheel and the perpendicular line is the sideways rolling speed for that wheel (normally not needed). – Dean Franks Feb 26 '18 at 15:45
  • @DeanFranks, If you could write up an answer with diagrams/equations, I'll select it as chosen answer. – M-R Feb 26 '18 at 15:47
  • And how could I figure out the angle of direction of each wheel from one angle originating from the center of the bot? – M-R Feb 26 '18 at 15:49
  • This should probably be migrated to Arduino. – Dean Franks Feb 26 '18 at 16:10

1 Answers1

1

Holonomic Motion

This is a simple trig problem:

S = desired speed
a = desired angle of travel relative to wheel

If the robot is oriented with a wheel sideways on the front of the robot, then wheel offsets will be 90, 210, 330 (front, right, left).

a = desired angle of travel + offset angle of wheel
sin(a) = M / s
M = S * sin(a)

Repeat for each wheel.

Once you write the code, do a quick check for a=0 and make sure M=S and for a=90 and make sure M=0.

(edit: angles corrected, my bad)

Dean Franks
  • 3,441
  • 2
  • 13
  • 19
  • How can you calculate desired angle of travel relative to wheel? – M-R Feb 26 '18 at 16:15
  • Just add the wheel offset. If the front wheel is perpendicular to "forward", the to travel forward the angles are front=90+0 = 90, right = 210+0 = 210, left = 330+0 = 330. To move left, front = 90+90=180, right = 210+90 = 300, left = 330 + 90 = 420 = 60. To rotate while moving, just add or subtract a rotational speed component to each wheel speed. You have to recalculate the numbers frequently if you do this as the triangles will change. – Dean Franks Feb 26 '18 at 17:56
  • How should I handle potential divide by 0s? – M-R Feb 27 '18 at 13:38
  • And is M the speed of each wheel? – M-R Feb 27 '18 at 13:41
  • The bot is not moving as expected. I've uploaded the code here (https://pastebin.com/3TZXGYzU) to show you the maths I implemented (towards the top). Am I doing something wrong? Thanks – M-R Feb 27 '18 at 14:05
  • Post your code and question in the Arduino SE for an answer. – Dean Franks Feb 27 '18 at 15:13
  • I was apparently more than half asleep when I did the math, I fixed the equations above. There is no divide by zero case now. – Dean Franks Feb 27 '18 at 15:18