On this page
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):
- Motion control mode -
motor.controller
- Closed-Loop control - with position sensor
- Open-Loop control - no position sensor
- Torque control mode -
motor.torque_controller
- Used only in the closed-loop control modes
Units in the library
All the motor/driver/sensor parameters and control variables are defined in the following units:
Physical value | Units | Description | Conversion to other units |
---|---|---|---|
Position/angle | Radians | Motor and sensor position in radians | 2\(\pi\)(6.14) radians = 360 degrees = 1 motor rotation |
Velocity | Rad/s | Motor and sensor velocity in radians per second | 2\(\pi\)(6.14) rad/s = 1 motor rotation per second = 60 RPM |
Torque/Current | Amps | Motor torque or current in Amperes | 1 Nm = \(K_t\) Amps (\(K_t\) is the motor torque constant) |
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 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 control - with position sensor
- Open-Loop control - no position sensor
Closed-Loop control
There are three Closed-Loop 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 control loops visit the closed-loop control docs
Open-Loop 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 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