Repository navigation
Use the same canbus values for every vendor - #59
Merged
Merged
Conversation
The canbus of a device is now read the same way for CTRE, REV, Thrifty Bot and Redux devices: empty for the Systemcore CAN bus can_s0, or the bus number, such as "1" for can_s1 (5 to 24 are the Motioncore CAN buses, following WPILib's CANPort). Anything else is passed to the vendor, such as a CANivore's name for CTRE devices; REV and Thrifty Bot devices reject it with an error that explains the bus numbers. CTRE devices with an empty canbus are now on can_s0 like every other vendor, instead of Phoenix 6's Systemcore default can_s2. Redux devices take bus numbers instead of ReduxLib bus strings, which still work.
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every vendor now reads a device's
canbusthe same way, so the JSON configuration no longer depends on which vendor a device comes from.canbus""(or missing)can_s0(bus 0)"0"to"4"can_s0tocan_s4, so"1"iscan_s1"5"to"24"can_d0tocan_d19, following WPILib'sCANPortswervelib.core.parser.CANBusesdoes the conversion, and each vendor turns the result into its own bus type: Phoenix 6CANBus(CANPort), REVCANPort, ThriftyLib's bus number (CANPort.value), and ReduxLib'sCanandgyro/Canandmag(int, CANPort)constructors."25") also give a clear error.Behavior changes
canbusare now oncan_s0, like every other vendor. Before, Phoenix 6 put them on its Systemcore default,can_s2. Configurations whose CTRE devices are oncan_s2need"canbus": "2"."socketcan:can_s1"still work, since they are passed through."CAN_S1"; use"1".The test schemas'
canbusdescriptions and theDeviceJson.canbusdocs describe the new values. The config generator's schema may need the same update.Not meant to be released yet.
Test plan
CANBusesTest(17 tests): empty and missingcanbus, bus numbers 0 to 24, unknown bus numbers, vendor specific names, and the REV/Thrifty error.verifyVendordepJsonspasses.