Change parameters after init

HI there,
I’m now using simple foc lib v2.1.0. It seems that all the configuration parameter such as pid and limits cannot be changed after motor.init function, right?
Is there still a method to change the configuration parameters while running in the loop, except for command interface?
Thanks a lot!

Sorry, I just fonud that the configuration parameter still can be changed after init.
Problem solved!
BTW, I’m trying to increase the current limit from zero steadily in the postion control, to make it rotate smoothly at the beginning of the control.


Sai - I’m having the same problem. What was the solution ?

Hey guys,

You should be able to change all the parameters in real-time.
@Steven_Gregorski Which parameters are you trying to change?

Hi Antun,

I figured it out, but I still see a possible issue, so maybe I’m missing something ? It seems that if you try to dynamically change a motor LIMIT such as velocity by running “motor.velocity_limit = 1.0;” the value does indeed change, but the motor performance does not. To force the change to actually work you need to rerun “motor.init();” after “motor.velocity_limit = 1.0;”. But this is really clunky to do.

It seems this is only true for changing limits and not gains or other parameters

Oddly enough, you can change the limits programmatically with code like this:

char* my_string = “ALV5”;;

This solution works, but takes several milliseconds to work on a SAMD51.

Am I missing something ? Thank you for your help !!!

PS - The program is AWESOME !!!

Hey @Steven_Gregorski,

This is strage, if you look into the It will do exactly that: motor.velocity_limit = 1.0
It is true, actually that it also updates the PID controller limits, you are rigth.

If you’re changing the velocity limit do this:

motor.velocity_limit = 1.0;
motor.P_angle.limit = 1.0; // PID saturation limit

Here is what the Commander does:

Mystery solved ! Thank you !!!