Controlling Drone from Raspberry Pi Zero W with UART

Post here to get support
Post Reply
Posts: 2
Joined: Tue Aug 13, 2019 9:28 pm

Controlling Drone from Raspberry Pi Zero W with UART

Post by gregwilburn »


I am a bit of a novice to C and Python and have been running into problems trying to command the Crazyflie 2.1 by a Raspberry Pi Zero W. For a bit of a background on my project, I am developing a simple model to test hopping algorithms for a robot. At first the model is simple, with just the drone for hopping, the Pi as the main computer, a stereo camera to provide depth mapping, and a battery to power everything. This is all housed in a balsa chassis and is semi autonomous. The camera provides a depth map, and the Pi decides a location of interest to hop to.

The relevant portion is how to actually communicate between the Pi and Crazyflie. The USB port on the Pi is used by the camera, and I am using the Flow v2 deck which leaves me with UART. I do not want to use a USB splitter because it would likely put me over the mass budget. The Flow would provide some degree of positioning to know if we hit the target, which would be up to a few meters of hopping.

I have seen some examples on the forum explaining some of the procedures, such as:
  • Modifying comm.c to use UART instead of radio
  • Implementing a framing protocol for use with CRTP
  • Making sure baud rates are consistent
What I am struggling with is how the existing code all connects together and where to actually start my program. For example, is there much I have to modify in the firmware? From previous posts about using a Raspberry Pi Zero W as a controller, there was not a working UART link but that does not appear to be the case. And how do I go from sending data over UART to interfacing with the Python library to use existing controllers like sending set points.

Thanks for any hep you can give. I'm happy to provide more info if you need.

Edit: I guess I am also struggling with the architecture of the programming in general. Is there a good reference for the architecture of CFLib or the firmware? It would help with my understanding of the flow of how the files work together.
Post Reply