Hello everyone,
I have been working on some Lua scripts and it’s going quite well so far, but I have reached a roadblock. I am using Copter 4.4.3.
I am trying to bind to copter, because I need access to the pos_control and loiter objects.
As an initial test I wanted to see if I can bind to “void failsafe_check()” - a public function in Copter class.
Here is the code I added to bindings.desc (I will update docs.lua as well but in my experience bindings work fine without that)
include ../ArduCopter/Copter.h
ap_object Copter method failsafe_check void
Here is my test script:
-- test lua scripting
--[[
trigger function -- determines if it is time to do something
]]
function trigger()
Copter:failsafe_check()
return trigger, 1000
end
-- start running the loop
return trigger()
When the script is ran I get the following error:
Lua: State memory usage: 4824 + 26341
Lua: ./scripts/test.lua:9: attempt to index a nil value (global 'Copter')
AP: Lua: ./scripts/test.lua:9: attempt to index a nil value (global 'Copter')
Please help