I used the cart and pendulum models to update a pendulum simulation program I developed long before I started building the pendulum. I changed the equations to use PWM instead of force, and modified the control algorithms to match.
The simulation works pretty well. I can swing up the pendulum pretty quickly and maintain the inverted pendulum. I am not going to share any of my algorithms at this point since I plan on running a competition to design the best algorithm. Wouldn’t want to make it too easy, would I?
I will share that I started with PID algorithms to maintain the inverted pendulum, but there was a lot of wobble. The pendulum would sway back and forth several times before settling into the correct position. I switched to state space control, and it works much better. The pendulum immediately moves to the right place with no sway or wobble. It is the control method I would recommend. I am still learning how to optimize the method, though.
Now I just need to verify my models by collecting some more data from the actual system, then I will try my pendulum inversion algorithm on the actual system.