# Symbolic manipulator FK and Jacobian in Java

Today I’m posting my Java code for getting the symbolic forward kinematics (FK) and Jacobian for an arbitrary serial manipulator.
As symbolic computation libraries are sparse in Java, I’m invoking Python from the terminal and retrevies the output using I/O streams. As such, Python needs to present on the system.
The Python code is embedded in the Java code as a String.

# Numerically determinate the manipulator Jacobian

In classic kinematics, the Jacobian is used to solve the inverse velocity kinematics.

The forward kinematics equation is given by $\quad x = f(\theta)$and the Jacobian matrix is a linear approximation to $f$.

$$J(\theta) = \begin{bmatrix} \frac{\partial p_x}{\partial \theta_1} & \frac{\partial p_x}{\partial \theta_2} & … & \frac{\partial p_x}{\partial \theta_n} \\[0.3em] \frac{\partial p_y}{\partial \theta_1} & \frac{\partial p_y}{\partial \theta_2} & … & \frac{\partial p_y}{\partial \theta_n} \\[0.3em] … & … & … & … \\[0.3em] \frac{\partial a_z}{\partial \theta_1} & \frac{\partial a_z}{\partial \theta_2} & … & \frac{\partial a_z}{\partial \theta_n} \end{bmatrix}$$