Changes between Version 3 and Version 4 of ControlSystems/SoftwareTeam/Training/WPILib/CommandGroupProgramming
- Timestamp:
- Feb 27, 2020, 11:08:46 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/Training/WPILib/CommandGroupProgramming
v3 v4 1 1 The last example showed two simple commands and how to connect them with the user interface, but the commands were simple: they set a servo position and immediately finished. In practice, robot commands often need to run continuously until something happens; for example, a command to raise an arm might start a motor moving and continue until some time has passed or an encoder indicates that the arm has moved a certain distance or a limit switch is pressed. WPILib commands make this easy. Even better, you can string several such commands together in a !CommandGroup to effect complex behaviors. 2 2 3 Commands can be grouped together to run in sequence for example, when the X button is pressed, the following code will run the servo open command, allow time for it to finish, and then run the servo close command :3 Commands can be grouped together to run in sequence for example, when the X button is pressed, the following code will run the servo open command, allow time for it to finish, and then run the servo close command. The !OpenCommand adds a Timer to allow the servo motor time to complete moving to the open position before the !CloseCommand is run : 4 4 5 5 Constants.java