mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-09 00:38:01 -06:00
Implement new Command Based Framework
This commit is contained in:
@@ -1,91 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package frc4388.robot;
|
||||
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.buttons.JoystickButton;
|
||||
import frc4388.robot.commands.Drive.DriveWithJoystick;
|
||||
import frc4388.robot.commands.Drive.GamerMove;
|
||||
import frc4388.utility.controller.IHandController;
|
||||
import frc4388.utility.controller.XboxController;
|
||||
|
||||
/**
|
||||
* This class is the glue that binds the controls on the physical operator
|
||||
* interface to the commands and command groups that allow control of the robot.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public class OI {
|
||||
//// CREATING BUTTONS
|
||||
// One type of button is a joystick button which is any button on a
|
||||
//// joystick.
|
||||
// You create one by telling it which joystick it's on and which button
|
||||
// number it is.
|
||||
// Joystick stick = new Joystick(port);
|
||||
// Button button = new JoystickButton(stick, buttonNumber);
|
||||
|
||||
// There are a few additional built in buttons you can use. Additionally,
|
||||
// by subclassing Button you can create custom triggers and bind those to
|
||||
// commands the same as any other Button.
|
||||
|
||||
//// TRIGGERING COMMANDS WITH BUTTONS
|
||||
// Once you have a button, it's trivial to bind it to a button in one of
|
||||
// three ways:
|
||||
|
||||
// Start the command when the button is pressed and let it run the command
|
||||
// until it is finished as determined by it's isFinished method.
|
||||
// button.whenPressed(new ExampleCommand());
|
||||
|
||||
// Run the command while the button is being held down and interrupt it once
|
||||
// the button is released.
|
||||
// button.whileHeld(new ExampleCommand());
|
||||
|
||||
// Start the command when the button is released and let it run the command
|
||||
// until it is finished as determined by it's isFinished method.
|
||||
// button.whenReleased(new ExampleCommand());
|
||||
|
||||
private static OI instance;
|
||||
|
||||
public static XboxController m_driverXbox;
|
||||
private static XboxController m_operatorXbox;
|
||||
|
||||
public OI() {
|
||||
m_driverXbox = new XboxController(RobotMap.XBOX_DRIVER_ID);
|
||||
m_operatorXbox = new XboxController(RobotMap.XBOX_OPERATOR_ID);
|
||||
|
||||
JoystickButton GamerMove = new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON);
|
||||
GamerMove.whenPressed(new GamerMove());
|
||||
GamerMove.whenReleased(new DriveWithJoystick());
|
||||
}
|
||||
|
||||
public static OI getInstance() {
|
||||
if(instance == null) {
|
||||
instance = new OI();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public IHandController getDriverController() {
|
||||
return m_driverXbox;
|
||||
}
|
||||
|
||||
public IHandController getOperatorController()
|
||||
{
|
||||
return m_operatorXbox;
|
||||
}
|
||||
|
||||
public Joystick getOperatorJoystick()
|
||||
{
|
||||
return m_operatorXbox.getJoyStick();
|
||||
}
|
||||
|
||||
public Joystick getDriverJoystick()
|
||||
{
|
||||
return m_driverXbox.getJoyStick();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -8,8 +8,8 @@
|
||||
package frc4388.robot;
|
||||
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import edu.wpi.first.wpilibj.command.Scheduler;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||
|
||||
/**
|
||||
* The VM is configured to automatically run this class, and to call the
|
||||
@@ -20,7 +20,8 @@ import edu.wpi.first.wpilibj.command.Scheduler;
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
Command m_autonomousCommand;
|
||||
public static RobotContainer m_robotContainer;
|
||||
|
||||
private RobotContainer m_robotContainer;
|
||||
|
||||
/**
|
||||
* This function is run when the robot is first started up and should be
|
||||
@@ -43,6 +44,11 @@ public class Robot extends TimedRobot {
|
||||
*/
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
// Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
|
||||
// commands, running already-scheduled commands, removing finished or interrupted commands,
|
||||
// and running subsystem periodic() methods. This must be called from the robot's periodic
|
||||
// block in order for anything in the Command-based framework to work.
|
||||
CommandScheduler.getInstance().run();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,19 +62,10 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void disabledPeriodic() {
|
||||
Scheduler.getInstance().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* This autonomous (along with the chooser code above) shows how to select
|
||||
* between different autonomous modes using the dashboard. The sendable
|
||||
* chooser code works with the Java SmartDashboard. If you prefer the
|
||||
* LabVIEW Dashboard, remove all of the chooser code and uncomment the
|
||||
* getString code to get the auto name from the text box below the Gyro
|
||||
*
|
||||
* <p>You can add additional auto modes by adding additional commands to the
|
||||
* chooser code above (like the commented example) or additional comparisons
|
||||
* to the switch structure below with additional strings & commands.
|
||||
* This autonomous runs the autonomous command selected by your {@link RobotContainer} class.
|
||||
*/
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
@@ -83,7 +80,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
// schedule the autonomous command (example)
|
||||
if (m_autonomousCommand != null) {
|
||||
m_autonomousCommand.start();
|
||||
m_autonomousCommand.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +89,6 @@ public class Robot extends TimedRobot {
|
||||
*/
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
Scheduler.getInstance().run();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,7 +107,7 @@ public class Robot extends TimedRobot {
|
||||
*/
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
Scheduler.getInstance().run();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,9 +8,13 @@
|
||||
package frc4388.robot;
|
||||
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import edu.wpi.first.wpilibj.command.InstantCommand;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
|
||||
import frc4388.robot.Constants.*;
|
||||
import frc4388.robot.commands.Drive.DriveWithJoystick;
|
||||
import frc4388.robot.commands.Drive.GamerMove;
|
||||
import frc4388.robot.commands.LED.UpdateLED;
|
||||
import frc4388.robot.subsystems.Drive;
|
||||
import frc4388.robot.subsystems.LED;
|
||||
import frc4388.utility.controller.IHandController;
|
||||
@@ -25,18 +29,34 @@ import frc4388.utility.controller.XboxController;
|
||||
*/
|
||||
public class RobotContainer {
|
||||
/* Subsystems */
|
||||
public static final Drive m_robotDrive = new Drive();
|
||||
public static final LED m_robotLED = new LED();
|
||||
private final Drive m_robotDrive = new Drive();
|
||||
private final LED m_robotLED = new LED();
|
||||
|
||||
/* Controllers */
|
||||
XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID);
|
||||
XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||
private final XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID);
|
||||
private final XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||
|
||||
/**
|
||||
* The container for the robot. Contains subsystems, OI devices, and commands.
|
||||
*/
|
||||
public RobotContainer() {
|
||||
|
||||
configureButtonBindings();
|
||||
|
||||
/* Default Commands */
|
||||
m_robotDrive.setDefaultCommand(new DriveWithJoystick(m_robotDrive, getDriverController()));
|
||||
m_robotLED.setDefaultCommand(new UpdateLED(m_robotLED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to define your button->command mappings. Buttons can be created by
|
||||
* instantiating a {@link GenericHID} or one of its subclasses ({@link
|
||||
* edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then passing it to a
|
||||
* {@link edu.wpi.first.wpilibj2.command.button.JoystickButton}.
|
||||
*/
|
||||
private void configureButtonBindings() {
|
||||
new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON)
|
||||
.whenPressed(new GamerMove(m_robotDrive))
|
||||
.whenReleased(new DriveWithJoystick(m_robotDrive, getDriverController()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,6 +69,7 @@ public class RobotContainer {
|
||||
return new InstantCommand();
|
||||
}
|
||||
|
||||
|
||||
public IHandController getDriverController() {
|
||||
return m_driverXbox;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package frc4388.robot;
|
||||
|
||||
/**
|
||||
* The RobotMap is a mapping from the ports sensors and actuators are wired into
|
||||
* to a variable name. This provides flexibility changing wiring, makes checking
|
||||
* the wiring easier and significantly reduces the number of magic numbers
|
||||
* floating around.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public class RobotMap {
|
||||
// For example to map the left and right motors, you could define the
|
||||
// following variables to use with your drivetrain subsystem.
|
||||
// public static int leftMotor = 1;
|
||||
// public static int rightMotor = 2;
|
||||
|
||||
// If you are using multiple modules, make sure to define both the port
|
||||
// number and the module. For example you with a rangefinder:
|
||||
// public static int rangefinderPort = 1;
|
||||
// public static int rangefinderModule = 1;
|
||||
|
||||
/* Xbox Controllers */
|
||||
public static final int XBOX_DRIVER_ID = 0;
|
||||
public static final int XBOX_OPERATOR_ID = 1;
|
||||
|
||||
/* Blinkin LED Strip */
|
||||
public static final int LED_SPARK_ID = 0;
|
||||
|
||||
/* Drive Train */
|
||||
public static final int DRIVE_LEFT_FRONT_CAN_ID = 2;
|
||||
public static final int DRIVE_RIGHT_FRONT_CAN_ID = 4;
|
||||
public static final int DRIVE_LEFT_BACK_CAN_ID = 3;
|
||||
public static final int DRIVE_RIGHT_BACK_CAN_ID = 5;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,46 +7,46 @@
|
||||
|
||||
package frc4388.robot.commands.Drive;
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import frc4388.robot.Robot;
|
||||
import frc4388.robot.RobotContainer;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc4388.robot.subsystems.Drive;
|
||||
import frc4388.utility.controller.IHandController;
|
||||
|
||||
public class DriveWithJoystick extends Command {
|
||||
public class DriveWithJoystick extends CommandBase {
|
||||
|
||||
private final Drive m_drive;
|
||||
private final IHandController m_driverXbox;
|
||||
public double m_inputMove, m_inputSteer;
|
||||
|
||||
public DriveWithJoystick() {
|
||||
// Use requires() here to declare subsystem dependencies
|
||||
// eg. requires(chassis);
|
||||
/**
|
||||
* Creates a new DriveWithJoystick, driving the robot with the given controller
|
||||
*/
|
||||
public DriveWithJoystick(Drive subsystem, IHandController controller) {
|
||||
m_drive = subsystem;
|
||||
m_driverXbox = controller;
|
||||
addRequirements(m_drive);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
protected void initialize() {
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
protected void execute() {
|
||||
m_inputMove = Robot.m_robotContainer.getDriverController().getLeftYAxis();
|
||||
m_inputSteer = -(Robot.m_robotContainer.getDriverController().getRightXAxis());
|
||||
RobotContainer.m_robotDrive.driveWithInput(m_inputMove, m_inputSteer);
|
||||
public void execute() {
|
||||
m_inputMove = m_driverXbox.getLeftYAxis();
|
||||
m_inputSteer = m_driverXbox.getRightXAxis();
|
||||
m_drive.driveWithInput(m_inputMove, m_inputSteer);
|
||||
}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
protected boolean isFinished() {
|
||||
public void end(boolean interrupted) {
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called once after isFinished returns true
|
||||
@Override
|
||||
protected void end() {
|
||||
}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
@Override
|
||||
protected void interrupted() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,40 +7,41 @@
|
||||
|
||||
package frc4388.robot.commands.Drive;
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import frc4388.robot.RobotContainer;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
|
||||
public class GamerMove extends Command {
|
||||
public GamerMove() {
|
||||
// Use requires() here to declare subsystem dependencies
|
||||
// eg. requires(chassis);
|
||||
import frc4388.robot.subsystems.Drive;
|
||||
|
||||
public class GamerMove extends CommandBase {
|
||||
|
||||
private final Drive m_drive;
|
||||
|
||||
/**
|
||||
* Creates a new GamerMove.
|
||||
*/
|
||||
public GamerMove(Drive subsystem) {
|
||||
m_drive = subsystem;
|
||||
addRequirements(m_drive);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
protected void initialize() {
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
protected void execute() {
|
||||
RobotContainer.m_robotDrive.driveWithInput(0, 1);
|
||||
public void execute() {
|
||||
m_drive.driveWithInput(0, 1);
|
||||
}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
protected boolean isFinished() {
|
||||
public void end(boolean interrupted) {
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called once after isFinished returns true
|
||||
@Override
|
||||
protected void end() {
|
||||
}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
@Override
|
||||
protected void interrupted() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,44 +7,28 @@
|
||||
|
||||
package frc4388.robot.commands.LED;
|
||||
|
||||
import frc4388.robot.RobotContainer;
|
||||
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||
|
||||
import frc4388.robot.constants.LEDPatterns;
|
||||
import frc4388.robot.subsystems.LED;
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
|
||||
public class SetLEDPattern extends Command {
|
||||
// NOTE: Consider using this command inline, rather than writing a subclass. For more
|
||||
// information, see:
|
||||
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
|
||||
public class SetLEDPattern extends InstantCommand {
|
||||
|
||||
private final LED m_led;
|
||||
public static LEDPatterns m_pattern;
|
||||
|
||||
public SetLEDPattern(LEDPatterns pattern) {
|
||||
public SetLEDPattern(LED subsystem, LEDPatterns pattern) {
|
||||
m_led = subsystem;
|
||||
m_pattern = pattern;
|
||||
addRequirements(m_led);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
protected void initialize() {
|
||||
}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
@Override
|
||||
protected void execute() {
|
||||
RobotContainer.m_robotLED.setPattern(m_pattern);
|
||||
}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
@Override
|
||||
protected boolean isFinished() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Called once after isFinished returns true
|
||||
@Override
|
||||
protected void end() {
|
||||
}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
@Override
|
||||
protected void interrupted() {
|
||||
public void initialize() {
|
||||
m_led.setPattern(m_pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,39 +7,41 @@
|
||||
|
||||
package frc4388.robot.commands.LED;
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import frc4388.robot.RobotContainer;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
|
||||
public class UpdateLED extends Command {
|
||||
public UpdateLED() {
|
||||
// Use requires() here to declare subsystem dependencies
|
||||
import frc4388.robot.subsystems.LED;
|
||||
|
||||
public class UpdateLED extends CommandBase {
|
||||
|
||||
private final LED m_LED;
|
||||
|
||||
/**
|
||||
* Creates a new UpdateLED that continually runs updateLED in the LED subsystem.
|
||||
*/
|
||||
public UpdateLED(LED subsystem) {
|
||||
m_LED = subsystem;
|
||||
addRequirements(m_LED);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
protected void initialize() {
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
protected void execute() {
|
||||
RobotContainer.m_robotLED.updateLED();
|
||||
public void execute() {
|
||||
m_LED.updateLED();
|
||||
}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
protected boolean isFinished() {
|
||||
public void end(boolean interrupted) {
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called once after isFinished returns true
|
||||
@Override
|
||||
protected void end() {
|
||||
}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
@Override
|
||||
protected void interrupted() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ package frc4388.robot.subsystems;
|
||||
import com.ctre.phoenix.motorcontrol.InvertType;
|
||||
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
||||
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
import frc4388.robot.Constants.DriveConstants;
|
||||
import frc4388.robot.commands.Drive.DriveWithJoystick;
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public class Drive extends Subsystem {
|
||||
public class Drive extends SubsystemBase {
|
||||
// Put methods for controlling this subsystem
|
||||
// here. Call these from Commands.
|
||||
|
||||
@@ -58,10 +58,10 @@ public class Drive extends Subsystem {
|
||||
m_driveTrain.arcadeDrive(move, steer);
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public void initDefaultCommand(){
|
||||
// Set the default command for a subsystem here.
|
||||
// setDefaultCommand(new MySpecialCommand());
|
||||
setDefaultCommand(new DriveWithJoystick());
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
package frc4388.robot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
import frc4388.robot.Constants.LEDConstants;
|
||||
import frc4388.robot.commands.LED.UpdateLED;
|
||||
import frc4388.robot.constants.LEDPatterns;
|
||||
|
||||
/**
|
||||
* Allows for the control of a 5v LED Strip using a Rev Robotics Blinkin LED Driver
|
||||
* Allows for the control of a 5v LED Strip using a Rev Robotics Blinkin LED
|
||||
* Driver
|
||||
*/
|
||||
public class LED extends Subsystem {
|
||||
public class LED extends SubsystemBase {
|
||||
|
||||
public static float currentLED;
|
||||
public static Spark LEDController;
|
||||
@@ -43,10 +43,10 @@ import frc4388.robot.constants.LEDPatterns;
|
||||
SmartDashboard.putNumber("LED", currentLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public void initDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
// setDefaultCommand(new MySpecialCommand());
|
||||
setDefaultCommand(new UpdateLED());
|
||||
}
|
||||
} */
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package frc4388.utility.controller;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.button.Button;
|
||||
import frc4388.utility.controller.XboxController;
|
||||
|
||||
import edu.wpi.first.wpilibj.buttons.Button;
|
||||
|
||||
/**
|
||||
* Mapping for the Xbox controller triggers to allow triggers to be defined as
|
||||
* buttons in {@link frc4388.robot.OI}. Checks to see if the given trigger
|
||||
|
||||
Reference in New Issue
Block a user