From 1884c3cf667ee1356e8ca8833f1ff28f39b85b1b Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 20 Jan 2016 20:40:12 -0800 Subject: [PATCH] Add descriptive comments to the Drivetrain --- .../frc/team3501/robot/subsystems/DriveTrain.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java index d344ee9b..fd8f6122 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java @@ -8,10 +8,12 @@ import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.command.Subsystem; public class DriveTrain extends Subsystem { + // Drivetrain related objects + private Encoder leftEncoder, rightEncoder; private CANTalon frontLeft, frontRight, rearLeft, rearRight; - // operational constants - // TODO: More descriptive comments - // inches/pulse + + // Drivetrain specific constants that relate to the inches per pulse value for + // the encoders private final static double WHEEL_DIAMETER = 6.0; // in inches private final static double PULSES_PER_ROTATION = 256; private final static double OUTPUT_SPROCKET_DIAMETER = 2.0; @@ -20,15 +22,13 @@ public class DriveTrain extends Subsystem { public final static double INCHES_PER_PULSE = (((Math.PI) * OUTPUT_SPROCKET_DIAMETER / PULSES_PER_ROTATION) / WHEEL_SPROCKET_DIAMETER) * WHEEL_DIAMETER; - private Encoder leftEncoder, rightEncoder; public DriveTrain() { frontLeft = new CANTalon(Constants.DriveTrain.FRONT_LEFT); frontRight = new CANTalon(Constants.DriveTrain.FRONT_RIGHT); rearLeft = new CANTalon(Constants.DriveTrain.REAR_LEFT); rearRight = new CANTalon(Constants.DriveTrain.REAR_RIGHT); - // TODO: Same thing add newlines between different groups of declarations - // and add comments + leftEncoder = new Encoder(Constants.DriveTrain.ENCODER_LEFT_A, Constants.DriveTrain.ENCODER_LEFT_B, false, EncodingType.k4X); rightEncoder = new Encoder(Constants.DriveTrain.ENCODER_RIGHT_A, @@ -78,11 +78,12 @@ public class DriveTrain extends Subsystem { } public void setMotorSpeeds(double leftSpeed, double rightSpeed) { + // speed passed to right motor is negative because right motor rotates in + // opposite direction this.frontLeft.set(leftSpeed); this.frontRight.set(-rightSpeed); this.rearLeft.set(leftSpeed); this.rearRight.set(-rightSpeed); - // TODO: add comment here to explain - in speed } } -- 2.30.2