Using Myxa in multirotor aircraft
This section has been updated for Telega v0.5 and newer. If you are using an older version, consider updating the firmware.
By default, Myxa’s control loops use fairly conservative settings which result in slow speed response characteristics. These settings are optimized for applications where fast response is not required by design (e.g. electric aircraft and submarines). Other applications, such as multirotor aircraft, may require faster response, in which case Myxa’s settings will require adjustments.
In order to improve the response characteristics of the speed control loop, perform the following adjustments:
- Set the acceleration rate to 15 000 ~ 20 000 electrical radian per second per second, depending on the needs of your application.
- Set the deceleration rate close to 10 000 electrical radian per second per second or lower (higher values should be avoided).
- Set the maximum current to 1.5 times of the maximum continuous current of the motor, but not higher than 40 A (or whatever is the maximum peak phase current for your controller).
- Set the P and I gains of the PID controller (
m.eangvel_ctl_kp
,m.eangvel_ctl_ki
) as described below; set the D gain (m.eangvel_ctl_kd
) to zero. - Set the linear feedforward coefficient
load.linear_coef
to zero, set the quadratic feedforward coefficientload.square_coef
as described below.
The relationship between electrical angular velocity and mechanical RPM is defined as follows:
where:
- RPMM - mechanical RPM,
- ωE - electrical angular velocity, in radian per second,
- P - number of rotor poles.
The transfer function of the speed PID controller can be approximated as follows:
where:
- A - current setpoint [ampere]
- Kp - proportional gain [ampere*second/electrical_radian]
- Ki - integral gain [ampere/electrical_radian]
- Kd - integral gain [ampere*second2/electrical_radian]
- n - sample index
- ωE - electrical angular velocity [radian/second]
- ΩE - electrical angular velocity setpoint [radian/second]
- TPWM - PWM period [second]
The feedforward torque is computed as follows:
Where \omega is the mechanical angular velocity in radian/second, c_1 is load.linear_coef
, c_2 is load.square_coef
.
The tuning amounts to setting three parameters: m.eangvel_ctl_kp
, m.eangvel_ctl_ki
, and load.square_coef
. There is a helpful spreadsheet that automates the tuning process (make a copy and edit that):
Enter the required numbers and adjust the performance by changing the damping factor δ if necessary (if unsure, leave the default value). If you require any further guidance or if your propeller is not listed in the spreadsheet, please, reach out to us either via this forum or via support@zubax.com.
Field weakening tuning
-
Set the value of weakening current
m.max_id_current
= 20…40% ofm.max_current
. -
Set the maximum allowable electrical angular velocity of the motor. For example, if you want to set the max speed to 6000 rpm, set
m.max_eangvel
= 6000/60 *m.num_poles
* pi. In the field weakening mode, the ratiometric RPM control mode is used. The setpoint value is normalized tom.max_eangvel
. -
Enable the field weakening feature:
ctl.field_weaken
= true The field weakening mode will be automatically activated when the motor voltage is close to the operating voltage limit. -
Tune the BEMF controller if there is poor response in the field weakening mode. Increase
m.fw_bemf_ctl_ki
andm.fw_bemf_ctl_kp
. -
If you are using the voltage control mode (
uavcan.esc_rcm
= 2 orrcpwm.ctl_mode
= 2), there may be abrupt speed (thrust) variations at values close to the maximum speed when the field weakening mode is activated. If these variations are significant, it is recommended to use the ratiometric RPM control mode (uavcan.esc_rcm
= 1 orrcpwm.ctl_mode
= 1).