mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Added warnings for NavX over serial
This commit is contained in:
@@ -27,6 +27,7 @@ import swervelib.motors.SwerveMotor;
|
||||
import swervelib.motors.TalonFXSwerve;
|
||||
import swervelib.motors.TalonSRXSwerve;
|
||||
import swervelib.telemetry.Alert;
|
||||
import swervelib.telemetry.Alert.AlertType;
|
||||
|
||||
/**
|
||||
* Device JSON parsed class. Used to access the JSON data.
|
||||
@@ -37,15 +38,21 @@ public class DeviceJson
|
||||
/**
|
||||
* An {@link Alert} for if the CAN ID is greater than 40.
|
||||
*/
|
||||
private final Alert canIdWarning = new Alert("JSON",
|
||||
"CAN IDs greater than 40 can cause undefined behaviour, please use a CAN ID below 40!",
|
||||
Alert.AlertType.WARNING);
|
||||
private final Alert canIdWarning = new Alert("JSON",
|
||||
"CAN IDs greater than 40 can cause undefined behaviour, please use a CAN ID below 40!",
|
||||
Alert.AlertType.WARNING);
|
||||
/**
|
||||
* An {@link Alert} for if there is an I2C lockup issue on the roboRIO.
|
||||
*/
|
||||
private final Alert i2cLockupWarning = new Alert("IMU",
|
||||
"I2C lockup issue detected on roboRIO. Check console for more information.",
|
||||
Alert.AlertType.WARNING);
|
||||
private final Alert i2cLockupWarning = new Alert("IMU",
|
||||
"I2C lockup issue detected on roboRIO. Check console for more information.",
|
||||
Alert.AlertType.WARNING);
|
||||
/**
|
||||
* NavX serial comm issue.
|
||||
*/
|
||||
private final Alert serialCommsIssueWarning = new Alert("IMU",
|
||||
"Serial comms is interrupted with USB and other serial traffic and causes intermittent connected/disconnection issues. Please consider another protocol or be mindful of this.",
|
||||
AlertType.WARNING);
|
||||
/**
|
||||
* The device type, e.g. pigeon/pigeon2/sparkmax/talonfx/navx
|
||||
*/
|
||||
@@ -57,7 +64,7 @@ public class DeviceJson
|
||||
/**
|
||||
* The CAN bus name which the device resides on if using CAN.
|
||||
*/
|
||||
public String canbus = "";
|
||||
public String canbus = "";
|
||||
|
||||
/**
|
||||
* Create a {@link SwerveAbsoluteEncoder} from the current configuration.
|
||||
@@ -124,7 +131,6 @@ public class DeviceJson
|
||||
case "analog":
|
||||
return new AnalogGyroSwerve(id);
|
||||
case "navx":
|
||||
case "navx_mxp_spi":
|
||||
case "navx_spi":
|
||||
return new NavXSwerve(SPI.Port.kMXP);
|
||||
case "navx_i2c":
|
||||
@@ -136,8 +142,12 @@ public class DeviceJson
|
||||
i2cLockupWarning.set(true);
|
||||
return new NavXSwerve(I2C.Port.kMXP);
|
||||
case "navx_usb":
|
||||
DriverStation.reportWarning("WARNING: There is issues when using USB camera's and the NavX like this!\n" +
|
||||
"https://pdocs.kauailabs.com/navx-mxp/guidance/selecting-an-interface/", false);
|
||||
serialCommsIssueWarning.set(true);
|
||||
return new NavXSwerve(Port.kUSB);
|
||||
case "navx_mxp_serial":
|
||||
serialCommsIssueWarning.set(true);
|
||||
return new NavXSwerve(Port.kMXP);
|
||||
case "pigeon":
|
||||
return new PigeonSwerve(id);
|
||||
|
||||
Reference in New Issue
Block a user