Package swervelib.parser.json
Class DeviceJson
java.lang.Object
swervelib.parser.json.DeviceJson
Device JSON parsed class. Used to access the JSON data.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateEncoder(SwerveMotor motor) Create aSwerveAbsoluteEncoderfrom the current configuration.Create aSwerveIMUfrom the given configuration.createMotor(boolean isDriveMotor) Create aSwerveMotorfrom the given configuration.
-
Field Details
-
type
The device type, e.g. pigeon/pigeon2/sparkmax/talonfx/navx -
id
public int idThe CAN ID or pin ID of the device. -
canbus
The CAN bus name which the device resides on if using CAN.
-
-
Constructor Details
-
DeviceJson
public DeviceJson()
-
-
Method Details
-
createEncoder
Create aSwerveAbsoluteEncoderfrom the current configuration.- Parameters:
motor-SwerveMotorof which attached encoders will be created from, only used when the type is "attached" or "canandencoder".- Returns:
SwerveAbsoluteEncodergiven.
-
createIMU
Create aSwerveIMUfrom the given configuration.- Returns:
SwerveIMUgiven.
-
createMotor
Create aSwerveMotorfrom the given configuration.- Parameters:
isDriveMotor- If the motor being generated is a drive motor.- Returns:
SwerveMotorgiven.
-