Speed Control using Analog Input without Encoder

Hello, I’m trying to control a motor in the odrive (v0.5.1) with a potentiometer, but I cannot make it work when asking it to enter in Closed Loop.
The controller.input_vel is working accordingly, changing the value from -100 to +100 as I rotate the potentiometer, but entering Closed Loop gives the INVALID_STATE error.
With Sensorless Control at least I can control it, but when controller.input_vel gets close to 0 the motor sometimes (not always) ramps up and draws a lot of current.

The sad part is that it worked in the prior months, but when I rolled up a backup I couldn’t enter Closed Loop again. I think it was a mix of leftover encoder tests that made it possible to enter in Closed Loop by chance, and when I restored prior settings the setting encoder.pre_calibrated changed from True to False.

Hi! Sensorless control doesn’t support low speeds or crossing zero speed, so I’d definitely recommend against that – much easier to just get the encoder working again. If you do need to change the rotation direction, you need to put the ODrive in idle, flip the sign of axis0.config.sensorless_ramp.vel, then re-enter closed loop.

What encoder are you using? If you’re getting INVALID_STATE, you likely just have to re-run motor and/or encoder calibration (note w/ incremental encoder, you need to run ENCODER_OFFSET_CALIBRATION or ENCODER_INDEX_SEARCH on each boot – maybe this was previously enabled, assuming you have an index line)?