I currently have an APM 2.6 that is set up with Windows Mission Planner. From this I am able to use a python script that can print
status variables from the telemetry data sent by the APM that is displayed in Mission Planner.
However, I am also trying to implement a flood-fill algorithm using python. Basically, from the appropriate GPS data, I
want the script to be able to realize which GPS coordinates my rover has visited and set waypoints to coordinates not yet visited.
To not get bogged down in the details of my situation - I will need additional sensors connected to the APM to accomplish flood fill, but because it will probably overload the processing power of the APM, these sensors are hooked up to an Arduino, which sends serial data to a Raspberry Pi.
My question from this is, am I able to send these serial data from the Pi to the APM, which can then be transmitted together with the telemetry data that is displayed on Mission Planner?
I am serving as a programmer for my college robotics team, so I do not have much understanding of the electronics side of things, so it will help if explanations are in simple electronics terms.
Other than that, thank you all for who will be trying to help!
Below is additional details on what our team is working on if it applies to answering this question:
We are participating in a rescue robotics competition whose goal is to have a rover that can read QR codes from buckets in a grass field.
As of now, our problem is with trying to implement flood-fill that can automate our rover completely. The idea is that we place the rover in the zone of operation, and with the algorithm, visit areas that are not yet marked as visited. These areas will be divided by GPS coordinate grids, and each coordinate grid might or might not have several QR buckets that need reading.
The APM has GPS coordinates which the python script can use to implement part of the flood-fill, but to truly know if a ‘grid’ has been visited to be marked as ‘filled’, we need to know if all the QR buckets that have been detected in the grid have been read.
We have additional sensors that have been programmed to detect QR buckets and read them. However, this is not in sync with the APM. Essentially, this means that even if all the QR buckets have been read in a GPS ‘grid’, APM and (hence,) Mission Planner’s python script doesn’t know that a grid has been ‘filled’ and the python script would not know when to mark a grid as visited. This is where the Raspberry Pi needs to be able to send serial data to APM, and the APM needs to be able to send this data to the Mission Planner.
I’d suggest that since you need to inject the additional data in, you look at having the APM send the telemetry data to the Pi, and have the telemetry radio connected to the Pi.
So it would go like this:
APM2.X -> Telemetry cable to Pi
PI -> Ground Station (GCS)
On the Pi you’ll run MAVProxy. You’ll also have it running a PPP script to either make or accept a PPP over serial connection. You’ll also need to add the Telemetry radio to the Pi with a FTDI or serial to USB connector. Get the Pi to then send it’s data over UDP. MAVProxy will also use UDP to send the telemetry data to MP.
On the GCS PC, you’ll run the opposite PPP script (eg: if the Pi connects this will be set to receive). Connect to the APM/Pixhawk via UDP instead of a serial connection.
Note that I’ve found that at 64Kbps I only get about 2-4 KBps of usable speed. I also find that TCP is really unreliable due to dropouts, so stick to UDP. Do some reading on PPP connections over serial, if you are unfamiliar with it, it could take you some time to work it out. Cool thing with this option is you can SSH (yes know it’s over TCP - it’s slow but it works - suggest you look at screen to keep the session going) into it and do stuff on the Pi while it’s in flight (as long as you have a telemetry connection).
There used to be a good page on the ardupilot site but it’s showing more turnkey solutions instead now…
Otherwise you’d need to get the Pi to output the data into some form of MAVLink message and then you’d need to modify the firmware to take it in and add it to the payload.