Package swervelib.parser.json
Class DeviceJson
java.lang.Object
swervelib.parser.json.DeviceJson
Device JSON parsed class. Used to access the JSON data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumVendor of a device (motor controller, encoder, or gyroscope). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAbsoluteEncoder(ReflectionsManager.VendorMotorController angleMotorVendor, yams.motorcontrollers.SmartMotorController angleMotorController, boolean inverted) Get the Absolute Encoder Supplier and Vendor Absolute Encoder Object.static DCMotorgetDCMotor(String motorType) Get the DC motor from the motor type.getGyro(SwerveDriveJson.GyroAxis axis, boolean inverted) Get the gyro angle supplier.Get theReflectionsManager.VendorMotorControllerobject for the device.yams.motorcontrollers.SmartMotorControllergetSmartMotorController(yams.motorcontrollers.SmartMotorControllerConfig config) getVendor(DeviceJson.VENDOR attachedType) Get the vendor of the device.
-
Field Details
-
type
The device type -
id
public int idThe CAN ID or pin ID of the device. -
channel
public int channelSmartIO Channel. -
canbus
The CAN bus name which the device resides on if using CAN.
-
-
Constructor Details
-
DeviceJson
public DeviceJson()
-
-
Method Details
-
getDCMotor
Get the DC motor from the motor type.- Parameters:
motorType- Motor type.- Returns:
DCMotor
-
getGyro
Get the gyro angle supplier. -
getVendor
Get the vendor of the device.- Parameters:
attachedType- Vendor to return when the device is directly attached (not on CAN/DIO/Analog), since the attached vendor cannot be determined from the device type string alone.- Returns:
- Vendor of the device.
-
getMotorController
Get theReflectionsManager.VendorMotorControllerobject for the device.- Returns:
ReflectionsManager.VendorMotorControllerobject for the device.
-
getAbsoluteEncoder
public Pair<Supplier<Angle>,Object> getAbsoluteEncoder(ReflectionsManager.VendorMotorController angleMotorVendor, yams.motorcontrollers.SmartMotorController angleMotorController, boolean inverted) Get the Absolute Encoder Supplier and Vendor Absolute Encoder Object.- Parameters:
angleMotorVendor- Vendor of the angle/steering/azimuth motor controller, used when the absolute encoder is attached to the angle motor controller.angleMotorController- Angle/steering/azimuthSmartMotorController, used when the absolute encoder is attached to the angle motor controller.inverted- Inversion of the absolute encoder.- Returns:
- Pair of
Supplierand Vendor Absolute EncoderObject
-
getSmartMotorController
public yams.motorcontrollers.SmartMotorController getSmartMotorController(yams.motorcontrollers.SmartMotorControllerConfig config) - Parameters:
config-SmartMotorControllerConfigto apply when creatingSmartMotorController.- Returns:
SmartMotorController
-