I'm stuck at computing forward kinematics equations.
I have configuration of the first two joints like on the following image:
Transformation from the origin to the first joint basis is trivial: just translation by $\vec{OO_{1}}$.
The second transform from joint 1 to joint 2 basis makes me nervous throughout this day. First of all it is a rotation around $Z$ axis. So rotational part will look like this:
$ R_{12}= \begin{pmatrix} cos(q_{1}) & -sin(q_{1}) & 0\\ sin(q_{1}) & cos(q_{1}) & 0\\ 0 & 0 & 1 \end{pmatrix} $
Problems are all about the translation part. I see two approaches here. Since angle between $\vec{O_{1}O_{2}}$ and plane $X_{1}O_{1}Y_{1}$ is constant because rotation is performed around $Z$ axis, length of projection of $\vec{O_{1}O_{2}}$ onto $X_{1}O_{1}Y_{1}$ is constant. Here it is:
$\vec{v} = O_{2} - O_{1} = \begin{pmatrix} v_{x}\\ v_{y}\\ v_{z} \end{pmatrix} $ Its' projection onto $X_{1}O_{1}Y_{1}$ is $\vec{v_{p}} = \begin{pmatrix} v_{x}\\ v_{y}\\ 0 \end{pmatrix}$ and it's magnitude is $m=\sqrt{v_{x}^2 + v_{y}^2}=const$.
Now let's look at what happens after rotation:
So the translation matrix looks like: $ S_{12}= \begin{pmatrix} m\cdot cos(\alpha+q_{1})\\ m\cdot sin(\alpha+q_{1})\\ v_{z} \end{pmatrix} $
And full transformation matrix from joint 1 to joint 2 basis is:
$ T_{12}= \begin{pmatrix} R_{12} & S_{12}\\ 0 & 1 \end{pmatrix} $
Unfortunately it gives me wrong results even when $q_{1}=0$. Can not see where my reasoning is wrong.
Second approach is more straightforward. Being able to calculate $\vec{O_{1}O_{2}}$ in initial configuration makes it possible just to rotate this vector by $q_{1}$ around $Z$ axis and this has to be our translation vector. Nevertheless I can't make it work.
$R_{z}= \begin{pmatrix} cos(q_{1}) & -sin(q_{1}) & 0\\ sin(q_{1}) & cos(q_{1}) & 0\\ 0 & 0 & 1 \end{pmatrix}\\ \vec{v} = O_{2} - O_{1} = \begin{pmatrix} v_{x}\\ v_{y}\\ v_{z} \end{pmatrix}\\ R_{z}\vec{v}= \begin{pmatrix} v_{x}cos(q_{1})-v_{y}sin(q_{1})\\ v_{x}sin(q_{1})+v_{y}cos(q_{1})\\ v_{z} \end{pmatrix}\\ T_{12}= \begin{pmatrix} R_{12} & R_{z}\vec{v}\\ 0 & 1 \end{pmatrix} $
It works until I rotate the first joint(i.e. only when $q_{1}=0$).
Under works
I mean "calculates position of joint 2 origin right". This is done by multiplying transformation matrix $T_{02} = T_{01}T_{12}$ by $\begin{pmatrix} 0 & 0 & 0 & 1\end{pmatrix}^{T}$
The q rotation is part of the rotation matrix, it should not be also part of the translation matrix
? I saw plenty of examples whenq
is used in rotation matrix and then in translation to find a projections onto axes. $\endgroup$x
andy
translations,z
translation is const. If this is not the way to do it, it would be glad if you explain why. $\endgroup$