From: Lauren Meier Date: Thu, 18 Feb 2016 20:44:37 +0000 (-0800) Subject: remove extra lidar and rename remainig lidar to 'lidar' X-Git-Url: http://challenge-bot.com/repos/?p=3501%2Fstronghold-2016;a=commitdiff_plain;h=7e360ef5fdf5bb9ae932367bbeb5a930f54ee732 remove extra lidar and rename remainig lidar to 'lidar' --- diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java index a4bba48b..96f1d115 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java @@ -22,8 +22,7 @@ public class DriveTrain extends PIDSubsystem { private Encoder leftEncoder, rightEncoder; - public static Lidar leftLidar; - public static Lidar rightLidar; + public static Lidar lidar; private CANTalon frontLeft, frontRight, rearLeft, rearRight; private RobotDrive robotDrive; @@ -45,9 +44,8 @@ public class DriveTrain extends PIDSubsystem { robotDrive = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight); - leftLidar = new Lidar(I2C.Port.kOnboard); - rightLidar = new Lidar(I2C.Port.kOnboard); // TODO: find port for second - // lidar + lidar = new Lidar(I2C.Port.kOnboard); + leftEncoder = new Encoder(Constants.DriveTrain.ENCODER_LEFT_A, Constants.DriveTrain.ENCODER_LEFT_B, false, EncodingType.k4X); rightEncoder = new Encoder(Constants.DriveTrain.ENCODER_RIGHT_A, @@ -106,12 +104,8 @@ public class DriveTrain extends PIDSubsystem { rightEncoder.reset(); } - public double getLeftLidarDistance() { - return leftLidar.pidGet(); - } - - public double getsRightLidarDistance() { - return rightLidar.pidGet(); + public double getLidarDistance() { + return lidar.pidGet(); } public double getRightSpeed() { @@ -235,9 +229,8 @@ public class DriveTrain extends PIDSubsystem { /* * Checks the drive mode * - * @return the current state of the robot in each state - * Average distance from both sides of tank drive for Encoder Mode - * Angle from the gyro in GYRO_MODE + * @return the current state of the robot in each state Average distance from + * both sides of tank drive for Encoder Mode Angle from the gyro in GYRO_MODE */ private double sensorFeedback() { if (DRIVE_MODE == Constants.DriveTrain.ENCODER_MODE) @@ -252,16 +245,14 @@ public class DriveTrain extends PIDSubsystem { /* * @param left and right setpoints to set to the left and right side of tank * inverted is for Logan, wants the robot to invert all controls left = right - * and right = left - * negative input is required for the regular rotation because RobotDrive - * tankdrive method drives inverted + * and right = left negative input is required for the regular rotation + * because RobotDrive tankdrive method drives inverted */ public void drive(double left, double right) { robotDrive.tankDrive(-left, -right); // dunno why but inverted drive (- values is forward) if (!Constants.DriveTrain.inverted) - robotDrive.tankDrive(-left, - -right); + robotDrive.tankDrive(-left, -right); else robotDrive.tankDrive(right, left); } @@ -269,9 +260,9 @@ public class DriveTrain extends PIDSubsystem { /* * constrains the distance to within -100 and 100 since we aren't going to * drive more than 100 inches - * + * * Configure Encoder PID - * + * * Sets the setpoint to the PID subsystem */ public void driveDistance(double dist, double maxTimeOut) { @@ -281,9 +272,8 @@ public class DriveTrain extends PIDSubsystem { } /* - * Sets the encoder mode - * Updates the PID constants sets the tolerance and sets output/input ranges - * Enables the PID controllers + * Sets the encoder mode Updates the PID constants sets the tolerance and sets + * output/input ranges Enables the PID controllers */ public void setEncoderPID() { DRIVE_MODE = Constants.DriveTrain.ENCODER_MODE; @@ -295,9 +285,8 @@ public class DriveTrain extends PIDSubsystem { } /* - * Sets the Gyro Mode - * Updates the PID constants, sets the tolerance and sets output/input ranges - * Enables the PID controllers + * Sets the Gyro Mode Updates the PID constants, sets the tolerance and sets + * output/input ranges Enables the PID controllers */ private void setGyroPID() { DRIVE_MODE = Constants.DriveTrain.GYRO_MODE; @@ -335,16 +324,16 @@ public class DriveTrain extends PIDSubsystem { } /* - * @return a value that is the current setpoint for the piston - * kReverse or kForward + * @return a value that is the current setpoint for the piston kReverse or + * kForward */ public Value getLeftGearPistonValue() { return leftGearPiston.get(); } /* - * @return a value that is the current setpoint for the piston - * kReverse or kForward + * @return a value that is the current setpoint for the piston kReverse or + * kForward */ public Value getRightGearPistonValue() { return rightGearPiston.get();