I did study some math while at university. But like many (most) of my compatriots I didn't learn math so much as I learned how to take exams. I've since lived under constant threat of that laziness coming back to bite me.
Even one of the issues I faced in this very project was dangerously close to turning into a math problem.
The issue had to do with the robots legs.
One pair of legs is attached to the upper body of the robot and the other pair to the lower body, meaning that they need to have different lengths.
So far so good.
Additionally, all four feet needs to touch the ground both when the robot is standing and when it's crouching. And hmm... There seems to be quite a few variables to take into account:
- Length of the leg.
- Length of the lever.
- The travel of the actuator that pushes the lever.
- Point on the leg where the lever hinges.
- And more...
There appeared to be no way out of it this time. I resigned myself to the grim fate of actually having to solve an equation.
It ended up not being all that bad though. After some initial teeth grinding I realized I could just have the FreeCad constraint solver do all the the hard work for me.
I drew up a sketch of the linkages for both versions of legs, both in their standing and crouching positions. I set all external dimensions and then added "equidistant from ground" constraints.
I left all leg and lever lengths undefined. I set a constraint for how tall I wanted the robot to be while standing, but left it up to the solver to decide how deep the crouch would be. (8.28 mm as it turned out)
First time around the solver returned no solution.
I then added another degree of freedom by allowing the longer leg to attach to the lever at an arbitrary point.
That did the trick and the sketch turned green, meaning it was fully constrained, and a solution had been found.
For some reason I was still a bit skeptical of this working—I guess it's harder to convince yourself of that when you're cheating. But after printing and assembly, the legs worked out great and the robot didn't wiggle at all while standing nor while crouching.
I couldn't have hoped for a better turn out. And more importantly I had once more managed to keep my grey matter in its natural flabby and inert state.
Crisis averted. This time. But it was too close for comfort.