Pixhawk Lua Script Servo Command Errors

I am able to run Lua scripts such as the hello world, however any attempt at any of the scripts that control a servo just appears to error out on the servo command line. It seems that it does not know of the servo library/binding? I am definitely new to Lua scripting (but I have written software for over 30 years professionally). I am working on a Drone project with one of my sons.

I have tried all of the default scripts that drive the servos and get the same type of message.
Is there a way to read the complete error message? I suspect I have a configuration issue of some sort?

Thank you for any feedback! This is such an awesome site!

This was the servo_scan.lua attempt.

image

The scripts in the example folder only work on master/dev. You will need to change the branch to plane 4.0 to see the examples that will work for you. (or of course update to master/dev, take care not stable ect ect)

Peter thank you.

I tried them first with the master branch then changed to beta thinking they might work on beta branch. I will go back to master and give it another try (or 2 or 3) and make sure I am looking at the correct examples.

I believe that you are indicating that the correct examples should work as is without any needed PC configuration. If the Lua scripts are running at all, the correct ones should run on the correct firmware branch?

Master branch is the Official branch as observed in Mission Planner?

thanks

Stable is what you get by default in mission planner, there is a button that gets you beta. Beta is ahead of the stable release.

Master/dev is the the very latest development, you can get this in mission planner by pressing Ctrl + q on the load firmware page.

I did the ctrl Q and loaded the dev firmware. I have the SCR_Enable set to 1 and have the scripts folder under the APM folder. In the scripts folder there is the SERVO_SCAN.lua file.

However now I do not see any indication of Lua scripts starting. No Lua messages. See below.

and thanks again.

image

You had responded to my previous post yesterday where I had mentioned my taranis QX7s was bricked., I was able to un-brick it.

No messages most likely means its running fine. If its crashed you will see no scripts to run (so long as SCR_DEBUG is still 1 or larger) If your very quick at boot you should see a message saying its loaded script x.

You can of course just load the simple loop script as well to get messages, or put a print in your script.

That was pretty funny…I had not seen it run without the no scripts message, so I thought it was not working. It works! I also enabled the extended error message for my future issues.

This is going to be fun!

thank you for the great and fast help…much appreciated!

Hi, like you, I had “couldnt load local state” errors, but when I changed the mission planner version to the beta version, I have no errors related to the Lua script, but the “Hello World” message still does not run.
Why?

What release of AP are you running? Need a recent version of AP not MP.

Corrado

my ap version is ArduCopter V4.0.4-dev (4c964dd8)

Should update to 4.1

Scripting has stopped
Lua: Couldn’t allocate a lua state

I would guess your out of memory, you could try turning off some other features.

27000 is free

I would guess you need 40K to 50K for scripting.

He gave an error again with the update
Should I not install the ardupilot command library on the Lua compiler?

I first write the script in a text file and then change its format to “.lua”
Is this wrong?



Thank
The main problem was the low amount of memory

Hi
What is the value of 300 (scripting) used for?