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!

Views: 3663

Reply to This

Replies to This Discussion

apm planner support a very simple guided mode function mode via www.


this will send a guided mode wp to the connected mav.

Thank you! Can you explain a little more about how this works and how to implement this into code? Also, any idea how to get the GPS values?

Also, I'm assuming that point is just set as the next waypoint on the list, correct? So, if I wanted to build an entirely new plan after the current waypoint I'm on, I will need to build the waypoint instruction list from landing backwards, correct? Is there any way I can erase the waypoints I have preset after the current one, like canceling a pre-loaded grid set of instructions that found the first target? Thank you so much for your help!

Michael has given you a url that would direct the Mission Planner to send a guided waypoint.  All you need to do is do a http get request from your application to that address, and mission planner will do the hard work.  (REad more about the www interface here: https://code.google.com/p/ardupilot-mega/wiki/Xplane )

A guided waypoint will set your Ardu* into guided mode, and it will go directly to that location, and then loiter.  It does not add in a new intermediate waypoint.

Getting the Lat/Lon of the desired waypoint sounds like an interesting problem... since you are using opencv to search for targets in the video feed, I assume you will need to do some testing and triangulation based on elevation, current heading and location.  

Maybe someone else is using this approach for object avoidance?  It would be great to have this function on the autopilot itself...hopefully it is in the long-range plans.  

Thank you! The targets are on the ground, so I basically will just place the camera facing down, start with a standard grid-search, then once the ground station finds a target, it takes the GPS data from the plane and prints it out... thought of the trig method, it's quite do-able, but I'm just slightly too short on time to do that...at least for this year's competition :) So, the command basically overrides the pre-set flightplan? I'm assuming I can pass a landing command and basically run the entire flight from the ground. Does this also mean that I can't load multiple waypoints at once using this method? That might cause small problems, like with setting up to land. Thanks for your help!

I'm not quite sure what you are trying to accomplish, but I would set the landing pattern as your "Mission" and use the guided waypoint for navigation while in the air.  When you're done with navigating, set the mode to auto so it will fly the pattern and land.  Guided mode is a basic "point and click" navigation mode.

Ahhhh ok. That was the link I was missing, I mistook them to be the same thing. So, in theory, I could have a flightplan with a takeoff, searchgrid, and a land, and when the video processing picks up a target, I can send a guided command to send the plane where it needs to go. The only reason I'm not just using a pre-loaded grid is because I need to detect targets from different altitudes, so I need to change the altitude after I find specific targets. After all the targets are found, is it possible to send a command to "jump" to the waypoint that starts the landing, then have the autopilot just resume the flightplan from there?

Is it possible I can pull the GPS values live from the log files? Just specify the log file, live-convert it into text, and decode the syntax to get the values live? It would be ungodly inefficient. Is it at least possible to do this, so if I used a standard, pre-loaded flightpattern, I could get the values by comparing time stamps after the log has ended? 

I assume this is possible, but I can't find any documentation for commands sent to Mission Planner over www.  (Michael Oborne is the developer of Mission Planner, so maybe he will tell you if that command is possible).  

You are basically looking for a "Set current waypoint" command, and "set mode" to auto command.

Basically. My biggest priority currently is getting the data from the plane. I can lose the points for not changing altitude by using a pre-loaded flightplan if I need to, but if I don't get the GPS data from the plane to mark the targets, it defeats the purpose of the entire competition. 

Edit: I just looked into the txt idea. The planner has a converter I could use after a flight, but I'm going to need a better computer..... I tried to load up a 5 minute flight file in notepad, and it crashed notepad instantly. With a 25 minute flight, I'm not sure how well it will work. but the log has timestamps based on the computer's clock, so I could crossreference the time the video processing program picked up the target with the ardupilot log and get the well-labeled data from it. Then I would use screenshots of when it found the target, do some trig, something along those lines, to find the gps position of the target. I know it's not exactly live detection, but at least I have a basic something that should work. Thank you guys very much for your help! I'm still looking for a way to do this live, without having to extract the values from a log file, so if you think of something , let me know! Thank you again!

That should work, but I would suggest trying to reverse engineer the simulation tcp/udp connection. Mission Planner sends live lat/lon updates to XPlane, so you should be able to pull the data from this serial stream.

You should also check out Mission Planner scripting, you may be able to use that interface:

Time to roll up your sleeves!

Ahhh, didn't think of that! I have an entire campus of programmers and engineers that should be able to help me with that, but I'm sure I'll have more questions :) Thank you very much for your help!

Reply to Discussion


© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service