I'm trying to come up with an analytical solution for inverse kinematics for my robot; but some of my trig has left my brain!
The robot is very simple; with one rotary and one prismatic joint. I'm looking to calculate the rotation; which is t.
I've got the below equation which gives me the z co-ord from t and e & w which are constants that I need to tune the robot.
z = e*sin(t) + cos(t)/sin(t)*(-x - e*cos(t)) + w
So basically; I just need to solve the above for t.
I did the below attempt at simplification; and then I get stuck.
z = e*sin(t) + cos(t)/sin(t)*(-x - e*cos(t)) + w
z = e*sin(t) - x*cos(t)/sin(t) -e*cos^2(t)/sin(t) + w
z - w = (e*sin^2(t) - x*cos(t) - e*cos^2(t) ) /sin(t)
z - w = (e*(1 - cos^2(t)) - x*cos(t) - e*cos^2(t) ) /sin(t)
z - w = (e - e*cos^2(t)) - x*cos(t) - e*cos^2(t) ) /sin(t)
z - w = (e - 2e*cos^2(t)) - x*cos(t) ) /sin(t)
Is this going down the correct path to solve?
How do I go from here toward getting to the form t = ...
Thanks
Exact solution involves solving a degree 4 polynomial equation.
Let $t=2s$ and convert all trig functions to $\tan(s)$
$$ z={\frac {3 e\tan \left( s \right) }{1+ \left( \tan \left( s \right) \right) ^{2}}}-{\frac {x}{2\tan \left( s \right) }}+\frac{\tan \left( s \right) x}{2}-{\frac {e}{2\tan \left( s \right) \left( 1+ \left( \tan \left( s \right) \right) ^{2} \right) }}-{\frac {e \left( \tan \left( s \right) \right) ^{3}}{2+2\, \left( \tan \left( s \right) \right) ^{2}}}+w $$ Let $T = \tan(s)$, we have to solve a quartic equation $$ \left( -e+x \right) {T}^{4}+ \left( 2\,w-2\,z \right) {T}^{3}+6\,e{T} ^{2}+ \left( 2\,w-2\,z \right) T-e-x = 0 $$ Once we solve that for $T$, our answer is $t = 2\arctan T$.
An example to illustrate the "let $t=2s$" part. Suppose we want to solve $\sin t = (\cos t)+1$ for $t$. Let $t=2s$, $$ \sin(2s)=\cos(2s)+1 . $$ Convert everything to $\tan$ $$ \frac{2\tan s}{1+\tan^2 s} = \frac{1 - \tan^2 s}{1+\tan^2 s}+1 \\ \frac{2\tan s}{1+\tan^2 s} = \frac{2}{1+\tan^2 s} $$ so we get $$ 2\tan s = 2 $$ Write $T = \tan s$, our equation is $2T=2$. This has solution $T=1$. Then $\tan s = 1$ so $s \arctan 1 = \pi/4$. Finally, $t=2s = 2(\pi/4) = \pi/2$.