We have a new robot, (Prepping for next year,) and I have NO idea how to code these wheels. Any Tips?
Blocks or Java?
-Danny
Blocks, As the label shows.
There’s actually a sample that has Mecanum programmed, “BasicOmniOpMode”.
This is the “meat” of the algorithm:
Algorithm Explanation
The first part of the algorithm reads the gamepad data and stores them in variables; Axial (forwards/backwards), Lateral (strafe), and Yaw (rotation) gamepad values are saved.
The second part actually calculates the power levels for each of the four wheels in order to correctly generate the behavior we’re looking for.
The third part attempts to calculate a normalization value - the second step calculated the motor power levels, but the values are possible to be greater than 1 or less than -1. Any motor values greater than 1 or less than -1 is clipped when set, and clipped values means your motor values aren’t balanced properly to get the proper behavior. So we determine the maximum value and if it’s greater than 1 we divide everything by the max value, so that the highest motor value gets “1” and everything else gets normalized properly. This is important for Mecanum behavior.
Then the fourth part actually sets the motors to the final power levels.
-Danny
There’s also some pretty good description (including both Blocks and OnBotJava examples) in Game Manual 0. Perhaps take a look at Mecanum TeleOp - Game Manual 0 for an explanation of how mecanum works and ways to code it.