Three ball balancing robot

During a talk with a co-worker about using the term “brittle” for engineering solutions, i came up with an example of a ball balanced on another ball to illustrate. Whether or not this really fits the definition of brittle (rather than simple unstable) is another topic.

I came across a video of Peter Bone balancing 3 balls for 52 seconds, which is utterly insane for a human. After lots and lots of effort, blood sweat and tears, i suspect that should be no problem for a robot to replicate.

Peter Bone doing his thing. Nutty skills.

Phase 1 : two balls

Two balls seems like it should be pretty easy. All it takes is translation in the X and Y axes, with a rigid hold on the bottom ball. This is effectively balancing a broomstick in the palm of your hand. This is relatively trivial to do as a human (for a few seconds).

Challenges:

  1. Accurate and rapid sensing of the top ball’s velocity and acceleration (of it’s center of mass). Some amount of Machine Vision is likely required here. Luckily, it’s a relatively simple task in this case. Tracking the centroid of a sphere/circle of a specific color as fast as possible. I’ll be using an OpenMV H7 Plus first, and if that fails to deliver, i’ll use a computer (/raspberry pi) and OpenCV for a burlier MV solution.

  2. Fast enough motion. A ballscrew driven gantry setup is likely not fast enough (though has some great properties: it can’t be backdriven, and provides super high resolution motions due to gear ratio), so a belt drive will be employed instead. Additionally, keeping the moving mass down as much as reasonable will help to make the motions fast enough.

Thoughts

  1. I don’t think that the rotation of the top ball is important. Rotation means some amount of energy is stored as rotational inertia, but since the control loop will be reactive, moment to moment, whatever energy that is stored rotationally, and comes out as further lateral motion will just be adjusted for in subsequent loops. This will mean cranking up the Integral (the I in PID) gain a little more than would otherwise be expected, i suspect. We’ll find out soon enough.

The two ball solution is absolutely necessary to optimize things, and work out the bugs in the motion and machine vision system. Once good control over the two ball problem is achieved, then, and only then, does it makes sense to move on to the three ball problem.

Phase 2: Three balls

Three balls seems dramatically harder to do than two balls.

Thoughts

  1. I think that the middle ball is mostly a linkage between the bottom and top ball. The top ball will roll off the middle ball, and that velocity/acceleration will tell you where the middle ball is relative to the top ball, and therefor, what you have to do to bring it under the top ball. We know where the bottom ball is relative to the top ball with the motion control system.

  2. Generally speaking, translations of the bottom ball will be accompanied by proportional rotations. These rotations will be opposite the direction of a ball rolling along that translation. Put another way, each translation has “backspin” rotations along it’s path.

Testing field of view for OpenMV h7 plus. Stock lens works well at about 1m above platform.

Belts, lights, camera installed. Testing camera tracking. The specular highlight on the balls is the thing I’m tracking here. Bottom ball is constrained in a caddy for working on the 2 ball problem.

An OpenMV screenshot, showing the bright spot on the ball being tracked at ~113fps (first number in terminal), with the centroid location jittering by about 1 pixel (cy, cx in terminal). Will speed up further when not attached to IDE, and instead feeding the centroid location to the motion control system.

A poorly tuned, brute force attempt at balancing one ball on top of another. This routine does a separate PID loop for each axis, and multiplies the velocity of the top ball into the position, meaning that faster moving ball gets a stronger correction response. Not great, but sorta-almost working

This omni-wheel setup will allow the ball to be driven in each axis, but the side slip allows inactive axes to minimize their impact on the balls rotation. Ideally, full control over the ball can be achieved. I'm not sure that 4x steppers are really needed, but it was easy to design this way, and in my testing by hand, it does look like I'll want to drive the ball "down" on each side preferentially. Lifting the ball up with the wheels is dangerously close to slipping in the drive direction. Will be better with more weight from more balls of course.