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?
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.
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.
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.
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 laterlinkage3 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.
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.
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.