In this tutorial, we are controlling the FTC Tetrix robot with the two sticks of the same GamePad. The left stick is for forward and backwards, while the right stick is for left and right.
- 21 Apr 2017
Different power for the left and right motor
The calculation should be done based on the position of the stick. We take the account for the "x" and "y" position of both sticks. 50% of the power should come from the left and 50% from the right stick.
leftPower = - gamepad1.left_stick_y/2 + gamepad1.right_stick_x/2
leftPower = - gamepad1.left_stick_y/2 - gamepad1.right_stick_x/2
Part of the power comes from the Y axis of the first stick and part of the X axis from the second stick. You can modify the formula, but the principle for controlling with both sticks is the same.