This is my first post here, though I have been building/flying UAV’s for many years now.
I do not have a programming background, but am interested in diving into the world of lua scripting.
I’d like to create a script that can pull positional data from a GPS antenna that is attached to a pixhawk.
Would anyone be willing to assist me in creating this project or point me in the right direction? I’ve read through the lua scripting section of the ardupilot documentation section already. What I’m attempting to do seems very doable, however I’m not really sure where/how to get started.
Any assistance would be greatly appreciated! Thank you.
What I’d like to do is pull positional data from a GPS that is connected to a pixhawk, on an aircraft in-flight. I’d like the script to run when you power on the aircraft and I’d like the script to run continuously until that aircraft is powered down. I’d like it to compile into a readable format so that it can be parsed and saved to the onboard SD card.
I’m looking for the following:
So the problem with using the native log analysis tool and python (as I understand it) is the size of the data that gets compiled. The files are too large to chew through at the end of flight operations (i.e. would take hours), and so I need something that will pull only the specific data points that I previously mentioned. This will cut down on processing time. In addition, I’m looking for something that will compile the data in an excel spreadsheet.
After our Discord chat, I put some effort into the script. It was slightly more challenging than expected due to the lack of RTC bindings that would provide UTC time more directly than having to calculate it from GPS data. If not for that complication, the whole thing would only be about 40 lines!
This is only minimally tested in SITL, and I have not tried it on a vehicle with more than one GPS, so that functionality remains to be seen (though it should log all connected GPS instances).
Each time the autopilot is armed, a new file is created in the root directory of the SD card.
The resulting files should open without issue in Excel. To format the date column, use a custom format with the string dd mmm yyyy, hh:mm:ss.0.
To get coordinate decimal degrees, use an Excel formula like =C2/1e7. This math is best left to Excel vs the logging script, since floating point error will be mitigated better than if it were done in Lua.