Changes between Version 6 and Version 7 of ControlSystems/SoftwareTeam/Training/WPILib/CommandBasedProgramming


Ignore:
Timestamp:
Dec 17, 2019, 12:49:16 AM (6 years ago)
Author:
David Albert
Comment:

--

Legend:

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

    v6 v7  
    2020!ScreenStepsLive has a very good example of how a program might look if programmed for !TimedRobot and then the same program converted to !CommandRobot; you should review it [https://wpilib.screenstepslive.com/s/currentCS/m/cpp/l/241906-converting-a-simple-autonomous-program-to-a-command-based-autonomous-program here]
    2121
    22 The following is an example of a very simple Command Based Robot that has a single subsystem consisting of a servo motor with two positions: Open, Closed and they are selected using the A and B buttons on a gamepad.  Replace the template files with:
     22The following is an example of a very simple Command Based Robot that has a single subsystem consisting of a servo motor with two positions: Open, Closed and they are selected using the A and B buttons on a gamepad.  The servo motor should be connected to PWM port 0 and the code uses a Logitech F310 for the operator interface.  Replace the template files with:
    2323
    24 RobotMap.java:
     24!RobotMap.java:
    2525{{{
    2626package frc.robot;
     
    3232}}}
    3333
    34 Add ServoSubsystem.java under subsystems:
     34Add !ServoSubsystem.java under subsystems:
    3535{{{
    3636package frc.robot.subsystems;
     
    6868}}}
    6969
    70 Add OpenCommand.java and CloseCommand.java under commands:
    71 OpenCommand.java:
     70Add !OpenCommand.java and !CloseCommand.java under commands:
     71!OpenCommand.java:
    7272{{{
    7373package frc.robot.commands;
     
    9090}}}
    9191
    92 CloseCommand.java:
     92!CloseCommand.java:
    9393{{{
    9494package frc.robot.commands;
     
    105105  protected boolean isFinished() {
    106106    System.out.println("Close Pressed.");
    107     Robot.m_servo.setAngle(120);
     107    Robot.m_servo.setAngle(120); // set servo to closed position
    108108    return true;
    109109  }