Using trigonmetry to compute valid configuration(s) of a 2D four bar linkage given a specific constraint

99 Views Asked by At

I'm trying to find an analytical solution to an inverse kinematics problem for a software project, and after simplifying things as much as possible I've come up with the following problem statement.

The problem is described graphically by this (rather crude) diagram:

I have a 2D four bar linkage (L1, L2, L3, and L4, with L2 being the "floating" link and L3 being the "fixed" link), and a "Target" point. I need a configuration of the linkage where the vector from the L2-L4 joint to this target is perpendicular to the floating link.

This results in the diagram linked above. The lengths of L1, L2, L3, L4, and L5 are known, as are angles A and B (in my case, angle B is always 90). Is it possible to solve for angles C and D given this configuration and these known values?

My intuition is that there are at most two solutions, and that there should be some way to use trigonometry to compute what they are. But if there is some way, I can't figure it out.

Thanks in advance for any suggestions or insights!

Edit: I'm increasingly thinking this may just require a numerical solution.

2

There are 2 best solutions below

1
On

Here is the logistics to derive $C$ supposing that $D$ is known: Define a line $x$ which connects the common point of $L_3$ and $L_4$ with the common point of $L_1$ and $L_2$. This is basically a diagonal in the quadrangle defined by $L_{1,2,3,4}$. This defines a triangle with sides $L_3$, $L_1$ and $x$ and another triangle with sides $x$, $L_2$ and $L_4$. Split the angle $A=A'+A''$ such that $A'$ is the angle between $L_1$ and $L_3$. Define the angle $\alpha$ between $x$ and $L_3$, the angle $\beta$ between $x$ and $L_4$, the angle $\gamma$ between $x$ and $L_2$ and the angle $\delta$ between $x$ and $L_1$. Then the angles inside triangles sum to 180$^\circ$: $$ \alpha+\delta+A'=\pi ; $$ $$ \beta+D+\gamma=\pi ; $$ $$ \delta+\gamma +C =2\pi. $$ The cosine rules in the two triangles are $$ x^2=L_3^2+L_1^2-2L_3L_1\cos A' ; $$ $$ x^2=L_4^2+L_2^2-2L_4L_2\cos D ; $$ $$ L_1^2=L_3^2+x^2-2L_3x\cos\alpha ; $$ $$ L_2^2=L_4^2+x^2-2L_4x\cos\beta ; $$ $$ L_3^2=L_1^2+x^2-2L_1x\cos\delta ; $$ $$ L_4^2=L_2^2+x^2-2L_2x\cos\gamma ; $$ Eliminate $\alpha$ and $\beta$: $$ x^2=L_3^2+L_1^2-2L_3L_1\cos A' ; $$ $$ x^2=L_4^2+L_2^2-2L_4L_2\cos D ; $$ $$ L_1^2=L_3^2+x^2+2L_3x\cos(\delta+A') =L_3^2+x^2+2L_3x\cos\delta\cos A' - 2L_3x\sin\delta \sin A'. $$ $$ L_2^2=L_4^2+x^2+2L_4x\cos(D+\gamma) =L_4^2+x^2+2L_4x\cos D\cos\gamma - 2L_4x\sin D \sin\gamma. $$ $$ L_3^2=L_1^2+x^2-2L_1x\cos\delta ; $$ $$ L_4^2=L_2^2+x^2-2L_2x\cos\gamma ; $$ Eliminate $x$: $$ L_3^2+L_1^2-2L_3L_1\cos A'=L_4^2+L_2^2-2L_4L_2\cos D ; $$ $$ L_1^2 =L_3^2+L_3^2+L_1^2-2L_3L_1\cos A'+2L_3\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos\delta\cos A' - 2L_3\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\sin\delta \sin A'. $$ $$ L_2^2 =L_4^2+L_3^2+L_1^2-2L_3L_1\cos A'+2L_4\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos D\cos\gamma - 2L_4\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\sin D \sin\gamma. $$ $$ L_3^2=L_1^2+L_3^2+L_1^2-2L_3L_1\cos A'-2L_1\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos\delta ; $$ $$ L_4^2=L_2^2+L_3^2+L_1^2-2L_3L_1\cos A'-2L_2\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos\gamma ; $$ Eliminate common terms on the 2 sides: $$ L_3^2+L_1^2-2L_3L_1\cos A'=L_4^2+L_2^2-2L_4L_2\cos D ; $$ $$ 0 =L_3-L_1\cos A'+\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos\delta\cos A' - \sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\sin\delta \sin A'. $$ $$ L_2^2 =L_4^2+L_3^2+L_1^2-2L_3L_1\cos A'+2L_4\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos D\cos\gamma - 2L_4\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\sin D \sin\gamma. $$

$$ 0=L_1-L_3\cos A'-\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos\delta ; $$ $$ L_4^2=L_2^2+L_3^2+L_1^2-2L_3L_1\cos A'-2L_2\sqrt{L_3^2+L_1^2-2L_3L_1\cos A'}\cos\gamma ; $$ Eliminate $\cos A'=\frac{L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D}{2L_3L_1}$: \begin{multline} 0 =L_3-\frac{L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D}{2L_3} \\ +\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\delta \frac{L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D}{2L_3L_1} \\ - \sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\sin\delta \sqrt{1-\frac{(L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D)^2}{(2L_3L_1)^2}}. \end{multline} \begin{multline} L_2^2 =L_4^2+L_4^2+L_2^2-2L_4L_2\cos D+2L_4\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos D\cos\gamma \\ - 2L_4\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\sin D \sin\gamma. \end{multline} \begin{multline} 0=L_1-\frac{L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D}{2L_1}-\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\delta ; \end{multline} \begin{multline} L_4^2=L_2^2+L_4^2+L_2^2-2L_4L_2\cos D-2L_2\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\gamma ; \end{multline} Simplify \begin{multline} 0 =L_3-\frac{L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D}{2L_3} \\ +\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\delta \frac{L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D}{2L_3L_1} \\ - \sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\sin\delta \sqrt{1-\frac{(L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D)^2}{(2L_3L_1)^2}}. \end{multline} \begin{multline} 0 =L_4-L_2\cos D+\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos D\cos\gamma \\ - \sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\sin D \sin\gamma. \end{multline} \begin{multline} % 0=L_1-\frac{L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D}{2L_1}-\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\delta ; % 0=2L_1^2-(L_3^2+L_1^2-L_4^2-L_2^2+2L_4L_2\cos D)-2L_1\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\delta ; 0=L_1^2-L_3^2+L_4^2+L_2^2-2L_4L_2\cos D-2L_1\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\delta ; \end{multline} \begin{multline} 0=L_2-L_4\cos D-\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}\cos\gamma ; \end{multline} Eliminate $\cos\gamma = \frac{L_2-L_4\cos D}{\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}}$, where it turns out that the two equations that combine $D$ and $\gamma$ are linearly dependent. Eliminate $\cos\delta=\frac{L_1^2-L_3^2+L_4^2+L_2^2-2L_4L_2\cos D}{2L_1\sqrt{L_4^2+L_2^2-2L_4L_2\cos D}}$. This means if $D$ is given one can derive $\delta$ and $\gamma$, then $C$ from these equations.

0
On

Calling $R(\theta) = (\cos\theta,\sin\theta)$ and considering the $L_5$ direction as an angle reference we have

$$ \cases{ L_3R(-A)+L_4R(\pi-E-A)+\rho R(\pi-(D+\frac{\pi}{2})+\pi-E-A)=L_5R(0)\\ L_1R(-\alpha)+L_2R(\pi-C-\alpha)+\rho R(\frac{\pi}{2}+\pi-C-\alpha)=L_5R(0)\\ A-\alpha+E+D+2\pi-C = 2\pi } $$

so we have five unknowns $(\alpha,E,D,C,\rho)$ and five equations. After the elimination of $\alpha =A+E+D-C$ we have

$$ \cases{ L_3\cos(A)-L_4\cos(A+E)-\rho\sin(A+D-E)-L_5=0\\ -L_3\sin(A)+L_4\sin(A+E)-\rho\cos(A+D+E)=0\\ L_1\cos(A-C+D+E)-L_2\cos(A+D+E)-\rho\sin(A+D+E)-L_5=0\\ -L_1\sin(A-C+D+E)+L_2\sin(A+D+E)-\rho\cos(A+D+E)=0 } $$

This system of equations can be solved using an iterative method once giving a good start point, to avoid possible weird solutions. Follows an example whose solution was obtained with a Newton-like process

$$ f(x) \approx f(x_0) +\left(\nabla f\right)_{x_0}(x-x_0)\approx 0 $$

with $(A=1.4,L_1=1,L_2=1.3,L_3=1.5,L_4 = 1.7,L_5=1.8)$ we got with the initial guess $(E=1,D=0.5,C=2,\rho=1)$ in three iterations

$$ (E=1.34247,D=0.37179,C=2.09244,\rho=0.945192) $$

enter image description here