# Inverse Kinematics - Obtaining the Equation of a Path

Obtaining the Equation of a Path

I'm working on a project for myself in SolidWorks which involves a scissor-type mechanism. The bottom ends of the linkages are attached to disks that are free to rotate around the central hub where all the gears are attached. On the other side of the hub is another ring gear and pinion gear to reverse the motion of one of the disks. I need to be able to figure out the parametric equations that describes the curve that is shown in the animation. In SolidWorks I am able to use this curve in a part. Problem is that the curve is not exact since it depends entirely on the number of data points you want to represent the curve.

The only knowns are the rotation angle that the disks on the hub make, the pivot to pivot hole distance on the linkages, and the initial distance from the top pivot hole of the linkage to the hub center, the initial angle of the disk with respect to the hub (measured from a line drawn from the hub center - bottom linkage pivot hole to the vertical axis.

Last edited:

Before we dive into this, I want you to draw a circle on paper, preferably using a glass with a small, circular base or the inside of a roll of tape as a guide. Then draw a straight line outside of the circle but close to it, preferably using a ruler, making sure to draw it in a direction that gives plenty room to draw it long. Then lay a short, slender object (i.e. a toothpick, match) down on the paper, ensuring that one end of it always touches (but does not cross) the straight line you drew, meanwhile dragging the other end around the circle, such that the end touching the straight line gets dragged along the line. What do you observe?
The toothpick models the motion of the crossing linkage with a hole in it.

Refer to the attached diagram for the following:

$h$ represents the length of the horizontal linkage.
$c$ represents the length of either of the linkages that cross over one another.
$d$ represents the initial distance from the hub center to either of the pivot points on the horizontal linkage.
$\alpha$ represents the angle from either of the pivots connecting a disk to its linkage to a line drawn vertically through the hub center.
$r$ represents the distance from the hub center to either pivot point where a linkage connects to a disk. I take it that this value is not given.
$p$ represents the distance from the center of the hole in the crossing linkage that traces a path to the pivot point where it connects to its disk.

Now, I'm not sure if you know $r$. If you don't, you can find it using the following procedure; otherwise, skip down to "The two linkages that cross...".

Observe that $r$ makes a triangle with $c$ and $d$; however, $\alpha$ only sweeps from a pivot connecting a disk to its linkage to the vertical. I'd like to be able to use the law of cosines to find $r$, but I'd need the angle that sweeps all the way to the line drawn from the hub center to the pivot point on the horizontal linkage. Since you know $d$ and $h$, you can find the angle, $\theta$ that sweeps from line $d$ to a horizontal drawn through the hub center in the following way.

$\theta=cos$$-1$$(\frac{h/2}{d})$

Because $\beta$ is complementary to $\theta$, $\beta=90-\theta$.
$\beta$ sweeps the rest of the angle we need for the angle swept from $r$ to $d$.
Now apply the law of cosines:

$c$$2$ $=r$$2$$+$ $d$$2$ $-$ $2rdcos(\alpha+\beta)$, where $\alpha+\beta$ represents the angle opposite side $c$ of our triangle.

Rewrite in the following way, and we have a quadratic equation in $r$:

$r$$2$ $+$ $(-2dcos(\alpha+\beta))r$ $+$ $(d$$2$ $-$ $c$$2$ $)$ $=0$

Our solutions are of the form $r=\frac{-(-2dcos(\alpha+\beta))\pm\sqrt{(-2dcos(\alpha+\beta))^2-4(1)(d^2-c^2)}}{2(1)}$

Simplify:

$r=dcos(\alpha+\beta)\pm\sqrt{d^2(cos^2(\alpha+\beta)-1)+c^2}$

What this tells us is that there may be two values of $r$ that work for the given setup, which should make sense since the known angle-side-side combination of our triangle does not guarantee a particular triangle (unless the triangle is right, which we can't be sure of). You can visualize this by imagining that the crossing linkages would be able to attach to bigger disks at points the same initial angular displacement from the vertical since there are two different triangles with the same $d$ and $c$ but different $r$. What I mean is, let $c$ swing about the pivot where it is attached to the horizontal linkage, and there are two spots where its other end will intersect with a line drawn out in the same direction as $r$.

The two linkages that cross over one another and connect to the disks appear to be the same length, and the two disks (one mostly hidden from view by the other) rotate at the same speed in opposite directions. Could I also convince you that the horizontal linkage only displaces vertically and maintains symmetry about the y-axis throughout the animation?

Now let's analyze the motion of the linkage with a hole.
Until now, $\alpha$ has represented the initial angle between line $r$ and the vertical (i.e. an actual, known value). From now on I will use $\alpha$ as a variable to represent the angle between these lines.

Let the point $(0,0)$ represent the hub center. Then it seems reasonable that the left and right pivot points on the horizontal linkage always have x-coordinates of $-\frac{h}{2}$ and $\frac{h}{2}$, respectively. This is a constraint imposed by the design of the scissor mechanism.

Our ultimate goal is to express the coordinates of the center of the hole in our linkage in terms of $\alpha$, but in order to go any further, we'd need to know $p$, or how far the center of the hole in the linkage is from the point where the linkage connects to its disk. I'm relying on you to provide this value.

We can use trig functions to find the coordinates of the pivot point connecting our crossing linkage to its disk in the following way:

$x=rcos(90+\alpha),$ $y=rsin(90+\alpha)$

I use $90+\alpha$ here because $\alpha$ is swept from the vertical to $r$, but when we use trig functions to represent coordinates, our angles need to be in standard position.

As mentioned, the x-coordinate of the pivot point where our linkage attaches to the horizontal linkage is always $\frac{h}{2}$. To find the y-coordinate of this pivot point, we need to establish that the distance between the two pivot points on our linkage is always equal to $d$. Then, at any point in time during the motion of this linkage, we may construct a right triangle with $d$ as its hypotenuse. The adjacent and opposite sides are represented by the differences in the x- and y- coordinates of the two pivot points on the linkage.

$d$$2$ $=(x$$2$ $-$ $x$$1$$)$$2$ $+$ $(y$$2$ $-$ $y$$1$$)$$2$

Substituting what we know:

$d$$2$ $=(\frac{h}{2}-$ $rcos(90+\alpha))$$2$ $+$ $(y$$2$ $-$ $rsin(90+\alpha))$$2$

Expand binomials:

$d$$2$ $=\frac{h^2}{4}-$ $hrcos(90+\alpha)$ $+$ $r^2cos^2(90+\alpha)$ $+$ $(y$$2$$)$$2$ $-$ $2y$$2$$rsin(90+\alpha)$ $+$ $r^2sin^2(90+\alpha)$

Group and factor terms containing $r^2$:

$d$$2$ $=\frac{h^2}{4}-$ $hrcos(90+\alpha)$ $+$ $r^2(sin^2(90+\alpha)+cos^2(90+\alpha))$ $+$ $(y$$2$$)$$2$ $-$ $2y$$2$$rsin(90+\alpha)$

Apply Pythagorean identity:

$d$$2$ $=\frac{h^2}{4}-$ $hrcos(90+\alpha)$ $+$ $r^2$ $+$ $(y$$2$$)$$2$ $-$ $2y$$2$$rsin(90+\alpha)$

Now, I know I said $\alpha$ is a variable, but we can treat expressions containing it as constants since we are trying to find $y$$2$ given an arbitrary value of $\alpha$. What we really have is a quadratic equation in $y$$2$.

$(y$$2$$)$$2$ $+$ $(-2rsin(90+\alpha))y$$2$ $+$ $(r^2+\frac{h^2}{4}-d$$2$ $-$ $hrcos(90+\alpha))=0$

Our solutions are of the form:

$y$$2$ $=\frac{-(-2rsin(90+\alpha))\pm\sqrt{(-2rsin(90+\alpha))^2-4(1)(r^2+\frac{h^2}{4}-d^2-hrcos(90+\alpha))}}{2(1)}$

Simplify:

$y$$2$ $=rsin(90+\alpha)\pm\sqrt{r^2sin^2(90+\alpha)+hrcos(90+\alpha)+d^2-r^2-\frac{h^2}{4}}$

What this tells us is that there are two values of $y$$2$ that satisfy the given conditions. If we allow the linkage to rotate freely about the pivot point where it is connected to its disk, you will see that there are two points where the other end intersects the line $x=\frac{h}{2}$. We want the higher of these two locations, so:

$y$$2$ $=rsin(90+\alpha)+\sqrt{r^2sin^2(90+\alpha)+hrcos(90+\alpha)+d^2-r^2-\frac{h^2}{4}}$

Next, set up a smaller triangle similar to the one we just used, but this one's hypotenuse is $p$, or the distance from the center of the hole in the linkage to the pivot point connecting it to its disk. Both of these similar triangles share a common vertex at the pivot point connecting our linkage to its disk. If we use this as our reference point, we can subtract coordinates to find sidelengths and then relate these sidelengths using what we know about the proportionality of similar triangles.

The adjacent sidelength of our big triangle equals the difference between the x-coordinates of its pivot points:

$adj_1=x$$2$ $-$ $x$$1$

$adj_1=\frac{h}{2}-rcos(90+\alpha)$

The opposite sidelength of our big triangle equals the difference between the y-coordinates of its pivot points:

$opp_1=y$$2$ $-$ $y$$1$

$opp_1=rsin(90+\alpha)+\sqrt{r^2sin^2(90+\alpha)+hrcos(90+\alpha)+d^2-r^2-\frac{h^2}{4}}-rsin(90+\alpha)$

$opp_1=\sqrt{r^2sin^2(90+\alpha)+hrcos(90+\alpha)+d^2-r^2-\frac{h^2}{4}}$

Now we can set up a similarity relationship between the sidelengths of the two triangles as follows:

$\frac{adj_1}{hyp_1}=\frac{adj_2}{hyp_2}$ and $\frac{opp_1}{hyp_1}=\frac{opp_2}{hyp_2}$

Substituting what we know:

$\frac{adj_2}{p}=\frac{\frac{h}{2}-rcos(90+\alpha)}{c}$ and $\frac{opp_2}{p}=\frac{\sqrt{r^2sin^2(90+\alpha)+hrcos(90+\alpha)+d^2-r^2-\frac{h^2}{4}}}{c}$

Multiply through:

$adj_2=\frac{p}{c}(\frac{h}{2}-rcos(90+\alpha))$ and $opp_2=\frac{p}{c}\sqrt{r^2sin^2(90+\alpha)+hrcos(90+\alpha)+d^2-r^2-\frac{h^2}{4}}$

Now add these sidelengths to the reference point's coordinates to obtain the x- and y-coordinates of the center of the hole:

$x_p=rcos(90+\alpha)+\frac{p}{c}(\frac{h}{2}-rcos(90+\alpha))$

$x_p=\frac{ph}{2c}+(1-\frac{p}{c})rcos(90+\alpha)$

$y_p=rsin(90+\alpha)+\frac{p}{c}\sqrt{r^2sin^2(90+\alpha)+hrcos(90+α)+d^2-r^2-\frac{h^2}{4}}$

These last two expressions give the horizontal and vertical positions of the center of the hole in the linkage as functions of $\alpha$. You should have enough information to substitute actual values for all the other symbols.

If you want to represent the horizontal and vertical positions of the center of the hole as functions of time, you would first need to find $\alpha$ as a function of time. You said you knew the initial angular position of the pivot point connecting the linkage to its disk with respect to the vertical, so such a function might look like $\alpha(t)=kt+\alpha$$i$, where $k$ is the angular speed of either disk and $\alpha$$i$ is the initial angular position. This function assumes the angular speed is constant, which did not look to be the case when I watched the animation. Perhaps the motor causes the disk to accelerate, in which case your function might look like $\alpha(t)=\frac{1}{2}kt^2+\alpha$$i$, where $k$ is the angular acceleration of either disk. Or maybe the disks accelerate, go at constant speed, and then decelerate. Whatever the case may be, substitute your angular position function, $\alpha(t)$, for $\alpha$ in the expressions above.

I used a TI-84 to look at this in parametric mode, and using values of $r$, $d$, $c$, $h$, and $p$ obtained by placing a ruler on my computer screen to measure the mechanism in the animation in various places, along with the interval $[38,58]$ for $\alpha$ (measured in degrees from the vertical), the curve I'm seeing looks incredibly similar to the one traced out in the animation.

#### Attachments

• 313.5 KB Views: 147
Wow, thank you very much for your help. Very thorough. There is one modification that I am making. I am taking d as an unknown and solving for it's length using geometry. I'm doing this to avoid floating point error.