Chris Minkwon Choi
Among multiple ways to move a robot, teleop is one of the most intuitive methods. In your project, you can add teleop feature easily for various purposes. For example, this code is used in the Robotag Project. Robotag Project is a game where robots play game of tag. In Robotag Project, this code is used to let the user take over the control and play as either cop or rubber.
The control is very intuitive, and there is short instruction built in to the system. w,a,d,x is for each directions, and s stops the robot. You can also play around with the original teleop and familiarize with the control using the original teleop.
Add the following code to the main class (not in a loop or if statement). These declares constants and mothods for teleop.
Then when you want to use teleop, add following code. These are the actual moving parts. Change 'use-teleop' to any other state name you need. If you want teleop to work in all times, take this code outside the if statement.
If you want to enter this 'use-teleop' using 'z' key,
This code can be edited for customization. Edit the 'msg' String at the top of the code for GUI, and edit constants for maximum speed.