Most advanced teams use the Command Framework for their robot programming because it provides a powerful paradigm for breaking up the many robot control features. Subsystems represent robot hardware and Commands represent complex actions performed using that hardware.
See the attached files for an example of a program that has commands to open and close something using a servo motor. The open and close commands are bound to the X and Y buttons on a game controller.
Start with a Command template program and:
- In the subsystems folder, delete the example subsystem and add the attached files:
- In the commands folder, delete the example command and add the attached files:
- Replace the files with the attached versions:
Notice that Main.java and Robot.java are unchanged; their behavior is generic; you define the robot behavior through adding subsystems, commands, and binding controls to the commands.
Attachments (5)
-
Constants.java (1020 bytes) - added by 5 years ago.
Constants defining device addresses and connections
-
RobotContainer.java (2.3 KB) - added by 5 years ago.
Contains the subsystems of the robot and binds commands to controller inputs
-
OpenCommand.java (1.6 KB) - added by 5 years ago.
Open command moves servo to far left position
-
CloseCommand.java (1.5 KB) - added by 5 years ago.
Close command moves servo to far left position
-
ServoSubsystem.java (1.1 KB) - added by 5 years ago.
Servo Subsystem models the physical servo motor and provides methods to control it
Download all attachments as: .zip