map

open fun map(@Nullable switchSensor: TouchSensor, position: Int): HoldableActuator

Map a limit switch to a position on the actuator, which will update the current encoder reading to the position of the switch when pressed.

This is different from the bottom switch, and top switches, which are used as software stops for the actuator. This method operates to reduce encoder drift, as if a switch is pressed by the actuator, the position can be mapped. It may be wise to map the top switch here if used, which will increase encoder accuracy. The bottom limit switch does not need to be mapped since it is used to reset the encoder, therefore setting the reading to 0.

Return

this

Parameters

switchSensor

the switch sensor to map

position

the position to map the switch to in encoder ticks of the actuator