Analog inputs can be used to measure voltages between 0 and 3.3V.
ODrive uses a 12 bit ADC (4096 steps) and so has a maximum resolution of 0.8 mV, look for analog input in the pinout (Pro, S1) to see which Gxx pins support analog inputs.
This Gxx pin (numbered X) be configured be setting
GpioMode.ANALOG_IN before it can be used as an analog input.
Once configured, the voltage on Gxx can be read using
Analog inputs can also be used to feed any of the numerical properties that are visible in
odrivetool or the Web GUI .
This is done by configuring the endpoint mapping for the analog Gxx pin in question:
Additionally, the scale of this voltage input can be mapped linearly from
[0, 3.3] -> [<...mapping>.min, <...mapping>.max].
<controller>.input_pos can be fed by the analog voltage input by setting
This mapping can be disabled by setting
<odrv>.config.gpio(X)_analog_mapping to None.
Changes to the endpoint mapping will be ignored after a reboot unless you run