Added more

This commit is contained in:
thenetworkgrinch
2023-02-22 23:10:57 -06:00
parent dd7d432e90
commit cd7751ef71
2 changed files with 11 additions and 3 deletions

View File

@@ -22,15 +22,17 @@ public class NavXSwerve extends SwerveIMU
/**
* Constructor for the NavX swerve.
*
* @param port Serial Port to connect to.
*/
public NavXSwerve()
public NavXSwerve(SerialPort.Port port)
{
try
{
/* Communicate w/navX-MXP via the MXP SPI Bus. */
/* Alternatively: I2C.Port.kMXP, SerialPort.Port.kMXP or SerialPort.Port.kUSB */
/* See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface/ for details. */
gyro = new AHRS(SerialPort.Port.kMXP);
gyro = new AHRS(port);
SmartDashboard.putData(gyro);
} catch (RuntimeException ex)
{

View File

@@ -1,5 +1,6 @@
package swervelib.parser.json;
import edu.wpi.first.wpilibj.SerialPort.Port;
import swervelib.encoders.AnalogAbsoluteEncoderSwerve;
import swervelib.encoders.CANCoderSwerve;
import swervelib.encoders.SparkMaxEncoderSwerve;
@@ -78,8 +79,13 @@ public class DeviceJson
return new ADXRS450Swerve();
case "analog":
return new AnalogGyroSwerve(id);
case "navx_onborard":
return new NavXSwerve(Port.kOnboard);
case "navx_usb":
return new NavXSwerve(Port.kUSB);
case "navx_mxp":
case "navx":
return new NavXSwerve();
return new NavXSwerve(Port.kMXP);
case "pigeon":
return new PigeonSwerve(id);
case "pigeon2":