Position controller

Close the position loop in Motorcortex and tune it.

The position controller works on actuatorPositionError, the position target minus the actual position. Its output goes one of two ways, set by actuatorControlLoopNN/positionController/usePositionControlForTorque:

usePositionControlForTorque Output Use with
0 (default) A velocity, added to the velocity target CSV, or CST together with the velocity controller
1 A torque, added to the torque target. The velocity controller’s output is then not used CST without a velocity loop

Tune it

Follow Tune the controllers, after the velocity controller if you use it. For the position controller:

  • controlOutputMin and controlOutputMax are in rad/s or m/s, or in Nm with usePositionControlForTorque at 1.
  • Watch actuatorPositionError and positionController/output/controllerOutput.

Compensate for delay

positionController/delayForControlError/numberOfSamplesTarget and numberOfSamplesActual delay the target or the actual by up to 10 cycles before the controller forms the error. Use them when the actual position lags the target by a fixed number of cycles, so that the controller compares values from the same moment.