daniel-p-sullivan / Inverted-Pendulum

An inverted pendulum project for learning about control theory.
GNU General Public License v3.0
5 stars 0 forks source link

PID controller and future work #2

Open eleftheria15 opened 2 years ago

eleftheria15 commented 2 years ago

Hi Daniel,

Thanks for this project. I replicated your setup, and it really served me well as a base for my project extension.

Instead of Arduino Uno, I've used an ARM-based processor, namely Raspberry Pi 3 Model B

I plan to switch between PID and LQR (eventually MPC) inside the event loop during run-time after a certain pre-specified periodicity.

However, it seems that PID is not able to work properly (in my setup) as the only angle (not position) is taken into account.

Can you let me know whether you've tested the PID controller in your setup?

Also, are there any updates regarding the swing-up problem and MPC optimization?

daniel-p-sullivan commented 2 years ago

Hi Aleksandar,

Glad you like the project! I still need to work on mine more - I started a quadcopter flight control project and haven’t returned to this one.

As far as I remember the PID controller is able to work properly. How is yours malfunctioning? Maybe the gains are tuned improperly. I will test this in my setup soon and let you know.

In regards to your comment on: “ only angle (not position) is taken into account.” Could you expand on this? In my setup (and in the current GitHub code) the position of the cart is measured/estimated via a rotary encoder input.

Best regards,

Daniel Sullivan

On Tue, Aug 23, 2022 at 8:54 AM Aleksandar Matovic @.***> wrote:

Hi Daniel,

Thanks for this project. I replicated your setup, and it really served me well as a base for my project extension.

Instead of Arduino Uno, I've used an ARM-based processor, namely Raspberry Pi 3 Model B

I plan to switch between PID and LQR (eventually MPC) inside the event loop during run-time after a certain pre-specified periodicity.

However, it seems that PID is not able to work properly (in my setup) as the only angle (not position) is taken into account.

Can you let me know whether you've tested the PID controller in your setup?

Also, are there any updates regarding the swing-up problem and MPC optimization?

— Reply to this email directly, view it on GitHub https://github.com/daniel-p-sullivan/Inverted-Pendulum/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGGPDWZWCXGUTQ22I2HX5ALV2TX2XANCNFSM57MBHKAQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

daniel-p-sullivan commented 2 years ago

Sorry - I forgot to mention that the PID controller only used the angle to determine motor output - the position should be uncontrolled (this may have been what you were getting at with your comment)

eleftheria15 commented 2 years ago

Yes, I meant that position is left uncontrollable and that you can probably design PID in such a way that it's taking position into account, as I assume this would provide better stability. This is something that I was thinking it's making stability issues.

However, if you say it works in your setup, I will go back to Arduino Uno and double-check with modified gains.

Also, the gains are different in my Raspberry Pi setup, as it is much more powerful, so you need a sleep time after each iteration. I'll make the pull request to upload the RPi code here.

I assume the video in the repo was made using LQR as a control technique. It would be great if you could confirm that PID is working in your setup so that I can be sure that hardware is the problem in mine.

Bests, Aleksandar

daniel-p-sullivan commented 1 year ago

Hi Aleksandar Sorry for taking awhile to get back to you. PID is working in my setup - the pendulum is balanced upright, but cannot maintain a position on the track. LQR does maintain the cart position and pendulum angle though.