Final Project



The Question:

Can I develop a program that will find a set of link lengths for a four-bar linkage such that the output coupler linkage follows a path that closely approximates a desired curve?

Prior Art


  • A very helpful document - I am basically attempting to implement their algorithm. In an effort to manage time I am also using their math to calculate joint angles.:
    Cong Yue, Hai-Jun Su, Q.J. Ge, "A hybrid computer-aided linkage design system for tracing open and closed planar curves." Computer-Aided Design 44 (2012) 1141–1150.
  • Jun Wu, Q.J. Ge, Feng Gao, W.Z. Guo, "On the Extension of a Fourier Descriptor Based Method for Planar Four-Bar Linkage Synthesis for Generation of Open and Closed Paths," ASME Journal of Mechanisms and Robotics, AUGUST 2011, Vol. 3.
  • Marghitu, Dan B., "Kinematics Chains and Machine Components Design," Elsevier, 2005.
  • Coros, Stelian;, "Computational Design of Mechanical Characters," Disney Research,

Best process seems to be a priori calculation of a database of linkages length combinations and their resulting output curves. The coefficients of the curve are stored as a lookup table. Later a search of matching curves finds the closest linkage design. From this further optimization of linkage lengths can be determined by searching within this more localized design space.

What I did: Programming

Initial programming progess includes learning how to manage euler notation of complex values in python. Turns out numpy manages the values just fine. I was able to calculate the path of a coupler linkage on a four-bar linkage by directly implementing the math.

an aside: I also learned how to handle exceptions with the try/except functionality and how to implement the equivalent of a switch/case statement by defining a tuple of function calls.

I spent about 3 hours trying to figure out why my curves were all coming out looking the same. I knew it had something to do with the square root function. It took me three hours to realize there is a different square roote library that handles imaginary numbers. lib.scimath.sqrt I think i noted it briefly earlier but then forgot about it. Now I'm able to get the funky curves I was expecting to see.

I'm still having difficulty drawing the actual linkage on the screen. my l4 angle comes out crazy and I'm not sure why. linkage2

Now to try to build a database of curves.

Ultimately, I want to use Fourier curves, but i'll start with premade poyfit functions and go back and update them later

linkage3 The current state of my polynomial fit. it seems the polynomial fit is either not working or the right type for this type of data. it took me a while to plot anything because I was having difficulty understanding how the function works now I see it basically works as a function. of course.

How it was evaluated

Evaluation is rudimentary at this point since I do not have much working. The basic thing is to plot out the points the coupler linkage traces and then try to fit a curve to those points. Eventually a least squares evaluation of distance between points of the curve. The literature shows that by using a Fourier curve fit the least squares can be used to evaluate just the coefficient terms.

What was learned

Future Work

I plan to continue this further to the point that it becomes a useful tool. I will also calculate the velocity, acceleration and forces at the coupler linkage as well as the intermediate joints based on a desired output force vector. This will provide the necessary pieces of information to design linkages for specific tasks. Further I would like to develop a similar system for designing cams for timing and customized gear tooth profiles.