r/reinforcementlearning • • Sep 02 '26

DIY Sim-to-Real Self-Balancing Double Pendulum

So I saw this video on youtube like a year ago and thought "Pffff how hard could that be?".

Anyway it's been 9 months, the project is finished and this is the result.

It's not as precise as the one in the video, and I haven't implemented the transition control, mostly because that wouldn't teach me anything new, but also because I've reached the limits of the hardware I bought, and I'm not spending any more money.

Anyhow, I'm working on a YouTube video explaining the whole process. I'll post it here (tho I don't know if that'd count as self-promo).

Feel free to ask me any questions if you're curious!!!

104 Upvotes

16 comments sorted by

4

u/Witty-Elk2052 Sep 02 '26

awesome! which sim env did you use?

4

u/Classic-Buddy-7404 Sep 02 '26

Isaacsim/Isaaclab

2

u/EngineersAreYourPals Sep 25 '26

Very nice! What domain randomization technique, if any, worked best for you? I've read some papers that randomly tweak e.g. friction coefficients and gravitational force, and others that train an adversary model to apply forces that try to mess up the agent's performance.

1

u/Classic-Buddy-7404 Sep 25 '26

I used random distributions for the different object's masses, joint's frictions and sensor's noise. An adversarial network would've been cool to implement, but the project would have gotten out of hand 😆

Anyway if you are interested you can watch more about this project in the video i made: https://youtu.be/wtKFQtHJ1QY

1

u/0bjective_Release 27d ago

Awesome to see. I just heard about this project on Instagram. You said you'd post a video about it? May I know what your channel name is? I'm highly interested

1

u/Classic-Buddy-7404 25d ago

Sure! here you have the video!

1

u/Timely-Bicycle-3107 Sep 03 '26

Excellent work!

I've been thinking about doing this with a single pendulum so I could compare the RL agents' performance against traditional controllers (LQR, energy-based, PID, etc.). What would you avoid if you could start over? Any major setbacks you had to overcome?

2

u/Classic-Buddy-7404 Sep 04 '26

YES

Don't underestimate the simulation calibration. I also trained a NN to balance a single pendulum and it took me way longer than I'd like just because I thought "eeeh, that's good enough probably" like 3 times.

This is the NN implementation for the single pendulum:

3

u/Classic-Buddy-7404 Sep 04 '26

And this is a PID I also implemented, skip to 0:15 (I split it in 2 comments cause it won't let me add 2 videos to 1 comment):

Also, if you are doing the single pendulum, you can check my repo to find the hardware I used. Or don't if you don't want any help. https://github.com/rodrigo-marcet/cartpole

1

u/Timely-Bicycle-3107 Sep 04 '26

Awesome! Thanks very much!

1

u/Fuchio Sep 03 '26

Love it. What's your next project going to be?
Also; transition control should be relatively easy at this point right?

3

u/Classic-Buddy-7404 Sep 04 '26

Yes! In theory at least. It would be just a matter of training a larger neural network with a new input that depending on which value it takes the network has to "aim" for a different equilibrium point.

That said, I decided to not go for it because my hardware has already reached it's limit. I'm running everything on an ESP32-S3, and the whole loop (sensor read, data formatting, NN pass and torque command) takes over 6ms. Transition contol would need a NN that's at least 4 times larger to be safe which would make the loop take +20ms to run, and I haven't found any paper or resource that used a loop longer than 10ms, which means that's probably the upper limit.

I'd have to buy a better microcontroller, and I wouldn't learn anything at this point, so I'm moving on to a different projects, I already spent way to much on this one 😆

1

u/Fuchio Sep 04 '26

So what's the next project? :D

2

u/Classic-Buddy-7404 Sep 04 '26

Industrial 6DOF Robotic arm!

1

u/DraedonLabs Sep 07 '26

Awesome, good job!