Put devices on a different CAN bus
Tell YAGSL which SystemCore, Motioncore or vendor CAN bus each device is on with the canbus field.
The SystemCore has several CAN buses instead of one, so every CAN device in your YAGSL JSON (drive and angle motors, absolute encoders, the gyro) has a canbus field saying which bus it is wired to. YAGSL reads that field the same way for every vendor.
1. Find the bus each device is wired to

canbus value
Bus
"" (or left out)
SystemCore can_s0
"0" to "4"
SystemCore can_s0 to can_s4
"5" to "24"
Motioncore can_d0 to can_d19
Any other text
Passed to the vendor as is, for example a CANivore's name for CTRE
So a device on can_s1 gets "canbus": "1", and the first Motioncore bus, can_d0, is "5". A number outside 0 to 24 stops the robot program at startup with CAN bus <n> does not exist.
2. Set canbus on each device
canbus is a string, so bus numbers are quoted:
Devices in one module don't have to share a bus, and neither do the modules.
3. Check what your vendor accepts
Not every vendor can use a bus name:
Vendor
Accepted canbus values
CTRE (talonfx_*, talonfxs_*, cancoder_can, pigeon2_can)
Empty, a bus number, or a CANivore's name or serial number
REV (sparkmax_*, sparkflex_*, splineencoder_can)
Empty or a bus number only
Thrifty (nova_*)
Empty or a bus number only
Studica (navx3_can)
Empty or a bus number only
Redux (canandgyro_can, canandmag_can)
Empty, a bus number, or a ReduxLib bus string such as socketcan:can_s1
AndyMark (andymarkhexbore_can)
canbus is not used; the device is created from its CAN ID alone. It doesn't work with YAGSL 2027 yet, because the AndyMark library has no 2027_alpha7 build
That includes port names: a SPARK on can_s1 is "1", not "CAN_S1". Giving a REV, Thrifty or Studica device anything other than a bus number stops the robot program at startup with an IllegalArgumentException like:
Encoders with an _attached, _dio or _analog type are not on CAN at all, so their canbus is ignored. An _attached encoder is read through the angle motor controller, on that controller's bus.
4. Verify it
Deploy and check the Driver Station console. A wrong bus doesn't stop the program the way a malformed value does: the device is simply never found, so you get that vendor's usual "device not detected" alerts and a module that doesn't respond. If one module or one vendor's devices are missing, compare its canbus against the bus it is physically wired to before looking anywhere else.
Last updated
Was this helpful?