Changes between Version 1 and Version 2 of ControlSystems/SoftwareTeam/Training/WPILib/CommandBasedProgramming


Ignore:
Timestamp:
Dec 15, 2019, 9:39:57 AM (6 years ago)
Author:
David Albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/SoftwareTeam/Training/WPILib/CommandBasedProgramming

    v1 v2  
    99A given activity may require more than one subsystem (e.g. throwing a frisbee might require both the turret and the shooter).  More than one activity can be running at the same time (e.g. the robot might be driving while throwing frisbees).  The Command-Based framework helps organize all of this activity so that multiple things can be happening at the same time without interfering with each other (e.g. preventing two commands from trying to control of the same subsystem at the same time).
    1010
     11=== Creating a Command-Based Program ===
     12Create a new project in VSCode (WPILib Icon->Create a new project->Template->Java->Command Robot).  Notice that in the project src folder, addition to the Main.java and Robot.java we're used to seeing, the project also has: [[Image(CommandBasedFiles.jpg)]]
     13   * OI.java - where the Operator Interface is defined
     14   * RobotMap.java
     15   * commands folder - where your Commands will be stored
     16   * subsystems folder - where your Subsystems will be stored
     17Robot.java still extends TimedRobot (the framework we've been using until now) and the methods robotInit(), robotPeriodic(), autonomousInit(), autonomousPeriodic(), teleopInit(), teleopPeriodic().  However, it now includes an example subsystem and an instance of the OI (Operator Interface) that represents the driver station; the OI helps bind the controls on the driver station (e.g. joystick, xbox controller) to the activities (commands, command groups) that your robot will be performing.  For example, the OI allows you to connect a button on your controller to an activity like launching a frisbee.
     18
     19
    1120
    1221=== How it works ===