At the moment I am home for Easter so I cant work on the physical parts of the project. Nevertheless, I used a little spare time to think about the control system for the inverted pendulum. I started off by constructing the equations of motion for the pendulum using Mathematica and transfering them to XCos my first atempt while somewhat asthetically pleasing took far to long to implement:
Also I wanted to keep the process more open so I opted out of Mathematica and instead wrote a small Python script that uses the sympy library to construct the equations of motion using Lagrangian mechanics and generates the code to be directly dumped into a XCos Scilab function block. And TADDA it swings:

Then I refreshed my controll theorey memories with this awesome tutorial: https://www.youtube.com/watch?v=M_jchYsTZvM and implemented linearization and poleplacement for the controll loop in the same Python script: https://cdn.hackaday.io/files/1647527048749568/inverted_pendulum_controll.py
With that in place I was able to run the first simulation of the inverted pendulum in the upright position:

In the beginning the pendulum recovers from beeing in a slightly of vertical angle. Afterwards it performs a controlled movement of the Wagon on which it is mounted forward and backwards.

I am really looking forward to implement this in real life! :-)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.