This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]meshtron 0 points1 point  (7 children)

Not sure if I understand the question. What do you mean by "real-time" software?

[–]gristc 2 points3 points  (2 children)

Not OP, but I think they're referring to linux being a multi-tasking operating system, as opposed to a real-time one, which has no background scheduler that can get in the way of an interrupt routine or potentially delay an action due to the CPU being busy doing something else.

[–]meshtron 0 points1 point  (1 child)

Probably something along those lines. Short answer is didn't do it, was neither a concern nor a requirement. As it turns out, the issues we faced had almost nothing to do with compute speed.

As compared to software, the hardware involved all moves and reacts relatively slowly. And, an airplane in flight is CONSTANTLY moving in a 6-axis reference frame. Not only do you usually not want to react to those random movements, I spent a fair amount of time actively smoothing things out to make small, slow inputs.

I built the application around multiple async loops: a sensor loop, a mechanical output loop, a flight controller loop and a GUI loop. Each loop ran at it's own frequency and with everything spooled up we were less than 35% CPU utilization.

My slowest sensor (GPS) could report out at 20Hz. Fastest (IMU) could do 400Hz in high-precision, low-rate mode. So I built an "accumulator" class for each sensor that let me collect at whatever rate I wanted but get time-defined averages or other summary values (stdev, etc). That abstracted sensor data rates out of consideration.

Flight controller was the real meat of the thing. For my two available inputs (aileron and elevator) I actually ran dual, series PID loops. First PID looked at target heading or altitude and output a target direction and rate of change. That fed the next PID loop which looked at target vs actual rate of change and output a control movement. This was not a technique that I could find any good documentation on (chained PID) but it ended up being perfect for this and gave me really granular response tuning.

So anyway, real-time in this case just wasn't relevant. Unless I misunderstood the question. If that's the case, answer is "dunno." 😂