- 18 Apr 2017
In this video we'll develop a program to control the FTC robot with only one gamepad and with only one stick. And now when I push on the stick the robot moves and then in the other direction. Again.
And we can even do it very fast.
The first thing that we should start from and that's a common misunderstanding probably is from the gamepad. When you have the gamepad and this is the gamepad from your point of view and you can push on the stick up or forward and for this we think as a minus value. So, when we pull it down like this this is a plus value from the point of view of the gamepad and if we push it forward or up, it's a minus value. And the reason for this is that these gamepads are used in a lot of games and if you have a plane, and if you want to go up with the plane, you pull down on the stick and this will make the plane go up because you have a plus and because you are going up and that's a plus and we can make a direct connection between the plus on pulling down and the plane going up. The same applies for pushing on the stick up which for a plane would mean go down. Like this. And now when we transfer this to our robot we have the motors and the motors are not directly rotating the wheels but they are rotating the wheels in the opposite direction. And we also have a minus sign right here in the software from there if we move with the stick up, the robot will move forward. This is the forward direction of our robot. And if we pull back on the stick,
we move backward. So, that's the first thing that's important. So, up is a minus (-), down is a plus (+). And you can also see this on the telemetry. So, if you take the robot station right here, and right here on the bottom it will be very difficult to show it on the camera but you have it on the phone you have the values for the different gamepads that are shown and if you move it down, you'll see this as a plus. And if you move it up, you'll see this as a minus. So, experiment and see it.
In our software program let's go through it again. We have the name, we comment the disable option, we've declared the two variables for the left and the right motor, then we've assigned these two variables, then we set the direction for the left and the right motor and what we must do now in the previous program we stopped with the left motor is controlled by the left stick while the right motor is controlled by the right stick. And the change that we must do now is to control both motors with the same stick left stick. So, we control left motor with the left stick and right motor again with the left stick. And this will make the robot move forward and backward just with the left stick. It will be difficult to turn but that's a subject for another video. Again, we control both motors with the left stick. Let's see how this works. As an end result: move forward and backward like this.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons