Skip to content

Commit

Permalink
Added subsystem constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
briansemrau committed Feb 10, 2018
1 parent 03465d6 commit 9dbab13
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 56 deletions.
23 changes: 17 additions & 6 deletions src/org/usfirst/frc/team4737/robot/RobotMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,23 @@
* floating around.
*/
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 leftDriveMaster = 1;
public static int leftDriveSlave = 2;
public static int rightDriveMaster = 3;
public static int rightDriveSlave = 4;

// Drivetrain

public static int DRIVE_LEFT_MASTER = 11;
public static int DRIVE_LEFT_SLAVE = 12;
public static int DRIVE_RIGHT_MASTER = 13;
public static int DRIVE_RIGHT_SLAVE = 14;

// Intake

public static final int INTAKE_LEFT = 15;
public static final int INTAKE_RIGHT = 16;

// Elevator

public static final int ELEVATOR_MOTOR_A = 17;
public static final int ELEVATOR_MOTOR_B = 18;

// If you are using multiple modules, make sure to define both the port
// number and the module. For example you with a rangefinder:
Expand Down
4 changes: 2 additions & 2 deletions src/org/usfirst/frc/team4737/robot/subsystems/Climber.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public class Climber extends Subsystem {
public Climber() {
// TODO when we know how the climber works #BlameMechanical
}

public void initDefaultCommand() {
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}

}
51 changes: 26 additions & 25 deletions src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,39 @@
*/
public class Drivetrain extends Subsystem {

// Put methods for controlling this subsystem
// here. Call these from Commands.
// Put methods for controlling this subsystem
// here. Call these from Commands.
private WPI_TalonSRX leftFrontMaster;
private WPI_TalonSRX rightFrontMaster;
private WPI_TalonSRX leftBackSlave;
private WPI_TalonSRX rightBackSlave;

public Drivetrain() {
leftFrontMaster = new WPI_TalonSRX(RobotMap.leftDriveMaster);
leftBackSlave = new WPI_TalonSRX(RobotMap.leftDriveSlave);
rightFrontMaster = new WPI_TalonSRX(RobotMap.rightDriveMaster);
rightBackSlave = new WPI_TalonSRX(RobotMap.rightDriveSlave);
leftFrontMaster = new WPI_TalonSRX(RobotMap.DRIVE_LEFT_MASTER);
leftBackSlave = new WPI_TalonSRX(RobotMap.DRIVE_LEFT_SLAVE);
rightFrontMaster = new WPI_TalonSRX(RobotMap.DRIVE_RIGHT_MASTER);
rightBackSlave = new WPI_TalonSRX(RobotMap.DRIVE_RIGHT_SLAVE);

leftBackSlave.follow(leftFrontMaster);
rightBackSlave.follow(rightFrontMaster);
}

public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
}

/**
* Controls the drivetrain using two tank-drive joystick inputs
*
* @param leftInput - Left joystick input from -1.0 to 1.0
* @param rightInput - Right joystick input from -1.0 to 1.0
*/
public void tankDrive(double leftInput, double rightInput) {
leftFrontMaster.set(leftInput);
rightFrontMaster.set(rightInput);
}

}
public void initDefaultCommand() {
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}

/**
* Controls the drivetrain using two tank-drive joystick inputs
*
* @param leftInput
* - Left joystick input from -1.0 to 1.0
* @param rightInput
* - Right joystick input from -1.0 to 1.0
*/
public void tankDrive(double leftInput, double rightInput) {
leftFrontMaster.set(leftInput);
rightFrontMaster.set(rightInput);
}

}
26 changes: 16 additions & 10 deletions src/org/usfirst/frc/team4737/robot/subsystems/Elevator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.usfirst.frc.team4737.robot.subsystems;

import org.usfirst.frc.team4737.robot.RobotMap;

import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;

import edu.wpi.first.wpilibj.command.Subsystem;
Expand All @@ -9,15 +11,19 @@
*/
public class Elevator extends Subsystem {

// Put methods for controlling this subsystem
// here. Call these from Commands.

private WPI_TalonSRX elevatorMotor;
private WPI_TalonSRX elevatorSpool;
// Put methods for controlling this subsystem
// here. Call these from Commands.

public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
}
}
private WPI_TalonSRX motorA;
private WPI_TalonSRX motorB;

public Elevator() {
motorA = new WPI_TalonSRX(RobotMap.ELEVATOR_MOTOR_A);
motorB = new WPI_TalonSRX(RobotMap.ELEVATOR_MOTOR_B);
}

public void initDefaultCommand() {
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}
}
30 changes: 17 additions & 13 deletions src/org/usfirst/frc/team4737/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.usfirst.frc.team4737.robot.subsystems;

import org.usfirst.frc.team4737.robot.RobotMap;

import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;

import edu.wpi.first.wpilibj.command.Subsystem;
Expand All @@ -9,17 +11,19 @@
*/
public class Intake extends Subsystem {

// Put methods for controlling this subsystem
// here. Call these from Commands.

private WPI_TalonSRX clawLeft;
private WPI_TalonSRX clawRight;



public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
}
}
// Put methods for controlling this subsystem
// here. Call these from Commands.

private WPI_TalonSRX leftMotor;
private WPI_TalonSRX rightMotor;

public Intake() {
leftMotor = new WPI_TalonSRX(RobotMap.INTAKE_LEFT);
rightMotor = new WPI_TalonSRX(RobotMap.INTAKE_RIGHT);
}

public void initDefaultCommand() {
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}
}

0 comments on commit 9dbab13

Please sign in to comment.