Hi All,
I was recently fiddling around the code for a while and decided to create a tutorial out of it so that others may find it useful. If I would have known this knowledge long back, I am sure I would have saved a lot of time since then! I find lot of beginners getting swayed and lack of knowhow on MavLink with respect to APM/PX4. Information on internet is scattered and not much of use!!
This will be "Step by Step" entertaining, PART - I of the series I plan to write.on:
What it Covers:
- MavLink, starting from scratch. What the hell is it and understand how it works with APM/ PX4
- Learn how developers think -> Arducopter communication with Mission Planner and vice-versa.
- Get a feel of 'How Stuffs works'.
Too much hype:) Well, this information has been collated from my experience and from internet. I know there is information on the new Wiki, it tells you what, I plan to tell you 'how'! :)
Please let me know if you found it interesting. If there is enough response, I will make another tutorial where I would add more 'Step by step' knowhow!!
Options:
- More on MavLink
- Learning Arducopter source code, Step by Step
- Making swarm (multiple) copters work with your 3DR Telemetry radio! I am working on it.
See attachment for [MAVLink Tutorial for Absolute Dummies (Part –I)]
Edit: Request you to post your queries over the forum directly, as it is not possible for me to address all queries I get by email!
--
Best regards,
Shyam
Replies
Sorry dude! I meant to say "mavgenerate.py", you did the right thing. I use Linux so I have no problems, possibly there might be some package missing for Windows. Also, when you run it the GUI mavgenerate, it should be quite straightforward like (see attached).
For definitions XML file: go to mavlink/message_definitions/v1.0/ and choose ardupilotmega.xml (which includes common.xml internally - open it and see it for yourself OR choose any other XML file of your liking. From the drop down in the GUI, select the version (try to choose 2.0 as that is the latest protocol version) and the target programming language. It will autogenerate the library or headers you can include in your program.
Hope this helps!
philip cleaver said:
Answering my own problem I updated to Python 2.7.13 and ran
python -m pip install future
which worked.....
but this makes a mavlink implemtation for Node, which has a buffer type. Not exactly what I want and I still think maybe it's going to be hard to send the serial stream over the Cordova Android-JavaScript interface. Impossible maybe.
I think most of the work should be done on the Android side of things.
Any comments welcome
philip cleaver said:
Hi Shyam, thanks for answer.
I can't find PyMavlink.py, but when I run mavgenerate.py I get an error "No module named future".
I'm running windows 7 and python 2.7.8
Any help appreciated.
Giggles
Shyam Balasubramanian said:
Yes Randy. Thanks for the motivation. Working on it. Hope it would be coming soon! ;)
Randy Grinter said:
Thanks. You can simply run PyMavlink.py GUI in the ../mavlink/message_definitions/v1.0 folder to generate the destination folder + JavaScript (select v.2.0 from the dropdown) to generate Javascript (.js) file.
The generated file would be:
destination_folder/mavlink_jscript.js
Mind you, this is all you need to use in your own application. It is however a single file that contains approx. 9K lines - but is found to be stable and fine to use. Good luck!
Giggles said:
Awesome tutorial, thanks.
I want to make it easy to talk to a drone from JavaScript and making a Cordova plugin for MavLink would definitely be the way to go
Does anyone know of anything like this or a good open source project to hack?
Anyone want to help?
Great tutorial! I might try developing some sort of GCS app...
I have assembled a Pixhawk-based drone that I am targeting more at photo/video taking than racing.
I am surprised that there does not seem to be any iOS or Android-based PX4/Ardupilot GCS focused on automated photo/video taking. I am OK with starting the recording/timelapse manually before taking off and not having a live video, but I'd really love to have some Orbit/Cable Cam/POI/Follow-Me capabilities. My drone has WiFi telemetry and I guess that with a WiFi extender, range should be OK. 3DR did it in its Solo app (which I guess uses MAVLINK as well), so it should be feasible, isn't it?
Shyam,
Thank you so much for writing this tutorial!
Will there be a Part II?
Thanks again.
Best Regards,
Randy
Thank you Very much for the reply Shyam.
I'll do the same.
Shyam Balasubramanian said:
Glad you enjoyed it. Have you visited the website dev.ardupilot.com, for developers? I dont have a link to a step by step guide atm. What i would suggest is to have your code setup under a framework such as Eclipse/Visual studio and use a Console serial cable for output. Debugging the code is the best way to learn any codebase imho.
Venkatakrishnan said: