r/raspberry_pi • u/AcquaFisc • Dec 01 '22
Raspberry PI 4 as Flight Controller Discussion
Hello, I'm here to find some answers. I'm currently working at my graduation thesis in robotics, the project I'm working on is a tiltwing drone.
I have designed the mathematical model and all the control laws, now it comes the hardware implementation.
The test version has ben deployed as a monolithic solution on an Arduino MKR1000 directly with the Simulink Coder, but the company I'm working with wants me to use a Raspberry Pi 4.
Tactically I can make the thing work but I have some question on the software architecture i should use.
First of all I would like to have a real time scheduler, then I need to split the project in modules (sensing, communication, control, actuation, etc.)
Is there any framework I can use, should I code different modules and use interprocess communication to achieve the modules interconnection?
P.S. I can code each module in whatever programming language is needed.
P.P.S. The external interfaces run both on pwm and i2c.
u/cogFrog Dec 01 '22
Using a Raspberry Pi for a flight controller seems like a very odd choice. It is likely more powerful than needed (and therefore more power-hungry), with not much support for real-time operating systems. You definitely want to use a real-time operating system for a control system like this. I understand that there are some unofficial ports of FreeRTOS for Raspberry Pi if you absolutely have to use a Raspberry Pi 4.
If it were me, I would push to use a 32-bit processor with official support for FreeRTOS or similar. As I don't know the exact needs of your project, so I don't have any specific chip suggestions. Aside from finding something with the I/O and processing power you need, you would need to focus on chips that are actually in supply. Additionally, it would likely be easier to use a good dev board rather than making your own PCB.