How to correctly calculate the speed for each wheel?

I’m trying to calculate the speed for each wheel for a 3-wheel omnibus using such equations, but when moving sideways, my robot starts moving in a circle, and very strongly. According to my observations, the rear wheel should spin faster. What is the mistake?

image

What are the values of x, y, and z when your robot is moving sideways?

Look, if you calculate by the formula, then I assign a value of 0.5 to the x-axis (this is 50% of the power of the engines), and I get the following: leftspeed=-0.28865135,rightseed=0.28865135,
backspeed = 0.33333333

But he does not ride sideways, but rides sideways in a circle, as if starting to drift)

But I can catch the moment on the gamepad, I use the same formula and my robot goes straight sideways at : rightspeed = 0.2454875258728587
, backspeed = 0.4488189083834489

What are the x, y, and z values when your robot goes straight sideways with the rightspeed and backspeed numbers that you just posed?

See where I’m going here?

You’re asking for help debugging a formula, which none of us have the context of what the resulting calculation actually results in the action you’re expecting (drive sideways).

Here you have some set of values that produce the desired effect, what were they? And you have some set of values that do NOT produce the intended effect, what were they? Try to find the reason why you are seeing unintended behaviors.

To go straight, you need to assign y - values from -1 to 1, to go sideways, you need to assign x values from -1 to 1, to just rotate in place, you need to assign z values from -1 to 1, after that the speed is assigned to the engines since the values are in the range from -1 to 1.

- here’s what I use to calculate the speed

I just don’t quite understand through the translator what you want me to do

You said you could trigger the robot to drive sideways with the gamepad.

What were the x, y, and z input values to that holonomic drive function that produced the correct sideways driving?

Then, what were the inputs from the gamepad that produced those x,y, and z values?

Assuming a “3 wheel omnibus” is a kiwi drive - 3 omni wheels at 120 degrees from each other, your formulas are incorrect.

If x==0, y==0, z!=0, (pure rotation) all wheels should get the same throttle. Your equations have left and right going 73% faster than the back.

If x!=0, y==0, z==0 (strafe), the right and left wheels should be going twice as fast (that is, sec 60°) as the back. Your equation has right and left at 2/√3 times back.

I’m not sure what sign convention you want or which way your wheels turn given positive input, but maybe this will be closer (2 is sec 60° and 2/√3 is sec 30°):

rightSpeed = x*2 - y*2/Math.sqrt(3) + z;
leftSpeed = x*2 + y*2/Math.sqrt(3) + z;
backSpeed= x + z;

You may want to multiply all your z values by something a bit less than one (e.g. 2/3) based on your driver’s preference.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.