The Last 10% of a Six-Bar Linkage
Thereâs a particular kind of frustration that comes from solving the âinterestingâ part of a problem and realizing youâre only 90% done. Today I hit that wall hard while working on a mechanism synthesis project for my advanced mechanisms classâdesigning a six-bar linkage to control a folding greenhouse door.
The math was done. The synthesis equations were working. MATLAB was happily spitting out solutions. And yet every single one of them was unusable.
The Problem That Looked Solved
My team is designing a tabletop greenhouse with a smooth-opening door mechanism. Picture two connected four-bar linkages working together to control a door that folds upward and back, like a laptop screen opening past 90 degrees. We chose a six-bar linkage over simpler alternatives because a basic four-bar can only guarantee three positions along a path, and a cam mechanism would add manufacturing complexity we wanted to avoid. The six-bar gives us enough degrees of freedom to prescribe exactly how the lower right corner of the door travels as it folds openâcontrolling not just where it ends up, but how it gets there.
I had sample code for dyad synthesis (a method for designing two-link chains that pass through prescribed positions). The equations were implemented. Solutions were generating. Victory, right?
Not quite. The solutions I was getting had a few problems:
- The doorâs lower left corner was passing through the greenhouse box
- The front wall of the door was intersecting with the frame
- The upper right corner was swinging past the upper left corner (physically impossible for a rigid door)
In mechanism design terms, I had valid kinematic solutions that were geometric nonsense.
Where Claude Helped (And Where It Couldnât)
I brought this problem to Claude with my sample MATLAB code and project proposal. What followed was a useful exercise in collaborative constraint definition.
The first thing Claude did was ask clarifying questions about the physical setupâwhich I appreciated because Iâd glossed over some details in my own head. Where exactly are the ground pivots allowed? What counts as âinside the boxâ? How do we define the doorâs orientation throughout the motion?
This is where AI assistance shines: forcing you to make implicit assumptions explicit. I knew what I meant by âthe door shouldnât go inside the box,â but I hadnât translated that into mathematical constraints.
We worked through the geometry together. The key variables: coupler_point is the position of the lower right corner of the door (the point weâre prescribing the path for), theta_door is the doorâs current angle relative to horizontal, and door_width and door_height are the physical dimensions of the door panel.
% Door corner positions as functions of mechanism state
% coupler_point: lower right corner (the path we're controlling)
% theta_door: door angle relative to horizontal
door_LL = coupler_point - door_width * [cos(theta_door); sin(theta_door)];
door_UR = coupler_point + door_height * [cos(theta_door + pi/2); sin(theta_door + pi/2)];
% Constraint 1: Lower left corner must stay outside the box
% (x >= box_front_x OR y >= box_top_y)
constraint_LL = (door_LL(1) >= box_front) | (door_LL(2) >= box_top);
% Constraint 2: Upper right x must not exceed upper left x
% (door isn't "overfolded")
constraint_UR = door_UR(1) <= door_LL(1);
The code itself is straightforward. The insight was recognizing that these geometric constraints needed to be checked at every point in the mechanismâs motion, not just at the synthesis positions. A solution that works at three prescribed positions can still fail catastrophically between them.
With the constraints formalized, I thought I was ready to solve the problem properly. I wasnât.
The Real Lesson: Generate, Then Filter
Hereâs what took most of my time: I kept trying to be clever.
My first instinct was to add the constraints directly to the synthesis equationsâsolve for mechanisms that inherently satisfy the geometry. Claude and I went down this path for a while before I realized we were overcomplicating things.
The simpler approach: generate solutions using the standard synthesis, then filter them aggressively. Evaluate each candidate mechanism through its full range of motion and reject anything that violates constraints at any point.
function valid = check_mechanism_constraints(linkage_params, num_steps)
valid = true;
for t = linspace(0, 2*pi, num_steps)
[door_LL, door_UR] = compute_door_corners(linkage_params, t);
if ~passes_all_constraints(door_LL, door_UR)
valid = false;
return;
end
end
end
Itâs not elegant. Itâs computationally wasteful. But itâs correct, and it actually works.
The filtering was aggressive. Out of roughly 400 candidate mechanisms that the synthesis generated, maybe 15 survived all the constraint checks. The survivors shared some common traits: ground pivots tucked behind the hinge line (so the linkage bars didnât collide with the frame), moderate link length ratios (extreme ratios tended to produce jerky motions), and coupler angles that kept the door rotating smoothly rather than whipping through certain portions of the path.
What Iâd Do Differently
This session crystallized something Iâve been noticing about working with AI on engineering problems: the AI is excellent at helping you formalize what you know and terrible at knowing what you donât know.
Claude helped me translate vague geometric intuition into precise mathematical constraints. It helped me debug MATLAB syntax and suggested efficient ways to structure the filtering loop. What it couldnât do was tell me that I was overengineering the synthesis step when a simple generate-and-filter approach would work better.
That insight came from stepping back and asking myself: âWhatâs the simplest thing that could possibly work?â The AI doesnât ask that question unless you prompt it to.
If I faced a similar problem tomorrow, Iâd start with the dumb brute-force approach first. Generate broadly, filter strictly, and only add sophistication to the generation step if filtering isnât finding enough valid candidates. The time I spent trying to embed constraints into the synthesis equations wasnât wastedâI understand the problem better nowâbut it wasnât the efficient path either.
Three Lessons from This Session
1. Separate generation from validation. Itâs often easier to generate candidates broadly and filter strictly than to bake all constraints into the generation step. The synthesis math is already complicated enough without adding geometric constraints to the mix.
2. Check the full motion range. Discrete synthesis points donât guarantee continuous validity. A mechanism that looks perfect at positions 1, 2, and 3 can still crash through your frame at position 1.5. Sample densely.
3. Make your constraints explicit early. If you canât write the constraint as code, you donât understand it well enough. The act of formalizing âthe door shouldnât go inside the boxâ into inequality constraints caught several edge cases I hadnât consciously considered.
Tomorrow Iâll be running the filtered solutions through the visualization code to see which ones produce the smoothest motion and have the most reasonable link lengths for fabrication. The âlast 10%â has a way of stretching into another full day of workâbut at least now I have candidates worth visualizing.