Advanced Tele-Op Control
Oftentimes simple button mapping isn’t enough to pilot a robot. It's inconvenient to have to press an exact series of buttons to score an object or trigger an objective. During the game, in the heat of the moment, drivers can mess up, losing otherwise good points. To prevent this, sets of commands are usually linked to buttons.
Here is how it's typically done. We start with a simple program that has each motor mapped to a joystick.
Here is where we can enhance the program.
One common repeated set of commands is opening and releasing a robot claw to pick up and drop game objects. We could code the motor so that a joystick determines how much they open and close but this is inefficient and forgetting to close the claw after each use can cause the claw to get jammed in something. A smarter solution is to just map all the steps onto a single button.
In the main loop of the program, we can add a special trigger if a button (for the demonstration the “A” button is used) is pressed.
Now if the “A” button is pressed, we can set the robot to open and then close its claw.
First reverse the motor and give it a second so that the claw fully opens.
Then give the program a second to fully close the claw.
And there you have it, an algorithm in the press of a button!
Now, this demonstration may seem very simple but it's the effect it has that makes it so impactful. Now when you're piloting the robot, your controls are much smoother and intuitive. In real competitions, small quality of life features like this can be the tiebreaker between otherwise equally matched robots.