i have installed VTOL quick tune Lua script on APM/ SCRIPTS folder .then inserted SD card on CUBE BLACK Flight controller .
After Reboot i got following Prearm errors:
So the CubeBlack uses an F4 processor so it doesn’t have enough memory unless some features are turned off. We’ve been planning to add a wiki page with suggestions on what features are most effective at reducing memory but here are some ideas:
EK3_IMU_MASK = 1 (this disables the 2nd IMU)
TERRAIN_ENABLE = 0 (disables the terrain database which will stop missions from using AltFrame=Terrain using the inbuilt terrain database, rangefinders will still work)
LOG_FILE_BUFSIZE = 8 (this reduces the memory used for logging which could lead to mission log messages but shouldn’t have any impact beyond this)
Thank you randy.
i was just followed your inputs and now I’m not getting prearm warnings but still message tap shows there is Lua :insufficient memory loading …is that normal?
I couldn’t see the QUIK_xxxx parameters too after enabled scripts
If you double click on an item in the Action tab and select “freemem” from the huge black window you can see how much memory is free on the board. For example I have 25,000 free on this random autopilot. You’d always want to leave at least 5000 but you could increase the SCR_HEAP_SIZE parameter by whatever extra you’ve got. I’d guess that 70,000 is enough for most scripts.
i have free memory around 22000 before SCR_HEAP_SIZE set to 70000.
but after set SCR_HEAP_SIZE set to 70000 free memory left is around 6978.but still i get prearm warning as below.
Well, I’m out of ideas I’m afraid. Maybe check that there are no other scripts in the scripts directory… Maybe disable any other features that you don’t immediately need (rangefinders, optical flow, anything else)…
The CubeBlack just doesn’t have the memory required to run scripting very well I think.
There is no other script installed on the cube.similarly no other functions enabled like range finder,optical flow etc…
You can refer 1st section of this thread to see only quicktune lua script only installed.
hi @rmackay9 today i faced same issue on CUAV V5 Nano autopilot also i think its F7 board with 2M flash …but why still could not able to run the lua script.
In the screen shots above it looks like SCR_HEAP_SIZE is 202400 which is more than the available memory of 145800. I think if you reduced SCR_HEAP_SIZE to 130,000 the error would go away.
The complexity comes though because at startup many different features try to take memory. There may be other features that also couldn’t get memory so it’s possible the above change to SCR_HEAP_SIZE won’t resolve the problem.
Through trial and error you should be able to find a SCR_HEAP_SIZE that works… I think it may be that there’s an overhead above and beyond the SCR_HEAP_SIZE. Sorry about that.
I am including a change in 4.2.2 that allows for the CAN memory pool to be reduced, which will help if you use CAN.
Scripting is hard though on F4 based boards, and it can be very tricky to get memory usage low enough to allow complex lua scripts to work.
We have discussed moving quicktune to being in C++ to avoid that issue, but that is unlikely to happen soon, sorry.
I thought I would add my experience trying to get the VTOL quick tune script running on a F7 board in the Pixhawk 4 mini. I think it would have plenty of memory to run it but I am getting the out of memory error when I try to start the script. I do have the EKF3 2nd IMU disabled and the log bit mask set to min of 8. I disabled all the serial that I don’t use and tried moving the heap size up and down to see if it would start. for some reason when I change the heap size the free memory does not change at all from 182000 free mem. The first message I do get before “scripting out of memory” is the “unable to allocate memory”. really not sure what else to try… Maybe the mini will never support scripting.
Free memory won’t change until it’s actually allocated. Apparently you either haven’t set the heap size large enough, or the board simply can’t load a script as large as the tuning one (which, as I recall, is a bit resource intense).
The Matek H7-based boards are very affordable in a compact form factor and will support most reasonable scripting needs. For a board with more convenient connectors, check out the QioTek Zealot H743.
Hi, i had this same error and i fixed it by changing the parameter SCR_DIR_DISABLE (checking the directory i wasn’t using). Since you’re using APM/scripts, select ROMFS to disble it.