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;
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,
rightEncoder.reset();
}
- public double getLeftLidarDistance() {
- return leftLidar.pidGet();
- }
-
- public double getsRightLidarDistance() {
- return rightLidar.pidGet();
+ public double getLidarDistance() {
+ return lidar.pidGet();
}
public double getRightSpeed() {
/*
* 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)
/*
* @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);
}
/*
* 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) {
}
/*
- * 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;
}
/*
- * 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;
}
/*
- * @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();