Week 6: Introducing Imperfections
May 6, 2026
Last time, we successfully balanced the pendulum, provided a swing-up mechanism, and implemented LQI to make it robust to imperfections. Right now, the pendulum operates in ideal conditions: a perfectly flat surface, zero friction, and drag. However, in the real world, conditions aren’t perfect, the table could have a slight lean, and for sure, there will be friction between the rail and the cart. Today, we are going to start bridging the sim-to-real gap by converting our ideal feedback system without delays and buffers into something more realistic, where the motor can’t generate infinite force, and the encoder returns discrete values instead of a continuous function. After this, we are going to put the simulation to the test, to determine the absolute worst scenarios it can perform in.
The first step is to completely revamp the Simscape model. Right now, the controller returns Newtons directly to the joint; this is clearly not what happens in real life. That’s why redesigning the system to be controlled by voltage is necessary. Luckily, because I know the specific mechanism that is going to drive the cart, a timing belt system, we can directly convert from Newtons into Volts. The voltage applied to a motor produces torque, which is related to force by the pulley’s radius. I already bought the pulleys I’m going to use, so the equivalent force on the cart can be easily calculated. While this is the main gist, there are specific factors like back EMF and such that slightly complicate the conversion, and those have to be accounted for.
Now the Simscape looks like this.

Functionally, it is identical to the previous iteration. Mechanically, the system now sees itself operating the prismatic joint using gears controlled through the voltage provided to a motor.
The main imperfection I wanted to test is table slant, how much the track can tilt before the pendulum stops working.
To do this, I set the initial position of the rod to be perfectly upright and gradually changed the angle of the track to measure its influence on the system, specifically the time it takes for the Integral term to kick in and realize the slanted surface and push the cart back towards the center (+- 1 cm).
The following are the results I got

The limit of testing is 3 degrees because beyond that, the pendulum doesn’t restore fast enough with the tuning that I’m using. This tells us that the real pendulum will likely survive a table slant of up to 3 degrees. Considering how tables are relatively level, this is quite a lenient system.
With this done, the next step is to put together the actual pendulum and rigorously tune it to make it work. Tune in next week to check on progress.

Leave a Reply
You must be logged in to post a comment.