Development of a robotic platform for controller strategy testing
Why?
The goal of this project is to develop a robotic platform that will allow us to test a few control strategies and algorithms on a physical piece of hardware. If you are familiar with control theory at all, you might already know where this is headed: The infamous inverted pendulum.
There is a reason why this is such a popular problem in the world of control theory. On the surface, it looks simple enough. After all, it's just an upside-down pendulum. However, diving a little deeper into the problem, we can quickly realize that this is no simple task. The inverted pendulum is a good example of unstable equilibrium, in which a control action is required to maintain a certain position, plus, it is one of the simplest forms of non-linear dynamics, which makes it perfect as a demonstration.
After all, it seems like whenever we approach non-linear dynamics there is still a lot to be discovered and understood. At its core, this is the same problem that SpaceX engineers had to solve to land the Falcon 9 propulsively.

The hardware
Let's face it, control theory is abstract. It is in fact one of the most abstract fields of engineering.
This is, in general, a good thing. It allows us to apply the same set of techniques to solve a wide range of problems. However, it also means that it becomes quite difficult to get a good grasp of it, and it is quite easy to lose track of the ultimate goal, which is making a piece of hardware work in the way it was intended.
After working on many projects, I have realized that building the hardware it's usually relatively easy (Depending on the scale of the project) and that making something behave the way you want it to is usually the difficult part. For this project, I set out to have a bit of fun with this idea, building the simplest possible piece of hardware I can think of, yet studying a control problem that is very complex.
The system I built is a small robotic platform, consisting of only a few components:

- A couple of 12V geared DC motors (We will need the torque to achieve a good response speed)
- A motor driver board, in this case, I went with the very popular L298N on a nifty breakout board.
- A buck-boost converter to feed the logic side.
- A Teensy ++ 2.0: This is quite a powerful alternative to Arduino, featuring more IO pins, a higher resolution ADC and higher clock speeds.
- An MPU6050 IMU: This is an often underestimated IMU. Despite its low price point, it not only comes with an accelerometer and gyroscope, but it also includes a DMP (Digital Motion Processor). This is a separate processor that runs the sensor fusion algorithms that combine the gyroscope and accelerometer data locally on the MPU6050, freeing up our main microcontroller to perform other tasks.
- A 4S LiPo battery.
- A frame: The goal here was to build a frame as simple as possible. It's built combining 3D printed parts, as well as standard hardware pieces like bolts, separators, and O-rings acting as tires to increase traction (My personal favorite)
Basic control strategy
While the goal of the project is to build a hardware platform so that we can test several strategies later down the road, I think a quick overview of what we are trying to do here is in order.
In control theory, we usually work with closed-loop systems, which are represented by block diagrams such as the following:

There are a few variables in the system that are key to making this work:
- States: Once we have a mathematical model for the dynamical systems, its state variables fully capture the behavior of the system at a given point in time. You can think of it as a snapshot of the system, the necessary information that needs to be saved to recreate a certain condition. In the case of the inverted pendulum, these are the angle of the pendulum, the angular speed, and its angular acceleration.
- Outputs: These are, in general, states that we are interested in controlling. As a first example, we might only wish to control the deviation with respect to the vertical position.
- Control inputs: These are the actuators in our system. Variables we have the ability to influence using our control logic. In the case of this robotic platform, this would be the voltage sent to the motors.
We will talk more about how to actually choose a control law in future posts. As of right now we are only focused on building a hardware platform that will let us play around with the technology and explore different strategies.
