Improved Command-based examples (#906)

Robot.cpp has been split into header-source pairs and the Command-based
examples now define an example subsystem in the Robot class.
This commit is contained in:
Tyler Veness
2018-03-05 22:06:40 -08:00
committed by Peter Johnson
parent 14228d82f3
commit 96e9a6989c
12 changed files with 368 additions and 296 deletions

View File

@@ -23,8 +23,7 @@ import edu.wpi.first.wpilibj.templates.commandbased.subsystems.ExampleSubsystem;
* project.
*/
public class Robot extends TimedRobot {
public static final ExampleSubsystem kExampleSubsystem
= new ExampleSubsystem();
public static ExampleSubsystem m_subsystem = new ExampleSubsystem();
public static OI m_oi;
Command m_autonomousCommand;

View File

@@ -16,7 +16,7 @@ import edu.wpi.first.wpilibj.templates.commandbased.Robot;
public class ExampleCommand extends Command {
public ExampleCommand() {
// Use requires() here to declare subsystem dependencies
requires(Robot.kExampleSubsystem);
requires(Robot.m_subsystem);
}
// Called just before this Command runs the first time