mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-09 00:38:01 -06:00
Create the RobotGyro Object
Will allow for easily interchangable use of a pigeon or a navX. Just swap which gyro you pass RobotGyro. More advanced functionality like RemoteSensors with the pigeon and collision detection with the navX will have to be done by getting the gyro from RobotGyro and then using it.
This commit is contained in:
@@ -22,7 +22,9 @@ public final class Constants {
|
||||
public static final int DRIVE_LEFT_FRONT_CAN_ID = 2;
|
||||
public static final int DRIVE_RIGHT_FRONT_CAN_ID = 4;
|
||||
public static final int DRIVE_LEFT_BACK_CAN_ID = 3;
|
||||
public static final int DRIVE_RIGHT_BACK_CAN_ID = 5;
|
||||
public static final int DRIVE_RIGHT_BACK_CAN_ID = 5;
|
||||
|
||||
public static final int DRIVE_PIGEON_ID = 6;
|
||||
}
|
||||
|
||||
public static final class LEDConstants {
|
||||
|
||||
@@ -10,11 +10,15 @@ package frc4388.robot.subsystems;
|
||||
import com.ctre.phoenix.motorcontrol.InvertType;
|
||||
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
||||
import com.ctre.phoenix.sensors.PigeonIMU;
|
||||
import com.kauailabs.navx.frc.AHRS;
|
||||
|
||||
import edu.wpi.first.wpilibj.GyroBase;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
import frc4388.robot.Constants.DriveConstants;
|
||||
import frc4388.utility.RobotGyro;
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
@@ -28,8 +32,7 @@ public class Drive extends SubsystemBase {
|
||||
public WPI_TalonSRX m_leftBackMotor = new WPI_TalonSRX(DriveConstants.DRIVE_LEFT_BACK_CAN_ID);
|
||||
public WPI_TalonSRX m_rightBackMotor = new WPI_TalonSRX(DriveConstants.DRIVE_RIGHT_BACK_CAN_ID);
|
||||
public DifferentialDrive m_driveTrain = new DifferentialDrive(m_leftFrontMotor, m_rightFrontMotor);
|
||||
|
||||
|
||||
public RobotGyro m_gyro = new RobotGyro(new PigeonIMU(DriveConstants.DRIVE_PIGEON_ID));
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
|
||||
Reference in New Issue
Block a user