LibrePilot Forum

General Category => General Discussion => Topic started by: gelatinouscactus on March 04, 2017, 06:35:07 pm

Title: Python UAVTalk questions
Post by: gelatinouscactus on March 04, 2017, 06:35:07 pm
I've been trying to read telemetry from an oplink with python. I've tried reading all the documentation on UAVTalk and UAVObjects but I still have some questions and requests for clarification.

I'm following the lp_python_porting branch code from amorale [1] but I'm still confused on generating the uavobjects and how python is reading them in. 

Am I able to generate them using the GCS by Help->Export UAV Data?  I gather that I should put this in openpilot/uavobjects in the python module directory. What should the naming convention of this file be? Whenever the python script objectManager.py tries to import this, I get an invalid syntax error on the first line '<!DOCTYPE>'

Any help is appreciated!

[1] https://bitbucket.org/alessiomorale/librepilot/src/812babc4406e8063f04997e9f5214efe66ca4cac/ground/pyuavtalk/openpilot/uavtalk/?at=amorale/lp_python_porting
Title: Re: Python UAVTalk questions
Post by: f5soh on March 05, 2017, 12:47:41 am
Most up-to-date python branch is here https://bitbucket.org/librepilot/librepilot/pull-requests/389
and will be merged to next soon.

Using this branch you just need to do :
Code: [Select]
make uavobjects_python_install
And test using the example file:
Code: [Select]
python ./python/examples/example.py /dev/ttyACM0 gwhere /dev/ttyACM0 (or COMxx for Windows) is the serial device you configured in your board, setting the VCPport to USBTelemetry.

(https://forum.librepilot.org/index.php?action=dlattach;topic=3173.0;attach=5459)
Title: Re: Python UAVTalk questions
Post by: gelatinouscactus on March 05, 2017, 02:53:41 am
Thanks for the reply! You are always so helpful! I haven't seen this branch before so thanks for pointing me to it.
Title: Re: Python UAVTalk questions
Post by: gelatinouscactus on March 08, 2017, 05:06:17 pm
f5soh a few more questions for you. I'm still having trouble getting this to work.

Do I need to build this branch in order to use the python features or can I just run the command
Code: [Select]
make uavobjects_python_install?

If i do that, it says
Code: [Select]
required UAVObject definitions not found! /users/user/librepilot/librepilot.xml
make: *** [uavobjects_python_install] Error 2

I assume this is where I'm supposed to put the UAVObjects generated from Librepilot, but it will not let me name the file librepilot.xml. It requires the ending '.uav' I also was under the impression this would generate that file, but I guess I was wrong.
Title: Re: Python UAVTalk questions
Post by: f5soh on March 08, 2017, 06:05:22 pm
You need to build the GCS / firmware if you want a UAVO set that matches your python install.
Before starting the python _install you need at least a make uavobjects

I have just tested using Linux here, no idea if work in others OS.