Implement new RobotContainer.java and Constants.java Classes

- OI.java has been deprecated and replaced with RobotContainer.java
- RobotMap.java has been deprecated and replaced with Constants.java
- Changes have been made to use the new classes without errors; some of these changes will be changed in the future
This commit is contained in:
Keenan D. Buckley
2020-01-05 17:35:52 -07:00
parent ec2412a31e
commit 6fb373969d
13 changed files with 134 additions and 112 deletions
@@ -8,8 +8,8 @@
package frc4388.robot.commands.Drive;
import edu.wpi.first.wpilibj.command.Command;
import frc4388.robot.OI;
import frc4388.robot.Robot;
import frc4388.robot.RobotContainer;
public class DriveWithJoystick extends Command {
@@ -18,7 +18,6 @@ public class DriveWithJoystick extends Command {
public DriveWithJoystick() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.m_Drive);
}
// Called just before this Command runs the first time
@@ -29,9 +28,9 @@ public class DriveWithJoystick extends Command {
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
m_inputMove = OI.getInstance().getDriverController().getLeftYAxis();
m_inputSteer = -(OI.getInstance().getDriverController().getRightXAxis());
Robot.m_Drive.driveWithInput(m_inputMove, m_inputSteer);
m_inputMove = Robot.m_robotContainer.getDriverController().getLeftYAxis();
m_inputSteer = -(Robot.m_robotContainer.getDriverController().getRightXAxis());
RobotContainer.m_robotDrive.driveWithInput(m_inputMove, m_inputSteer);
}
// Make this return true when this Command no longer needs to run execute()
@@ -8,13 +8,12 @@
package frc4388.robot.commands.Drive;
import edu.wpi.first.wpilibj.command.Command;
import frc4388.robot.Robot;
import frc4388.robot.RobotContainer;
public class GamerMove extends Command {
public GamerMove() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.m_Drive);
}
// Called just before this Command runs the first time
@@ -25,7 +24,7 @@ public class GamerMove extends Command {
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.m_Drive.driveWithInput(0, 1);
RobotContainer.m_robotDrive.driveWithInput(0, 1);
}
// Make this return true when this Command no longer needs to run execute()
@@ -1,48 +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.commands;
import edu.wpi.first.wpilibj.command.Command;
import frc4388.robot.Robot;
/**
* An example command. You can replace me with your own command.
*/
public class ExampleCommand extends Command {
public ExampleCommand() {
// Use requires() here to declare subsystem dependencies
requires(Robot.m_subsystem);
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected 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() {
}
}
@@ -7,7 +7,7 @@
package frc4388.robot.commands.LED;
import frc4388.robot.Robot;
import frc4388.robot.RobotContainer;
import frc4388.robot.constants.LEDPatterns;
import edu.wpi.first.wpilibj.command.Command;
@@ -17,7 +17,6 @@ public class SetLEDPattern extends Command {
public static LEDPatterns m_pattern;
public SetLEDPattern(LEDPatterns pattern) {
requires(Robot.m_led);
m_pattern = pattern;
}
@@ -29,7 +28,7 @@ public class SetLEDPattern extends Command {
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.m_led.setPattern(m_pattern);
RobotContainer.m_robotLED.setPattern(m_pattern);
}
// Make this return true when this Command no longer needs to run execute()
@@ -8,12 +8,11 @@
package frc4388.robot.commands.LED;
import edu.wpi.first.wpilibj.command.Command;
import frc4388.robot.Robot;
import frc4388.robot.RobotContainer;
public class UpdateLED extends Command {
public UpdateLED() {
// Use requires() here to declare subsystem dependencies
requires(Robot.m_led);
}
// Called just before this Command runs the first time
@@ -24,7 +23,7 @@ public class UpdateLED extends Command {
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.m_led.updateLED();
RobotContainer.m_robotLED.updateLED();
}
// Make this return true when this Command no longer needs to run execute()