I tried the LUA script ‘plane_aerobatics.lua’ with the latest stable firmware 4.3.4, but it did’t work.
The message was ‘LUA:APM/SCRIPTS/PLANE_AEROBATICS.LUA:47:ATTEMPT TO COMPARE NIL WITH NUMBER’.
I believe this message says that the line number 47 in the script tried to compare nil with number.
Please teach me how I can solve this issue and fly with the script.
Thank you for yor reply but why? The manual says that we can use scripts with 4.2.0 and after. Is it a bug?
Can we play the ‘sports_aerobatics.lua’ with 4.3.4 stable?
The scripts from the Plane 4.3 branch should all work, they can be found here:
The scripts from master, which is the default branch on github, may only work on the dev build.
Thank you iampete, I downloaded the script from above Plane 4.3 branch and conducted SITL simulation with 4.3.4 firmware but it still did not work. There was a message
Error running script
File “C￥User￥・・・・￥scripts￥plane_aerobatics.lua” line1
–[[perform simple aerobatics in Auto mode
SyntaxError unexpected token “simple”
Can you teach me how to resolve this error?
Looks like you’re attempting to run the script via a standalone interpreter, and most likely one that isn’t even Lua.
Follow the instructions in the documentation - they are valid even for SITL.
Lua Scripts — Plane documentation (ardupilot.org)
It’s also possible that you have mistakenly copied and pasted something, since the line you posted is missing a leading “-” character.
Yuri thank you for your advice.
I followed again the Lua Scripts instructions and downloaded the script ‘plane_aerobatics.lua’ (simple aerobatic manouver in Auto mode). I confirmed its file type is ‘.lua’ and tested SITL simulation again. But the situation did not changed, I got the same error message.
There is one strange I can’t understand i.e., in the data panel, there appeares ‘Scripting restarted’ message but no ‘Script Loaded’ message follows. So I opened the script panel and started the script. Is this normal?
The scripts tab in Mission Planner is for running local Python scripts. If you are using it, you haven’t followed the documentation at all.
Thank you Yuri, I finaly succeeded the Lua script SITL simulation with the 4.3.4 parameters unloaded from my Durandal FC. I took this method because the parameters accomapnied with the simulation’s stable version has some error and the airplane mooves with speed of around 2m/sec before arming.