Repurposed VOXL ESC v2 params
-
Hi all
I intend to make use of the VOXL ESC v2 that came installed in the Seeker on a customized build instead. The motors being driven are different (obviously).
Would i need modify and upload a new set of params specifically configured for my motors?
Im using these reference params as a guide:
https://gitlab.com/voxl-public/flight-core-px4/voxl-esc/-/tree/master/paramsAre there documentations/explanation for the params?
Eg. no idea what these factors are referring to in:
pwm_vs_rpm_curve_a0/a1/a2 and how the P and I gains were derived etc etcAny help is greatly appreciated
-
Hello,
Currently the documentation for basic ESC calibration is here : https://gitlab.com/voxl-public/flight-core-px4/voxl-esc/-/blob/master/tools/calibration.md and most parameters are briefly documented in the XML files as well. However, not everything is clear, as you pointed out. We will update the documentation soon with more information.
In short, the RPM controller on the ESC is in the following form:
power_applied = feed_forward_power + kp * proportional_error + ki * integral_error
- feed_forward_power is calculated from the quadratic curve a0,a1,a2 parameters you mentioned. Those parameters are obtained by running the esc calibration script. This term is used by ESC to apply required power in order to achieved steady-state desired RPM
- kp and ki are the proportional and integral gains
- proportional error = rpm_desired - rpm_current (calculated by the ESC), similar for integral error
- max_rpm delta is the cap on RPM error that is used for feed forward term, proportional term and integral term calculation
- max_kpe and max_kie are the maximum proportional and integral power terms (kpproportional_error and kiintegral_error). This cap can overlap with max_rpm_delta, I will explain in more detail separately
- In general, you want to start off tuning by setting kp and ki to zero and just calibrate the feed forward term. After this is done, the ESC should track RPM pretty well even with varying battery voltage (within +/-2V within nominal voltage as defined in params). The response to RPM changes would be very soft, similar to traditional off-the-shelf ESCs. Then you can set non-zero kp and observe faster response. This part is highly dependent on the system that you have (whole drone) because if the rpm commands you feed into ESC are noisy, this noise will be amplified by high kp in the RPM controller and can feed back into creating even more vibration. In general, you want to have non-zero kp but not too high so that the controller is stable with clean input (no noise) but also does not respond to the high-frequency noise fed with the rpm commands (the original high frequency noise can be coming from propeller vibration being picked up by the gyro)
- in general setting kp and ki to zero will achieve good results and will still be better than off-the-shelf ESCs because RPM tracking is accurate and consistent across battery voltage changes.
Please let me know what other questions you may have and I will try to incorporate in a more official write-up.
Alex
-
Appreciate the detailed explanation - i will give it a shot.
If i understand the docs correctly, since im using a ModalAI build for the Flight Core, the ESCs are driven by the modalai_esc drivers (RPM command instead of PWM). Am i right to say that:
-
I am not required to perform ESC PWM calibration thru QGC
-
As specified in https://docs.modalai.com/modal-esc-px4-user-guide/ , UART_ESC_RPM_MAX/MIN needs to be set to follow the max/min_rpm parameter specified in the VOXL ESC param file?
-
I am still required to adjust the thrust curve with the THR_MDL_FAC as specified in https://docs.px4.io/v1.12/en/config_mc/pid_tuning_guide_multicopter.html#thrust-curve
Thanks
-
-
Yes, the ESC calibration using QGC is not needed, but you do need to run the ESC calibration using
voxl-esc
tools. Note that usingvoxl-esc
tools requires connecting the ESC UART directly to a linux or mac computer in order to communicate with the ESC.The PX4 min/max rpm should be set according to the actual min/max values of the motor/propeller with modalai ESC. Note that for min RPM, the ESC may have a lower setting for min RPM than you would want to use in PX4. Dropping the RPM too low in flight could cause some instability in PX4 attitude controller, so you don't always want to go to the absolute minimum. When you perform the ESC / motor calibration, note the RPM results from applying 15% power and that may be a good one to use as minimum RPM (just a rule of thumb..). For maximum RPM px4 param you can put the maximum RPM achievable at nominal battery voltage. Note that maximum RPM is a function of battery voltage, and if you tell PX4 the maximum RPM at full battery voltage, then PX4 will incorrectly assume that that max RPM is achievable at lower voltages too. To be conservative, you can put the max rpm at nominal or lowest battery voltage you would use. The maximum RPM vs battery voltage is actually something we are looking at right now how to properly handle in PX4.
When using RPM control, the mapping between thrust and RPM is usually an almost perfect quadratic, so you should probably use THR_MDL_FAC = 1 to make it quadratic. However, let me double check that last point.. The value of this parameter should not change when you change motor / propeller, since thrust is almost always a pure quadratic vs rpm.
-
On this point you made earlier:
"For maximum RPM px4 param you can put the maximum RPM achievable at nominal battery voltage."
and from calibration.md:
"minimum rpm can be taked from 10% power and maximum from 95% power."I am going to specify the max rpm at powers less than 95% (say 75% only). I am doing this to prevent my motor+propeller combination from burning out the motor. At 75% power my propulsion is already producing more than twice the hover thrust.
In this case, my max RPM specified in the VOXL ESC param/PX4's UART_ESC_RPM_MAX/MIN is artificially "capped" so that the throttle command will never be near the max PWM throttle value. Are there settings in PX4 that needs to be set to account for this? Afterall, the original PX4 uses throttle commands but the ModalAI build uses RPM commands.
MPC_THR_HOVER = 0.5 comes to mind (https://docs.px4.io/v1.12/en/advanced_config/parameter_reference.html) -
If you are artificially limiting the motor RPM to 75% power, then it should always be achievable, though you should test. Whatever that RPM is, check at lowest battery voltage and make sure the ESC can still achieve that RPM (most likely power will be close to 90%+). In that case, you can specify same max rpm limits in ESC and PX4.
I believe PX4 will scale the thrust to be between min and max rpm, so full throttle should try to max out the RPM (with some margin for control) but the hover throttle param is a good question, probably better to ask @modaltb , since I am not an expert in that. or @James-Strawson
-
This post is deleted! -
When using RPM control, the mapping between thrust and RPM is usually an almost perfect quadratic, so you should probably use THR_MDL_FAC = 1 to make it quadratic. However, let me double check that last point.. The value of this parameter should not change when you change motor / propeller, since thrust is almost always a pure quadratic vs rpm.
Hi @Alex-Kushleyev , did you manage to find out if THR_MDL_FAC should be set to 1 or should i calibrate the thrust curve?
PX4's docs specified in https://docs.px4.io/v1.12/en/config_mc/pid_tuning_guide_multicopter_basic.html that if the ESC is a RPM-controlled one, no tuning is required:
For PWM controllers, 0.3 is a good default (which may benefit from further tuning).
For RPM-based controllers, use 1 (no further tuning is required as these have a quadratic thrust curve).But i noticed from ModalAI's reference params (eg Seeker's https://gitlab.com/voxl-public/flight-core-px4/px4-parameters/-/blob/master/platforms/v1.12/Seeker/Seeker_v1_param_rev_A.params) that the you guys did a calibration regardless
# Dyno test shows this model should be 0.90 1 1 THR_MDL_FAC 0.90 9