I have a quick question on sending waypoints through the APM planner. I am working on a project using OpenCV to do live video analysis of FPV feeds in order to look for "targets" for a competition, i.e. post-processing the video on a computer and determining course of action from the results. From there, I have to modify the flight plan in-flight to acquire the next target, retreive data, such as the GPS data at the point where the plane identified the target, from the planner, and print the data out to a txt document. My question is; is there any way I can retrieve this data from the planner and send waypoints through the planner, such as an API? I would like to keep the APM planner in the loop, as it works really well, and I would rather not cut it out. I know I COULD make my own custom program/gui that gets the data I need over serial, but if I can avoid it, please, let me know. Does anyone know of a way to get the values out of the planner that I need, and a way to pass waypoints to the plane through the planner? I really only want to interface the video-processing program and the planner, basically just to send commands and get values. Let me know what you think I should do! Thanks!
In light of the results we found on the rest of the conversation, how can I query the values, such as the altitude, GPS coordinates, and heading, from the UDP port? Could it basically be used as an API to retrieve values? Thanks!
the easiest way would be to create a python script that can interface to the cs.????? interface in the planner.
any item on the status tab in the planner can be access via the cs.????? ie cs.alt... etc
python > udp listener
custom udp commands > cs.alt or Script.GetParam("PARAMNAME").
I'm not quite sure exactly what you mean by cs...
Ahhh, that makes much more sense. Do the scripts run on the computer or the board? Assuming the openCV program was written in Python, could I just run the program as a script and directly get the values, or do I have to forward them still?
the mp uses iron python, so i dont know if opencv plays nicerly with that or not.
Apparently, it doesn't. So I'm basically using the python script as an API to make values available to my main OpenCV program through UDP?
Thank you all very much! I took a break from this project over spring break, and just returned to it, and getting the values out of the planner through a python UDP script works perfectly :) Just make sure you use python 2.7.3, not 3.0 or higher. I had some problems with the newer versions not working right. Thanks again, I'll keep you posted on how it goes!!!
I'm having an annoying problem with the values that get returned from the planner loosing precision by 2-3 places. I tested the UDP separately, and the values came back correctly, but coming from the planner, they don't quite show up right, which causes a 300-1000 foot problem with GPS lat and lng. Any Idea why? Also, is there any way I can open up a terminal to see the printed values from the python script running on the planner? I would like to see if it just doesn't convert correctly on IronPython before it sends....... Thanks!
I am actually working on controlling multiple UAVs from a third program through multiple instances of mission planner and I need to get the GPS coordinates of all the airplanes. This method seems very promising. I will let you know if I get it to work. If you can post the scripts I'll take a look to see if I can help.
in the mp press control-f
look at the 2nd mav button and swarm button. NOTE this is very alpha code
Hope you get it working! Any Idea why I'm losing precision?