Lua Scripting Errors

Hey All,

I am trying to run a Lua script that worked in simulation on an actual aircraft and am running into some errors. Lua script enclosed below:

https://drive.google.com/drive/u/1/folders/1DCgAvanrKH4o5Ozvm1PcdoWyajYq3xxj

The first error message I am getting is that it is from line 6. The RC transmitter is on (Herelink) and is outputting PWM (confirmed via QGC and Mission Planner) - so I am a bit confused.

image

For what it is worth - when I enabled scripting a “scripts” folder was not automatically made for me. I had to manually make a “scripts” folder and put my script in there. Another simple script I use for making sure the aircraft is in loiter when disarmed is working (FYI).

You need to use 4.1.dev to use the bindings as found in the master branch examples. You could also jump on the new copter beta.

1 Like

Thanks for update. Any word on when 4.1 will go stable? I am running a rather expensive payload on this aircraft and wouldn’t want to run dev if it is not proven yet.

Hey!

I updated to 4.1beta but am now getting the following error:

‘set_output_pwm’ (too few arguments)

I have not changed my code since what is find in the first link I shared. I believe I am giving it correct arguments so I am a bit confused.

SRV_Channels.set_output_pwm(94, new_pitch) -- Set scripting 1 servo (connected to gimbal).

should be:

SRV_Channels:set_output_pwm(94, new_pitch) -- Set scripting 1 servo (connected to gimbal).

With a : not a .

1 Like

I’m a dumbass - thanks for pointing that out.

I had to increase the memory available for scripting to 60,000. Is that ok (or is there anyway to check the ram usage)? I am running a Cube Orange.

Yeah that’s fine, loads of memory on Cube Orange, you can see free memory in the log. PM -> Mem

1 Like