package org.usfirst.frc.team3501.robot;
+import edu.wpi.first.wpilibj.SPI;
+
/**
* The Constants stores constant values for all subsystems. This includes the
* port values for motors and sensors, as well as important operational
public static final int ENCODER_LEFT_B = 0;
public static final int ENCODER_RIGHT_A = 2;
public static final int ENCODER_RIGHT_B = 3;
+
+ public static final SPI.Port GYRO_PORT = SPI.Port.kOnboardCS0;
}
public static class Climber {
import org.usfirst.frc.team3501.robot.Constants;
import org.usfirst.frc.team3501.robot.commands.driving.JoystickDrive;
-import org.usfirst.frc.team3501.robot.utils.BNO055;
import com.ctre.CANTalon;
+import edu.wpi.first.wpilibj.ADXRS450_Gyro;
import edu.wpi.first.wpilibj.Encoder;
-import edu.wpi.first.wpilibj.I2C.Port;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.command.Subsystem;
private final RobotDrive robotDrive;
private final Encoder leftEncoder, rightEncoder;
- private BNO055 imu;
+ private ADXRS450_Gyro imu;
private DriveTrain() {
// MOTOR CONTROLLERS
// ROBOT DRIVE
robotDrive = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);
- this.imu = BNO055.getInstance(BNO055.opmode_t.OPERATION_MODE_IMUPLUS,
- BNO055.vector_type_t.VECTOR_EULER, Port.kOnboard, (byte) 0x28);
- gyroZero = imu.getHeading();
+ this.imu = new ADXRS450_Gyro(Constants.DriveTrain.GYRO_PORT);
}
public static DriveTrain getDriveTrain() {
// ------Gyro------//
public double getAngle() {
- if (!this.imu.isInitialized())
- return -1;
- return this.imu.getHeading() - this.gyroZero;
+ return this.imu.getAngle() - this.gyroZero;
}
public void resetGyro() {
this.gyroZero = this.getAngle();
-
}
public double getZeroAngle() {