3 ms·
Looks very nice. Is Linux actually real-time enough to run autopilot code?
by Jeandon 12y ago
Looks very nice. Is Linux actually real-time enough to run autopilot code?
- klinquist 12y agoTypically, APM/MavLink runs on a Arduino (my Quanum CX-20 quad runs an Mega 2650). This looks like this is a Raspberry Pi shield that I suspect contains an ATmega - so it's not Linux that is doing the flight controlling.
- ivereninov 12y agoActually we run APM code ported to Linux, there is no Atmega on the board. There was a lot done to make this possible including special real-time Raspbian. It flies very stable and with great timing performance.
- klinquist 12y agoVery interesting, thanks!
- CHY872 12y agoPossibly not. It seems that this runs APM, which is an open source autopilot system. On their install pages, the Raspberry Pi is listed as a companion computer (presumably to be hooked to some other device that runs the code) (which this system might not do) but the Beaglebone Black (which I guess is similar to the Raspberry Pi, so might be what they do here) requires installation of realtime patches for Linux. This works by patching the Linux kernel to make almost all of it preemptable, (replacing spinlocks with mutexes) so interrupts can be acted on more quickly.
- ivereninov 12y agoWe run APM on Linux. The port to Raspberry Pi is our effort and it is now supported in APM upstream.
- 3327 12y agowhat is the % impact on endurance?
- VereninovIgor 12y agoRaspberry Pi A+ with Navio+ consumes about 200mA. Compared to running motors this is almost nothing.
- pjc50 12y agoIt's fast enough in almost all cases to work. "Realtime" is more about proving worst-case bounds on all control loops.
- lovelearning 12y agoThey are using a realtime patch on Raspbian. [1] They also say "autopilot’s code works directly on Raspberry Pi using the APM’s Linux HAL". [2] [1]: http://www.emlid.com/raspberry-pi-real-time-kernel/ http://www.emlid.com/raspberry-pi-real-time-kernel/ [2]: http://www.emlid.com/navio-apm/ http://www.emlid.com/navio-apm/
- asynchronous13 12y agoYes. Linux is plenty fast to run autopilot code. There are real-time patches for Linux kernel, but in my experience those are not necessary for decent performance.
- valarauca1 12y agoA true real time system is likely over kill. General time-sharing systems generally are accuracy to +/- 4ms. Which is acceptable for most applications, as 60fps is ~16ms per frame. If you (ab)use Linux properly you can get most your threads to only halt on blocking for IO. So they'll get scheduled practically (not always) once that IO state is satisfied. This requires heavy multi-threading not horrible, just isn't amazingly optimized for cache. I control high pressure fuel systems and we don't need to use Real Time OS's (always), and generally sigh away from them when I don't.
- lsaferite 12y agoI would guess the PID loop benefits greatly from real-time execution. So much so that really the base control system should be on a dedicated controller with AP functionality as a secondary system driving the inputs to the PID controller.
- valarauca1 12y agoIt really depends what you are controlling. With a PID loop generally more accurate timing is the battle cry for moving them off board. As implementing a PID in a time-shared OS is rough as you don't get timing guarantees. So your Delta-T is always off. Generally by a margin of 1% which is large enough to throw off a correctly tuned system. Faster updates are nice, but not always needed.
- MegaDeKay 12y agoThe second PDF in the link below compares the Raspberry Pi with the Beaglebone Black for a next gen APM. The nod went the the Beaglebone because of more GPIO, PWM support, and the two PRUs for realtime operation. The Pi B+ helps the first point, but not the other two. There is also a really interesting page in here on the latencies that are required. BTW, this was written by Andrew Tridgell of Samba fame. http://diydrones.com/profiles/blogs/a-peek-into-the-future-of-ardupilot http://diydrones.com/profiles/blogs/a-peek-into-the-future-o...
- 2bluesc 12y agoThanks for this. Whenever I see people running around high fiving over the Raspberry Pi, I start to formulate an argument how the BBB would almost always be vastly superior for slightly more cost.
- mavkhimenia 12y agoThere a lot of boards that outperform BBB 10-20-30x times. But both RPi and BBB are more than enough to run an autopilot code. One of the great advantages of RPi over BBB is 1080p camera module with hardware H264 encoder as well as bigger community.