Lua Scripts using Velocity Control

Thank you again,I am looking through example2.py in the scripts MP folder.It seems can promote my problems

1 Like

I found something about how to get other vehicle data.For example,I connected two vehicles,one sysid is 2,the other is 3,if you want to get “lat/lng” data .just imput lat = MAV.MAVlist[sysid, compid].cs.lat
lng = MAV.MAVlist[sysid, compid].cs.lng in Python Scripts

2 Likes

Hi guys!

I have a problem uploading scripts files:

when I tried to upload (or download) a script, an error message appears

at the end, the script appear into the folder but it is empty…

I only can get put the scripts into the folder manually but I need to do that via telemetry!!

Also sometimes appear a error message in Mission Planner that may be related to this ( I am not sure)

This error message appear since I updated Mission Planner to the last versión to get the MAVftp option (because I can’t see it in the older versión I had installed)

Any ideas??

Finally I got upload the script, but only if the size is smaller than 228…I don’t understand why…

Any ideas???

Excuse me,could you teach me create the folder called scripts

clicking rigth mouse button under the folder APM and select the “New folder” option, That’s all.

1 Like

I am using ArduCopter version V4.1.0-dev firmware on Pixhawk, new examples added to this version mostly working fine but i want to add new bindings for lua scripting, this documentation for How to Add New Bindings does not seems to be updated according to the master branch https://ardupilot.org/copter/docs/common-lua-scripts.html#how-to-add-new-bindings. I wanted to know how can i add more mavlink commands as new bindings to run with lua script.

@Notorious7,

The documentation is a little out of date but not too bad. The first two lines are still valid,

  • Find the method or function you would like to expose to Lua. For example if you wanted to expose an additional feature of AHRS you would first find the method within libraries/AP_AHRS/AP_AHRS.h
  • Edit the libraries/AP_Scripting/generator/description/bindings.desc and add a new line in the appropriate section for the method.

But this last one is no longer necessary because it’s done automatically when the ArduPilot vehicle code is compiled.

  • Open a command line prompt and cd to the /libraries/AP_Scripting/generator directory and type “make run”

By the way, mavlink is not really involved for lua scripts. Lua scripts have direct access to the flight code so they don’t need to use mavlink.

i see, thanks for helping, just curious to know if there’s any way around to run lua scripting feature in flight controllers with 1MB flash, i just want to automate a drone movements in guided mode by giving drone a set of positions stored in a text file, i don’t want to use any other features apart from this functionality for the moment

Hi rmackay9

Finally I got upload the script, but only if the size is smaller than 228…I don’t understand why…

Any ideas???