Servers by jDrones

Can a Servo*_Function be set from LUA script?

Is it possible to set a servo function to “disabled” and then back to original function from LUA scripting?

I can read the function for a channel but not set the function.

thank you for any feedback!

It should work with param:set() or param:set_and_save().

I’m changing the H_RSC_SETPOINT parameter for traditional helicopters with Lua scripting which is working great. I’m also using the “param:set(X,Y)” function. But there might be parameters where the changes only take effect after a reboot of the board. Maybe that is your problem?

Its probably worth mentioning that its a bad idea to use param set or set and save at a high rate. They have to do a string search through the full param list.

If you just want to stop a servo you could also use the new servo override binding from @TunaLobster .

1 Like

Thank you for the input.

I had not noticed the Lua script AP_Param Set_And_Save function.
I do not see any examples in the LUA script examples. I see them in the C code but I am not familiar enough to understand how to use it in the LUA script code.

My goal is to do something like change a servo channel function from say RCIN7 (57) to SCRIPT10 (103) . This would only be done when armed and not armed so extremely low rate ( and that I know how to do in the LUA script).

Any use example would vastly speed up my understanding of how to use the AP_Param: set_and_Save function and it would be greatly appreciated!

So my goal is to change a servo channel function from one thing to another and then of course back to the original function in LUA script.

Thank you…this forum is so good!

Frank

Hi Frank,

you can find a lot of interesting examples here:

If you’re not familiar with the param:set or param:get functions, this script might be helpful:

But as I said, I’m not sure, if changing the parameter will change the servo function right away or if you would need a reboot. You could check this by changing the parameter manually. If everything behaves as expected, it should also work with your script.

Servers by jDrones