|
Re: Code For Mecanum Wheels
The wheels are made up of rollers that are placed at an angle (like an omni wheel, only at 45 degrees instead of perpendicular).
You need one motor for each wheel.
Driving the wheel does not create force completely forward or backward, rather at an angle, due to the rollers rolling freely on the ground as the entire wheel drives forward.
Driving all 4 wheels forwards makes the sideways components of the forces cancel each other out, causing the robot to drive forward (this is why the front-left and back-right rollers are at the same angle, and the front-right and back-left rollers are at the same angle).
Driving one sides wheels towards each other and the other sides wheels away from each other will make all the forward/backward components of the forces cancel to create a sideways motion.
Driving one sides wheels forward and the other sides wheels backwards will cause the robot to rotate (just like a tank drive).
The algorithms in this topic present ways to take the joystick input and use it to create PWM output to the motors to "mix" the drives of the wheels to create the desired translation/rotation by nullifying certain parts/amounts of the different forces acting upon the robot.
|