How a Mecanum Drivetrain is programmed largely depends on the driver's preference for how the controller is configured. If your team is new to Mecanum, we have a
Using the the wrist only moves when one of the preset arm/wrist buttons on the controller is pressed. Your team may decide to add independent wrist movement for more refined control.
Below are a couple examples for adding wrist movement using the existing variables:
Example 1:
This option functions similar to the gripper using the two preset positions. If "Up" on the Dpad is held down then the wrist will move and stay in the up position. When released, it will return down.
Example 2:
This option breaks the movement apart to move up or down when the matching button is pressed once on the Dpad. The button does not need to be held for it to remain in the set position.
//Indepedent Wrist
if (gamepad1.dpad_up) {
wrist.setPosition(wristUpPosition);
}
if (gamepad1.dpad_down) {
wrist.setPosition(wristDownPosition);
}
Example Mecanum Drive Program
This example code uses a different configuration than the Starter Bot's provided code! Please make sure to update both your program and the configuration file through the Driver Station.
Adding Independent Wrist Movement
These examples are meant to replace the use of presets in favor of manual control of the arm and wrist.