Link

Motion control

SimpleFOClibrary has two main parameters that define the motion control architecture to be used (and each of them can be modified in real-time):

Torque control modes

There are three torque control types implemented in the SimpleFOClibrary:

  • Voltage - TorqueControlType::voltage
  • DC current - TorqueControlType::dc_current
  • FOC current - TorqueControlType::foc_current
⚠️ This parameter is not used if the open-loop motion control is chosen.

And they can be set by changing the motor attribute torque_controller.

// set torque mode to be used
// TorqueControlType::voltage    ( default )
// TorqueControlType::dc_current
// TorqueControlType::foc_current
motor.torque_controller = TorqueControlType::foc_current;

For more in depth explanations about different torque modes visit the torque mode docs

Motion control modes

SimpleFOClibrary implements motion control for both cases:

Closed-loop motion control

There are three closed-loop motion control types implemented in the SimpleFOClibrary:

  • Torque - MotionControlType::torque
  • Velocity - MotionControlType::velocity
  • Angle - MotionControlType::angle

And they can be set by changing motor’s controller parameter.

// set motion control loop to be used
// MotionControlType::torque
// MotionControlType::velocity
// MotionControlType::angle
motor.controller = MotionControlType::angle;

For more in depth explanations about different closed-loop motion control loops visit the closed-loop control docs

Open-loop motion control

Additionally you can run the motor in the open-loop, without position sensor feedback, as well:

  • velocity open-loop control - MotionControlType::velocity_openloop
  • position open-loop control - MotionControlType::angle_openloop
Index search uses also uses open-loop position control, but has some additional parameters, see index search

And they too can be enabled by setting motor’s controller parameter.

// MotionControlType::velocity_openloop    - velocity open-loop control
// MotionControlType::angle_openloop       - position open-loop control
motor.controller = MotionControlType::angle_openloop;

For more in depth explanations about different closed-loop motion control loops visit the open-loop control docs

For more information about the source code implementation of the motion control strategies check the library source code documentation