I’m working on a project where I’d like to use multiple Odrives to control six motors for a mobile platform. I plan on using ‘velocity control’ mode, and have followed the motor and encoder calibration steps and saved those parameters, so that at this point the only start-up function that I have to call before moving on to velocity control is ‘AXIS_STATE_ENCODER_INDEX_SEARCH’, to find the encoder’s index pulse.
Since the motors are controlling the vehicle’s wheels, I’d rather avoid the case of having the wheels moving at start-up before being able to control the robot. So I’m trying to determine what the best way to avoid that would be (if it’s even possible). One thought I had was to incorporate the index search into the first commanded move. The idea is to have a ‘master’ control board that would handle the control logic, so that on the first move after start-up, it’d command the motors in sensorless mode, with as conservative of parameters as possible, and then switch back to normal (encoder-based) velocity control as soon as possible after the encoder index pulse is found. Would it be theoretically possible to achieve that smoothly? Is there a better way to get the same result?
I can’t actually find any info on how to get out of sensorless control after sending the odrv0.axis0.requested_state = AXIS_STATE_SENSORLESS_CONTROL command.
Also, kind of unrelated to the main topic of my question but I also wanted to ask whether the ideal PID gain parameters are the same for sensorless and encoder-based control? On this page, it gives some sample code for trying sensorless control with vel_gain of 0.01 and vel_integrator_gain = 0.05. Using those values works in sensorless (although the motor does vibrate, so I presume they could be tuned further). However, if I use those same values and try AXIS_STATE_CLOSED_LOOP_CONTROL instead, the motor goes crazy (they seem to be waaay too high).