Read MAVLink messages into lua


I have data being set from an engine that i can view with mavlink inspector, I would like to take actions based on this data, could anyone link me to example code or provide some example code to for example, beep when cylinder head temperature goes above 50?


If you want to do that on the GCS take a look at adding a mavproxy plugin.

If you want to build your own GCS take a look at pymavlink examples

I do not see the advantage of beeping on the vehicle using lua. If the vehicle is far away you will not listen to the beep

neither, I want to run action on the pixhawk cube based on the telemetry from the engine.

and examples: ardupilot/libraries/AP_Scripting/examples at master · ArduPilot/ardupilot · GitHub

i appreciate your links but these dont meet my needs.

the example CAN code doesnt even work for instance

Open a github issue then.

I want to read mavlink messages onboard the aircraft with onboard lua… not hunt can issues

What you need are Lua bindings to access those values. To my knowledge they do not yet exist, but the instructions for adding a binding are in the link provided above.

Hi, do you find solution for your problem ? I’m working on something similar and I stuck in same place :slight_smile:

What exactly is unclear in the instructions on how to add lua bindings?

I want to creat LUA’s script which allows me to overwrite pwm after failsafe. I’m looking for way where i can find information how can i read messages from pixhawk or read mavlink, or something else which can help me to figure it out :slight_smile:

Failsafe is a trigger for my script

Then create lua bindings to read the failsafe state.

You keep repeating this in multiple threads (which is a good way to get negative attention), but your question isn’t detailed enough to provide valuable help.

Describe your exact intent. Under what conditions does the firmware fail to provide adequate failsafe actions?

What failsafe condition are you trying to detect?

What override is necessary (and why)?