В момента ресурсът е наличен само на английски

Tetrix Gamepads. Controlling robot arm with the Gamepad triggers Pro Preview

How to control the arm of the push bot using the two triggers on the GamePad of the FTC Push Bot? 

  • #521
  • 27 Apr 2017
  • 4:57


The arm of the robot is attached to a mechanism of gear wheels. We use a DC motor to lift the arm. It powers on of the gear wheels and from there the mechanism and the whole arm is lifted.

Be careful with powering the arm when it is in the lowest position

This breaks the wheels and the bends the axles on which the wheels are positioned.  We will solve this problem using a sensor in some of the next videos, but for now, we would just control arm with the program.

Sticks, Button and Triggers on the GamePad

On the GamePad we have Buttons, Sticks and Triggers, For this program, we use the triggers, but you can always modify it to use sticks or buttons. Triggers are just more commonly used for arms and are more convenient. When pressed, a Button is returning a value of 1 or 0, while a trigger is returning a value between 1 or 0. In this way, we can control the arm much better, because we know what should the speed of this arm be, based on how much have we pressed the Trigger.

Software Program

Define a variable 

DCMotor armMotor;

Map the variable to the hardware map

armMotor = hardwareMap.dcMotor.get("left_arm");

Set the power of this armMotor with 


To decide which trigger means UP and which DOWN we must place a minus sign in front of this gamepad trigger value. To make the left_trigger mean DOWN and a minus in front of it.


FTC Tetrix Arm Control with Triggers

Simple Linear Op Mode for the FTC Tetrix robot, for controlling the Arm with the GamePad triggers.


The classical FTC robot - the PushBot has an arm and in this video I'll show you how you can control the arm of this PushBot using the two triggers that are on the gamepad.

Let's go into more details into the programming of the gamepad. First, about the construction. This is an arm and we need a lot of torque in this system of gears here so that we can power the arm and lift something with this arm. We have a DC motor right here.

So, we have a DC motor right here and this DC motor powers one of the gear wheels this one here and from there we have a system of two gear wheels and at the end we have the arm moving up and down like this.

What we should be careful with is when moving if you try to move further, so if I lift the arm and now if I try to lower the arm and if I don't stop, this thing will happen. Now, in some of the next videos we'll solve this problem but for now let's see in the program how we can move the arm up and down with the two triggers on the gamepad. The other thing that is worth mentioning is that on the gamepad we have the sticks and with the sticks we can control the motor and we also have buttons and triggers. So, a button is just on\off while a trigger - we have a right trigger right here and a left trigger. The trigger returns a value between 0 and 1 and it divides this value to a number of smaller values and fractions between 0 and 1. I won't enter into details here. Probably in some of the next videos. The important thing is that these two are triggers while these two are buttons. And for controlling the arm we use the triggers. First we declare a new variable from type DcMotor and we call it armMotor with initial value of null. Then in the runOpMode() we assign the armMotor and that's the name we've given to it's hardwameMap.dcMotor.get("left_arm") and that's configured in the software on the phone. Then we go to the loop where we have the opModeIsActive() and in the loop we set armMotor.setPower and here we use gamepad1 and it's gamepad1.left_trigger+gamepad1.right_trigger. So, we have the left and the right. And now what we must decide is which one would be up and which one would be down. Here I would like to have the left trigger to be down and the right trigger to be up. That's why I'll add the gamepad1.left_trigger in this equation but with a sign minus(-). And this is actually our whole program. We have a declaration of the variable DcMotor then we have assignment of armMotor = hardwareMap.dcMotor.get("left_arm") and then we set the power of our armMotor. Let's download and run this program. As a final result we have our arm and we can control the arm with the triggers. And because the triggers return a value between 0 and 1 we can just push a little bit on the trigger and this will make the arm move very slowly or we can push more on the trigger and the arm will move faster.

Курсове и занятия включващи този Урок

Този Урок е използван в следните курсове и занятия.