In order to get the best possible performance out of the balance controller, great care must be taken to ensure that the control loop operates at as close to a fixed 200 Hz loop rate as possible. From a write-up Jackie Kay (Open Source Robotics Foundation) contributed on real-time computing in ROS2:
A real-time computer system needs both an operating system that operates in real-time and user code that delivers deterministic execution. Neither deterministic user code on a non-real-time operating system or nondeterministic code on a real-time operating system will result in real-time performance.
The whole write-up is great and can be found here. All that to say, when your system needs real-time performance, it needs it. Bobble-Bot provides a safe way to learn more about this classification of systems at low cost. This is not an easy feat because typical real-time controller implementations are heavily proprietary. The whole subject is both fascinating and practical. We are passionate about sharing our experience here with the larger open-source community, and Bobble-Bot is a great platform for doing that.
Enough background, let's look at some examples.
Here's What Non Real-Time Control Looks Like
The performance is not good. If you look around on the internet you will find many examples of self-balancing hobby robots with performance that's along these lines. Keep in mind, this is the best we were able to get the non real-time Bobble-Bot to perform after many hours of tuning. The bottom line: non deterministic loop jitter (delay) kills performance in a system like this one. When you need real-time execution, you need it.
Here's What Real-Time Control Looks Like
In the video below, you are viewing one afternoon's worth of balance control tuning by James and Mike. The difference in performance between non real-time and real-time control is night and day. Watch to the end... it gets better and better.
Since the day these videos were recorded, we have continued to make performance improvements that enable the Bobble-Bot to do ramps and different surfaces like a pro! This would not be possible without the switch to real-time.
If you want real-time, why not just use a micro-controller?
Having a full Linux OS running ROS makes working with the robot so much easier and more accessible. Being able to wirelessly ssh into the system and poke around is what makes the learning enjoyable. Additionally, ROS has a huge ecosystem of packages that makes it very easy to extend Bobble-Bot's capabilities without having to reinvent the wheel.