Servers by jDrones

LUA scripts within SITL simulations?

Is it possible to setup the LUA script environment to test scripts within SITL simulations? How does one do that?

yup, if you are using sim_vehicle.py approach to simulate then create a scripts folder in your /home/user/ardupilot directory, and add your lua scripts in that folder, then just follow the rest of the instructions as given in this link: https://ardupilot.org/copter/docs/common-lua-scripts.html

Thank you very much - it worked out beautifully! One pitfall that I discovered is that one can not control servos that are passthrough (Servo#_Function=1) with LUA scripts. Of course, this should have been obvious since the beginning but hey, I am a mortal.

Cheers!

I think you should be able to control any servo with the new override binding with a timeout.

Thanks Peter, I will give it another shot but out of the 8 channels I have, only one was pass through and failed to work. When I assigned a new function to it it started working.

For instance in the example you sent the servo function is 4 (aileron). That’s why the code works. If the function were 1, it would not work. I think it makes sense that it doesn’t because pass through should mean that the APM can not manipulate it whether with or without a script.

Thanks

Servers by jDrones