OpenCV Causing EKF/GPS/Velocity Issues

Hello,
I’m currently working on doing image processing on my pixhawk/pi drone, but everytime python would request the camera through openCV, the drone’s sensors would go erratic and refuse to fly normally. I’m using dronekit-python to connect to the drone. There are two videos attached if it helps clarify.

https://drive.google.com/file/d/1-Vgf7NTPKhixxGB1DyZWaouh4kHjp-mv/view?usp=sharing

https://drive.google.com/file/d/1xpo41AVyqzWK4ovyh5uqDvMzN3ZGl8-S/view?usp=sharing

I’m not sure what is causing this, is it a voltage issue? I know the raspberry pi draws a considerable amount of power to maintan 3 fps, but I don’t see why the power module cant deliver a stable voltage to the pixhawk.

Thanks so much

Can you post a tlog? It’ll help narrow down the issue.

Initial guess is maybe some sort of EMI from the Pi/Camera into the GPS.

EDIT:
Also, get a better power supply for the Pi, the “low voltage” warning mean that Pi’s power supply is not stable.

1 Like

Heres a tlog from the day before with more data (same gps glitch, compass failures). The logs of the video weren’t recorded but started 2 minutes later at 9:59, so I think theres only one error in that log

Nov 16: https://drive.google.com/file/d/19O8Oc6oLb7wg9zt2JgclOXYY6QS1ZI47/view?usp=sharing

Nov 17: https://drive.google.com/file/d/1xXSQw_C41sNeEUE-N9K_XAkduDYDhEKq/view?usp=sharing

I’m powering the Pi with the serial 1 port from the pixhawk connected to the GPIO pins, would I need an actual power bank in the air along with the battery, or something like a UBEC?

Thanks for the help

Do not power your Pi via your Flight Controller, it is a big mistake to do this, you can cause a brownout on your system.

Buy a great quality BEC with the correct ammout of power you need and power them externaly (both your Rasp Pi and other payloads as cameras etc).

1 Like

How is the camera connected to the Raspberry Pi? USB3 in particular causes horrendous GPS interference, especially on smaller drones.

The camera is connected via the camera port on the Pi board.

I think I temporarily fixed the issue by positioning the GPS further away from the electric components. Most of the EKF variance worsened as I moved the GPS closer to the pixhawk, and didn’t really change when I placed it close to the camera. Thanks for all the help everyone

Here’s a plot of one of the GPS failures:

I wasn’t able to narrow down a particular cause, but going by your comments above, it does really sounds like an EMI issue.

What model of GPS and Pixhawk are you using?

I’m using the bn-880 gps module on a Pixhawk 2.4.8

thanks yeah that probably was the problem as my GPS mount broke so I attached it to the pixhawk’s surface thinking there wouldn’t be a problem. Thankfully there wasn’t an issue in loiter mode or the drone would have crashed many times on me.

I’ll try running the script sometime soon again and see if it raises any more issues, but for now I think its fixed, thanks for all your help