Actuator Limits#
CTR Electronics actuators, such as the TalonFX, support various kinds of hardware and software limits.
Documentation on wiring limit switches can be found here.
Retrieving Limit Switch State#
The state of the forward or reverse limit switch can be retrieved from the API via getForwardLimit()
and getReverseLimit()
.
var forwardLimit = m_motor.getForwardLimit();
if (forwardLimit.getValue() == ForwardLimitValue.ClosedToGround) {
// do action when forward limit is closed
}
auto& forwardLimit = m_motor.GetForwardLimit();
if (forwardLimit.GetValue() == signals::ForwardLimitValue::ClosedToGround) {
// do action when forward limit is closed
}