Mecanum Wheels Strafing in an Arc

My robot has mecanum wheels and they strafe, however, they move the robot in an arc. I have my code setup to where I can edit the power, but I don’t know how to fix it. It arcs towards the front right when I strafe right. Here is my current equation in the code, and the 1 in the (1gamepad1.right_stick_x) is what I need to change. Somebody please help me.
Yf = (gamepad1.left_stick_y + gamepad1.right_stick_y)/2;
Yt = (gamepad1.left_stick_y - gamepad1.right_stick_y)/2;
frontleft = ((1
Yf) + (1Yt) - (1gamepad1.left_stick_x));
frontright = ((1Yf) - (1Yt) - (1gamepad1.left_stick_x));
backleft = ((1
Yf) + (1Yt) + (1gamepad1.left_stick_x));
backright = ((1Yf) - (1Yt) + (1*gamepad1.left_stick_x));

I would make sure that the front right berings are on tight and that the shaft colars are not on to tight. if the shaft colars are on tight then it will cause the wheel to move at a slower rate then the other wheels causeing it to strafe. the berings also might not have two screws going through it causeing friction.

You’re gonna want to reclassify this as a VexCode v5 post. It’ll get more answers

Although it could be a friction issue as @JamesChase noted, those are less common with V5, as the brain will just send more power to get the motor up to the velocity you are requesting. If the right side is not parallel with the left, however, you could see undesirable drive motion even when the wheels are all spinning at the correct velocity.

TLDR, check that your drive base is straight.

3 Likes

Formula looks wrong

See Programming Mecanum Wheels
From magicode’s (very well-done) tutorial:
FrontLeft = Ch3 + Ch1 + Ch4
RearLeft = Ch3 + Ch1 - Ch4
FrontRight = Ch3 - Ch1 - Ch4
RearRight = Ch3 - Ch1 + Ch4

Where:
Ch1 = Right joystick X-axis
Ch3 = Left joystick Y-axis
Ch4 = Left joystick X-axis
Where positive is to the right or up on the joysticks.

3 Likes

Please, also check that the wheels are installed correctly and that all four wheels are touching the ground surface equally all the time.

This post has picture of the correct wheel installation and a link to the sample code: Mecanum Wheels Code Problems

2 Likes

if you have a tray bot it is certainly weight issues. there are no ways around it. strafing towards both left and right should make the same arc. if the arcs are significantly different then it’s not just weight. maybe you’ve got a broken motor.

2 Likes

My boys have a mecanum tray bot that strafes left and right with virtually no drift/arc. Over about 3 feet, it may be 1 inch from “true”.

try strafing with a full tray and you’ll see.
so if it isn’t a weight issue it might be a build quality issue or as ive said before a broken motor. also check your gear cartridges and whether your axles are pushed all the way in.

1 Like