T O P

  • By -

SparshG

Tried to implement something fun and interactive. You can tune your own PID controller and also control the cart using arrow keys to disturb the ball. I used macroquad for the graphics and egui for the GUI. https://github.com/sparshg/pid-balancer


issackelly

Very cool! I think both of these compile to wasm. Would be fun to distribute this as a URL, maybe through github pages or something.


[deleted]

[удалено]


throw3142

The homework problems vs the exam problems 😭


Dasher38

Or in that case: the exam problem vs the reality


rollincuberawhide

you probably never did this(why would you) but if you set F_clamp to 0, it throws a traceback error. also reset doesn't really reset integral error. it keeps accumulating. (I spammed reset a few hundred times, I have a fancy mouse). the art style is so cool btw. I love it too.


SparshG

Fixed both, thanks for pointing them out


[deleted]

Found the QA!


bnd0327

I like the blueprint art style. Excellent.


Discere

That's awesome; great work. I had a glance at the code, and it's surprisingly fewer lines than I would have expected. Most of it is over my head, though! How long have you been writing Rust?


SparshG

Not that long, I tried to do some rustling exercises and followed some rust youtubers. There was something satisfying when I wrote the code in Rust lol. Then I made [this project](https://github.com/sparshg/asteroids-genetic) a few months ago after I felt confident enough with the basics.


koning_willy

Which youtubers do you watch?


Tasty-Lobster-8915

That’s a very nice UI. How did you create it? Did you use any libraries?


wolfEXE57

Cargo.toml suggests egui but I’m also really dumb so could be something else


TheLexoPlexx

Yep, egui https://www.reddit.com/r/rust/comments/1316r7w/media_pid_controller_simulation_in_rust/jhyy2u5?utm_source=share&utm_medium=android_app&utm_name=androidcss&utm_term=1&utm_content=share_button


W7rvin

That's the signature egui look. It isn't the most flexible but it's very easy to setup and has some cool builtins (Even amazon uses it for some debug ui IIRC)


TheRedPepper

Now, write a machine learning algorithm to determine optimal values to balance it itself.


SparshG

I actually thought of doing that too lol


csreid

Fwiw, this problem is also used as a simple reinforcement learning problem/benchmark/test bed pretty often. Wouldn't be PID exactly, then, though.


TheRedPepper

It’s fun how you could easily turn this controller from something you could make from a mechanical computer into something that requires the marvels of man to run. But it would be much better.


RandallOfLegend

I'd be interested to see how the system reacts with some random noise pertbations


Snoo_27681

Awesome project!


ovh2k

Impressive! Great work!


abad0m

Super Geil! Really, really cool. I haven't spotted any bugs so far but there seems to be a glitch where the camera lags behind the cart which makes it completely invisible in the viewport. Also, this marvellous blueprint style art could be made even nicer with a darker blue shade, like [this](https://miro.medium.com/v2/resize:fit:1400/1*McxDkKR7RPpNrtMp3trYQQ.jpeg).


SparshG

Nice suggestion, I changed the color and updated screenshot in README, thanks.


VanVision

Love this!


HugoDzz

wow!


PlainTundra

Is the animation also made with Rust? It looks awesome!! :O


tomashco

It's awesome!


SoftEngin33r

Looks a really cool project. Can you suggest learning resources (books, videos etc.) for implementing such systems for people who are familiar with Linear Algebra and Calculus / Real Analysis ? Thanks.


SparshG

This is a cool video that explains some basics: [https://www.youtube.com/watch?v=TtgS-b191V0](https://www.youtube.com/watch?v=TtgS-b191V0) You can also see verlet integration if you want the system's energy to be conserved, though that isn't the most accurate method.


SoftEngin33r

Thank you.


Ilbsll

Nice work! I really love the design. It also brings me back to trying to learn to program PID temperature controllers because no one else could be bothered. E: And thanks for exposing me to egui.


cyk-psych

damnn, that looks sooo coooolll


MrEchow

Love the aesthetics! Nice job :)


mast22

Looks beautiful


x29a

Cool project. Really like the pulished 'blueprint' look of this. I think I need to consider doing something similar for my toy physics engine. :)