Similar to this post (Spark Limit Switches) from back in 2017, I’m curious if anything has changed now that many (probably most) teams are using CAN-controlled speed controllers.
It seems like it should be fairly simple for a TalonSRX / TalonFX / SparkMax to provide programmers a flag to be able to tell if a limit switch attached directly to their breakout has been tripped, however, I have not been able to find any information about if this is possible in their user docs.
There are many cases where this would be useful, IE, not only prevent a mechanism from overrunning its bounds, but also 0 the encoder if the bound is reached.
Something like _talon.getForwardLimitSwitch() as a boolean seems like it would make total sense to have.
My thought was to just try to have a command triggered when the limit switch was hit that reset the encoder value. Or have something in periodic watch the value of the limit switch.
The CANDigitalInput class and the optional factory functions for it have existed since the library’s creation for the 2019 season. v1.5.4 deprecates the CANDigitalInput constructor.
Does any of that invalidate my answer? I didn’t test anything, just posted my findings from the API Docs.
I don’t know what existed when, I simply assumed based on the prior thread and context from the OP’s initial post that something must have not-existed at some point.