Live dream
A simulated Swing Kid, running the brain as it is right now.
A simulated Swing Kid, running the brain as it is right now.
12 of the 64 swings it practices on at once, each built a little differently, running the brain with its exploration noise on. The pink ticks show the height each one is asked for.
Lines are connections (blue negative, red positive, thicker is stronger). Circles light up as neurons fire for the live dream. The output is where the legs go.
At 100% every practice run gets a different string length, box weight, feet, servo strength, drag and gyro drift. Slide it to 0 and the brain only ever practices on one perfect swing.
How far the swing's height is from the height asked for, averaged over 6 test swings with the brain's experimenting switched off. Lower is better. The dashed line is the textbook pumping rule on the same 6 swings.
Every point is a moment in a swing: how far out it is (left–right) and how fast it's moving (up–down). A steady swing traces a circle, and a bigger circle is a higher swing; the dashed circle is the height asked for. Color is where the brain puts its legs. The dark line is the live dream.
| Brain | Textbook rule |
|---|
Each square is one byte. The trained network's 401 numbers are squeezed to one byte each (one scale per layer), plus a header and a checksum the robot verifies before it trusts a new brain. The exam grades this squeezed copy, exactly as the Arduino will run it.
It can dream, run exams and drive a virtual Swing Kid, but this browser or this page can't talk to a USB device. In Chrome or Edge, open michaellomuscio.github.io/swing-kid/gym, or double-click Swing Kid Gym.command in the swing-kid folder to run it from your Mac.
Plug the Arduino into your Mac with the USB cable, then pick its port (usually called usbmodem or usbserial).
The program that runs on the Arduino. Install it once; after that, brains travel over the same cable without reinstalling anything.
Before the legs are on, the servo horn should turn when you press the leg buttons. If the face is sideways or mirrored, press Rotate face until it looks right.
Do this before you zip-tie the legs on. Swing Kid holds its servo exactly in the middle; push the horn onto the shaft so the stick hangs straight down.
Hang it still (steady the box with a hand, then let go), and start. Swing Kid holds still, kicks a few times, swings freely, then pumps itself up and brakes. About 40 seconds.
| Real swing | Fitted dream |
|---|
On the robot now: –
What Swing Kid feels, live over USB.
A 20-second test in Brain mode: up to 25°, then stop. Then the dream gets the exact same leg moves the robot made, and you can see how far apart they drift.