Volatile Int logo

Volatile Int

Archives
Subscribe
December 1, 2025

Implementing a Framework for Closed-Loop Control Algorithms in Modern C++

There’s a common misconception that modern C++ abstractions don’t belong in embedded and high-performance systems. In practice, the opposite is true—newer language features make embedded code safer, faster, and easier to reason about.

In my latest article, I walk through building a small framework for defining and executing closed-loop controllers using:
- template concepts to enforce consistent controller design (without inheritance)
- separate entities for control laws and hardware interfaces to ensure components are independently testable
- std::expected for explicit, lightweight error handling
- NTTP lambdas for compile-time configuration and readable diagnostics
- smaller and faster binaries than an equivalent “C-style” implementation.

The article also links to a single-header GitHub repo with the framework and a few example simulated controllers, plus a number of suggested exercises if you want to extend it or drop it into your own project. Check it out, and let me know what you think!

https://www.volatileint.dev/posts/feedback-controller/
Don't miss what's next. Subscribe to Volatile Int:
Powered by Buttondown, the easiest way to start and grow your newsletter.