I could not yet figure out inverse kinematics from the formal math and descriptions I found on the web, plus it looks like some pretty daunting stuff. So I wondered if I could come up with some trig expressions that would approximate inverse kinematics for Ivan's motion. Here we see the result.
It's just a bunch of miscellaneous trig, and not that much of it really. Given the ball in a randomly selected location in a spherical coordinate shell (radius from 500mm to 700mm), can we position the tool head close to the ball each time? Well, theta is a given - we just rotate the base to the theta position. Then phi and what i called beta are calculated and applied to the three vertical sections.
The result as you can see works most of the time. If you haven't got the horsepower for inverse kinematics or the brainpower to grok it, these equations may be helpful:
th_ = rands(-180, 180, 1);
ph_ = rands(0, 90, 1);
r_ = rands(500, 700, 1);
z0 = length - outerDiameter/2 + height + gearHeight/2;
translate([0, 0, z0])
rotate([ph_, 0, 0])
translate([0, 0, r_])
dx_ = r_ * cos(ph_);
dy_ = r_ * sin(ph_);
gamma = atan2(dy_, dx_);
beta = acos(armLength / (r_/2));
theta = [