# Mapping from quaternion Jacobian to geometric Jacobian

I have a Jacobian $$J_{A}(q)$$ which maps from a robot's joint velocities to the robot's end effector time derivative: $$\dot{x} = J_{A}(q)\cdot \dot{q}$$

$$x \in \mathbb{R}^{7\times 1}$$ is the end-effector representation, where the first 3 elements are Cartesian coordinates and the remaining 4 are the orientation as a quaternion. I would like to convert my analytic Jacobian to a geometric Jacobian $$J_{G}(q)$$, where $$\dot{x_{G}} = J_{G}(q)\cdot \dot{q}$$ gives a vector $$\mathbb{R}^{6\times 1}$$ which is the linear velocities and angular rates of the end-effector.

From what I've seen, there exists a mapping $$E$$ such that $$\dot{x_{G}} = E\cdot J_{A}(q)\cdot \dot{q}$$.

I tried to derive $$E$$ and got the following result. Let $$\xi = [\xi_{0}, \xi_{1}, \xi_{2}, \xi_{3}]^{T}$$ be the quaternion orientation of the end-effector. $$E = \begin{bmatrix} I_{3\times 3} & 0 \\ 0 & 2H \end{bmatrix}\\ H = \begin{bmatrix} -\xi_{1} & \xi_{0} & -\xi_{3} & \xi_{2} \\ -\xi_{2} & \xi_{3} & \xi_{0} & -\xi_{1} \\ -\xi_{3} & -\xi_{2} & \xi_{1} & \xi_{0} \end{bmatrix}$$

However, when implementing this solution and comparing the end-effector linear and angular rates against the ground truth, it is incorrect for the angular rates (linear rates are okay). Am I doing something wrong here? I am confident the analytic Jacobian is correct.

Turns out the source where I got the $$H$$ matrix was incorrect. I worked it out by hand using this link and got that: $$E = \begin{bmatrix} I_{3\times 3} & 0 \\ 0 & -2H \end{bmatrix}\\ H = \begin{bmatrix} -\xi_{1} & \xi_{0} & \xi_{3} & -\xi_{2} \\ -\xi_{2} & -\xi_{3} & \xi_{0} & \xi_{1} \\ -\xi_{3} & \xi_{2} & -\xi_{1} & \xi_{0} \end{bmatrix}$$