Files
ODrive/docs/control.md
T
2018-09-08 19:22:51 +10:00

1.3 KiB

Control

The motor controller is a cascaded style position, velocity and current control loop, as per the diagram below. When the control mode is set to position control, the whole loop runs. When running in velocity control mode, the position control part is removed and the velocity command is fed directly in to the second stage input. In current control mode, only the current controller is used.

Cascaded pos vel I loops

Position loop:

The position controller is a P loop with a single proportional gain.

  • vel_cmd = (pos_setpoint - pos_feedback) * pos_gain

Velocity loop:

The velocity controller is a PI loop.

  • vel_error_sum += (vel_cmd - vel_feedback) * vel_integrator_gain
  • current_cmd = (vel_cmd - vel_feedback) * vel_gain + vel_error_sum + vel_feedforward

Current loop:

The current controller is a PI loop.

  • current_error_sum += (current_cmd - current_fb) * current_integrator_gain
  • voltage_cmd = (current_cmd - current_fb) * current_gain + current_error_sum + current_feedforward

For more detail refer to controller.cpp.