Permalink
Browse files

Removed all of the code that didn't have to do specifically with the …

…motors
  • Loading branch information...
Linnea
Linnea committed Nov 20, 2018
1 parent 2c7d6a4 commit 057d25f057e1738392546e85d594501adc3d8dc1
@@ -1,8 +1,6 @@
package org.usfirst.frc.team1700.robot;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;

/**
* This class is the glue that binds the controls on the physical operator
@@ -12,22 +10,4 @@
// JOYSTICKS
public static Joystick leftJoy = new Joystick(0);
public static Joystick rightJoy = new Joystick(1);
public static Joystick coJoy = new Joystick(2);

// BUTTONS
// Christy
public static Button stopIntake = new JoystickButton(coJoy, 10);
public static Button releaseIntakeSlow = new JoystickButton(rightJoy, 5);
public static Button releaseIntakeFast = new JoystickButton(rightJoy, 4);

// Lauren
public static Button letGo = new JoystickButton(coJoy, 1);
public static Button foldUp = new JoystickButton(coJoy, 2);
public static Button foldDown = new JoystickButton(coJoy, 3);
public static Button squeeze = new JoystickButton(coJoy, 4);

public static Button elevatorReset = new JoystickButton(coJoy, 5);
public static Button elevatorSwitch = new JoystickButton(coJoy, 6);
public static Button elevatorScale = new JoystickButton(coJoy, 7);
// public static Button elevatorOverride = new JoystickButton(coJoy, 10);
}
@@ -2,12 +2,7 @@
package org.usfirst.frc.team1700.robot;

import edu.wpi.first.wpilibj.IterativeRobot;

import org.usfirst.frc.team1700.robot.autonmodes.AutonomousBase;

import org.usfirst.frc.team1700.robot.subsystems.DriveSubsystem;
import org.usfirst.frc.team1700.robot.subsystems.ElevatorSubsystem;
import org.usfirst.frc.team1700.robot.subsystems.IntakeSubsystem;

/**
* The VM is configured to automatically run this class, and to call the
@@ -21,19 +16,11 @@
public static OI oi;

public static final DriveSubsystem driveSubsystem = new DriveSubsystem();
public static final ElevatorSubsystem elevatorSubsystem = new ElevatorSubsystem();
public static final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();

public static AutonomousBase auto;

// Control variables
public static double leftIntakeSpeed = 0;
public static double rightIntakeSpeed = 0;
public static Boolean desiredGrabIntakeState = RobotMap.GRAB_INTAKE_CLOSE;
public static Boolean desiredFoldIntakeState = true;

public static double leftSpeed = 0;
public static double rightSpeed = 0;
public static double elevatorSpeed = 0;

// State variables
Boolean hasGameData = false;
@@ -63,25 +50,13 @@ public void disabledPeriodic() {

@Override
public void autonomousInit() {
// Choose auton mode based on starting location
Boolean preferSwitch = true;

auto = new AutonomousBase(AutonomousBase.StartLocation.LEFT, preferSwitch, driveSubsystem, intakeSubsystem, elevatorSubsystem);
}

/**
* This function is called periodically during autonomous
*/
@Override
public void autonomousPeriodic() {
auto.periodic();

// EXECUTE (Autonomous responsible for setting all of these values)
driveSubsystem.driveTank(leftSpeed, rightSpeed);
elevatorSubsystem.elevatorMove(elevatorSpeed);
intakeSubsystem.fold(desiredFoldIntakeState);
intakeSubsystem.grab(desiredGrabIntakeState);
intakeSubsystem.runIntake(leftIntakeSpeed, rightIntakeSpeed);
}

@Override
@@ -97,53 +72,9 @@ public void teleopPeriodic() {
// UPDATE ROBOT STATE
leftSpeed = OI.leftJoy.getRawAxis(1);
rightSpeed = OI.rightJoy.getRawAxis(1);
elevatorSpeed = -OI.coJoy.getRawAxis(1);

if (OI.releaseIntakeFast.get()){
leftIntakeSpeed = -1;
rightIntakeSpeed = -1;
desiredGrabIntakeState = RobotMap.GRAB_INTAKE_OPEN;
}
else if (OI.releaseIntakeSlow.get()){
leftIntakeSpeed = -0.4;
rightIntakeSpeed = -0.4;
desiredGrabIntakeState = RobotMap.GRAB_INTAKE_OPEN;
}
else if (OI.stopIntake.get()){
leftIntakeSpeed = 0;
rightIntakeSpeed = 0;
//no update to desiredGrabIntakeState
}
else {
leftIntakeSpeed = 0.5;
rightIntakeSpeed = 0.3;
if (OI.squeeze.get()){
desiredGrabIntakeState = RobotMap.GRAB_INTAKE_CLOSE;
}
else if (OI.letGo.get()){
desiredGrabIntakeState = RobotMap.GRAB_INTAKE_OPEN;
}
else{
//no update to desiredGrabIntakeState
}
}

if (OI.foldUp.get()){
desiredFoldIntakeState = true;
}
else if (OI.foldDown.get()){
desiredFoldIntakeState = false;
}
else {
// no update to desiredFoldIntakeState
}

// EXECUTE
driveSubsystem.driveTank(leftSpeed, rightSpeed);
elevatorSubsystem.elevatorMove(elevatorSpeed);
intakeSubsystem.fold(desiredFoldIntakeState);
intakeSubsystem.grab(desiredGrabIntakeState);
intakeSubsystem.runIntake(leftIntakeSpeed, rightIntakeSpeed);
}

/**
@@ -3,14 +3,7 @@

import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import com.ctre.phoenix.motorcontrol.can.VictorSPX;
import com.kauailabs.navx.frc.AHRS;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.DigitalOutput;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.SPI;

/**
* The RobotMap is a mapping from the ports sensors and actuators are wired into
@@ -19,44 +12,12 @@
* floating around.
*/
public class RobotMap {
// DRIVE TALONS
// DRIVE TALONS: UPDATE BASED ON WHAT'S ON THE DRIVETRAIN
public static VictorSPX leftFrontDrive = new VictorSPX(3),
rightFrontDrive = new VictorSPX(4);
// public static TalonSRX leftFrontDrive = new TalonSRX(3),
// rightFrontDrive = new TalonSRX(4;)

public static TalonSRX leftBackDrive = new TalonSRX(1),
rightBackDrive = new TalonSRX(2); //6

// OTHER TALONS
public static TalonSRX elevatorMotor = new TalonSRX(7), //7
leftIntakeMotor = new TalonSRX(5),
rightIntakeMotor = new TalonSRX(6);

// PNEUMATICS
public static DoubleSolenoid intakeArmSol = new DoubleSolenoid(0, 1),
carriageSol = new DoubleSolenoid(2, 3);

public static Compressor compressor = new Compressor(0);

// NAVX
public static AHRS ahrs = new AHRS(SPI.Port.kMXP, (byte) 200); /* Alternatives: SPI.Port.kMXP, I2C.Port.kMXP or SerialPort.Port.kUSB */

// DIGITAL SENSORS
public static DigitalInput beamBreak = new DigitalInput(7),
elevatorTopLimitSwitch = new DigitalInput(9),
elevatorBottomLimitSwitch = new DigitalInput(8);

public static Encoder leftDriveEncoder = new Encoder(new DigitalInput(1), new DigitalInput(0)),
rightDriveEncoder = new Encoder(new DigitalInput(5), new DigitalInput(4)),
elevatorEncoder = new Encoder(new DigitalInput(2), new DigitalInput (3));

// DIGITAL OUTPUT
public static DigitalOutput arduinoTrigger = new DigitalOutput(10);

// STATE ENUMS
public static Boolean GRAB_INTAKE_OPEN = true;
public static Boolean GRAB_INTAKE_CLOSE = false;


}
Oops, something went wrong.

0 comments on commit 057d25f

Please sign in to comment.