Tuning with load

Just passed the getting started section. For my project, I’d using a motor to rotate a pretty low friction turn table. I’m hoping to make very small rotational changes like <1 degree, however it also has to be capable of rotating exactly 180 degrees in less than a quarter of a second.

I’m using a NEO Brushless motor (NEO Brushless Motor - REV Robotics) which has 7 poles and 473Kv. I’m using a through bore encoder (Through Bore Encoder - REV Robotics) with 8192CPR.

I’m doing all this on a raspberry pi programed in python, interfacing with ODrive using the USB cable. I’ve read some forms saying that this method might be too slow, what are your thoughts?

I’m in the tuning stage and I have a few questions.

  1. Should I tune my motor before I connect it in my system or after its attached to my axles and shafts and integrated into the robot?

  2. I begin with Current control, then velocity control, and then position control. I see under controller > ControlMode the CONTROL_MODE_VELOCITY_CONTROL and CONTROL_MODE_POSITION_CONTROL but not the current one. How do I set the current control mode?

  3. As I switch my control modes, do I continue to use the same code as found at the bottom of Control & Tuning page? i.e. controller.config.pos_gain = 20.0? Or do I need to change the code based on which control mode I’m in or does it do that automatically?

  4. It says “increase until some vibrtion”. Do I literally increase until my motor vibrates, because that happens at vel_gain = 30 and that seems too high considering the default is 0.16

  5. After changing for example, vel_gain, what command should I run to see if it vibrates or has overshoot?

There’s a difference between calibration and tuning.
Calibration should be done without a load, but tuning should be done with the load.

You do not need to tune current control
You can set current control with controller.config.control_mode=CONTROL_MODE_TORQUE_CONTROL (torque mode and current mode are the same thing)

pos_gain is only use by the position controller, but vel_gain affects both velocity and position modes, because the position controller is ‘wrapped around’ the velocity controller ie the output of the position controller is a velocity demand.

which firmware are you using? The units have changed from encoder counts to revolutions in the more recent versions so the gains are much smaller.
You might need to change setpoints to see the vibration effect, ie try setting a 1rev/s demand and change it to 0, does it vibrate at a much lower gain in this case?

the command you need is controller.input_vel=1 (or 0)

Good luck! :smiley: