Disabling a Subsystem

We are often changing the wiring and which subsystems are present and wired up.

What is the best way to disable a subsystem so that it doesn’t clog up the DS log and consume resources?

What is the best way to automatically detect a subsystem is not there and automatically disable it?

Surround your motor controller initialization in a try catch clause. Then where you initialize the class check if the try catch clause passed or not then you can do instance.disable();

Our experience is that the console SPAM is only an issue for CAN devices, and I have not seen a constructor throw an exception on a missing device (and will argue that they should not).

Our approach for the last 4 years or so has been to scan the CAN bus, not instantiate the corresponding software object if the device is not on the bus, and make sure we then check for null software objects before using them in the subsystem.

If we know that the code is running on a competition robot, we always instantiate the objects. We want the console SPAM then. We put a jumper on one of the DIOs for non competition roboRIOs so we can tell which is which.

Our 2018 code shows this, the device ID’s changed in 2019, and we haven’t starting checking for 2020 compatibility. I should have more to share tomorrow.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.