ArduPlane v4.4/MissionPlanner SITL with XPlane11 run LUA script?

Hi there!
I tested ArduPlane v4.4/MissionPlanner SITL with Xplane11 using LUA scripted aerobatic tricks but it failed. Following procedures were taken.

  1. Save “plane_aerobatic.lua” file in MissionPlanner > sitl > xplane > script folder.
  2. Make mission plan including NAV_SCRIP_TIME commands and load it on ArduPlane’s xplane model.
  3. Set SCR_ENABLE=1
  4. Arm and change flight mode to “Auto”.
  5. Simulation starts and the airplane flies following the mission plan.
  6. When aircraft reaches the SCRIPT_TIME position, “nav script time” message is appear but “time out” message soon displayed. No trick is played.

To confirm my mission plan is correct, I played SITL without Xplane with same plan on plane-3d model. It worked well.
Then I loaded this plane-3d parameters on xplane model and played with Xplane. It flew along the plan but no tricks were conduted. Same time-out message was displyed.

From above experience I guess ArduPlane’s xplane model has no LUA script capability. Is my guess right?

Are you getting a message like the following?

Lua: Insufficent memory loading ./scripts/plane_aerobatics.lua

If so, try increasing SCR_HEAP_SIZE.

No, I did not receive such message because I had increased SCR_HEAP_SIZE beforehand.

Have you ever tried LUA script with Xplane11/ArduPlane/MissionPlanner SITL?

I am running aerobatic script with X-Plane 11 right now.

Your Lua script may not have been loaded properly.
Whether or not the Lua script has been successfully loaded is recorded in the log file.
Convert the bin file to a log file and check if there is a record like the following.

FILE, plane_aerobatics, 0, 64, --[[\r\n trajectory tracking aerobatic control\r\n See README.md

But same LUA script loaded plane-3d and xplane and plane-3d works well but xplane does not.

Anyway I will check the log file and will report.
Teach me how to convert the bin file to a log file please.

This is the message drawn from the bin file. There is no record you have shown me.

The UAV Log Viewer displays only minimal messages. Use “Convert .Bin To .Log” function in Mission Planner to convert the log file, and check it in the text viewer such as Notepad.

By the way, UAV Log Viewer shows the loaded script file in the left pane.
Your screen shot does not show it, so it seems that the script has not been loaded properly.
Please check again if the script file is located in the appropriate folder.

Where can I find the converted log file?

My Mission Planner’s Data flash log page has “PX4 Bin to Log” button instead of “Convert Bin to Log”.
When I selected it then ***.bin file list appeared from that I selected one file and pushed the open button. But there appeared nothing.

P.S.
After changing UI Language from Japanese to English, “PX4 Bin to Log” changed “Convert Bin to Log”.

This is where the LUA script file is located. I believe it is right location.

What is your Mission Planner version?
The “PX4 .Bin To .Log” button was renamed to “Convert .Bin to .Log” long long ago .
First of all, why not update Mission Planner to the latest version?

The .Log file is created in the same folder as the .Bin file.

My Mission Planner version is 1.3.81.
I could find .log file in the same folder. It took long time to appear.
Unfortunately there was no record of “FILE, plane_aerobatics, *****”, so it is true, as you say, LUA script is not correctly placed.
Is there any mistake in my placement of the plane_aerobatics.lua script? i.e.
Documents > Mission Planner > sitl > xplane > script.

Are there any error messages in the log file that begin with “Scripting” or “Lua” ?

No, nothing was found.

I think the location of the scripts folder is correct.

As a test, try deleting the scripts folder or renaming it to a different name and running SITL.
Check if the “scripts” folder is automatically created.

Could you try another one?

  • Run SITL.
  • Set SCR_DEBUG_OPTS = 1.
  • Restart SITL

If the Script file is not loaded correctly, you will get the following message.
Lua: No scripts to run

I am also concerned that the file size of plane_aerobatic.lua is different from that of Plane-4.4.

The plane_aerobatics.lua of Plane-4.4 can be downloaded from here, so could you please try it with this script?

Check if the “scripts” folder is automatically created.

No, nothing was created.

I can’t get this message.
Also I changed the plane_aerobatics.lua but nothing has changed.
There appeared “Mission: 2 NavScriptTime” then 1second later “NavScript time out”

Please locate the ArduPlane.exe that Mission Planner downloads. It is usually located in “Documents\Mission Planner\sitl”. If you find it, delete that file and see if the downloaded ArduPlane.exe is saved there when you restart SITL.

In my environment, it is OneDrive\Documents\Mission Planner\sitl. Please look for it there as well.

The “ArduPlane.exe” is located in “Documents\Mission Planner\sitl”.
I deleted it and restarted SITL and I have confirmed that it is saved again in the same location.

I don’t use OneDrive. So there is nothing in my OneDrive.

Can you show me the .bin log file which you ran the mission that contains a SCRIPT_TIME command?