From: daniel watson Date: Mon, 26 Oct 2015 20:18:50 +0000 (-0700) Subject: move instantiation of physical components to map X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F3501-spark-go;a=commitdiff_plain;h=56625a790e6475991c814df37bf70e9e640e6714 move instantiation of physical components to map --- diff --git a/src/org/usfirst/frc/team3501/robot/RobotMap.java b/src/org/usfirst/frc/team3501/robot/RobotMap.java index 37dad27..f3528cb 100644 --- a/src/org/usfirst/frc/team3501/robot/RobotMap.java +++ b/src/org/usfirst/frc/team3501/robot/RobotMap.java @@ -1,6 +1,8 @@ package org.usfirst.frc.team3501.robot; +import edu.wpi.first.wpilibj.CANJaguar; import edu.wpi.first.wpilibj.DoubleSolenoid.Value; +import edu.wpi.first.wpilibj.SpeedController; public class RobotMap { @@ -11,8 +13,9 @@ public class RobotMap { MIN_ARM_JOYSTICK_INPUT = 0.1; // drivetrain - public static final int FRONT_LEFT_ADDRESS = 4, FRONT_RIGHT_ADDRESS = 5, - REAR_LEFT_ADDRESS = 3, REAR_RIGHT_ADDRESS = 6; + public static final SpeedController + frontLeft = new CANJaguar(4), frontRight = new CANJaguar(5), + rearLeft = new CANJaguar(3), rearRight = new CANJaguar(6); public static final double MAX_DRIVE_SPEED = 0.7; diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Drivetrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/Drivetrain.java index 1267f2c..de1efe6 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Drivetrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Drivetrain.java @@ -3,23 +3,18 @@ package org.usfirst.frc.team3501.robot.subsystems; import org.usfirst.frc.team3501.robot.RobotMap; import org.usfirst.frc.team3501.robot.commands.DriveWithJoysticks; -import edu.wpi.first.wpilibj.CANJaguar; import edu.wpi.first.wpilibj.RobotDrive; import edu.wpi.first.wpilibj.command.Subsystem; public class Drivetrain extends Subsystem { - private RobotDrive robotDrive; + private final RobotDrive robotDrive; public Drivetrain() { - CANJaguar frontLeft = new CANJaguar(RobotMap.FRONT_LEFT_ADDRESS); - CANJaguar frontRight = new CANJaguar(RobotMap.FRONT_RIGHT_ADDRESS); - CANJaguar rearLeft = new CANJaguar(RobotMap.REAR_LEFT_ADDRESS); - CANJaguar rearRight = new CANJaguar(RobotMap.REAR_RIGHT_ADDRESS); robotDrive = new RobotDrive( - frontLeft, rearLeft, - frontRight, rearRight); + RobotMap.frontLeft, RobotMap.rearLeft, + RobotMap.frontRight, RobotMap.rearRight); } public void drive(double forward, double twist) {