License: CC-BY-NC-SA 4.0
Author: Murilo M. Marinho (murilo
Pre-requisites for the learner¶
The user of this notebook is expected to have prior knowledge in
- All the content and pre-requisites of lessons 1, 2, and 3.
I found an issue¶
Thank you! Please report it at https://
Latex Macros¶
\providecommand{\myvec}[1]{{\mathbf{\boldsymbol{{#1}}}}}
\providecommand{\mymatrix}[1]{{\mathbf{\boldsymbol{{#1}}}}}
Package installation¶
%%capture
%pip install numpy
%pip install numpy --break-system-packages
Imports¶
import numpy as np
from math import pi, sin, cos
Suggested exercises¶
- What about if the robot had 3 degrees-of-freedom, that is RRR?
- What about if the robot had n degrees-of-freedom? Would it be much more complicated to solve?
- What if the robot has one or more prismatic joints?
2 DoF planar robot (RR)¶

For the 2-DoF planar robot shown in the figure, let , , , be the parameters to calculate
that is, the forward kinematics model of the 2 DoF planar manipulator with configuration space given by
- Calculate the analytical Jacobian such that
where
in which , , and are, respectively, the -axis position, the -axis position, and the -axis angle of . Notice that .
- For the same values of , calculate when
Step 1: Calculate the forward kinematics by hand¶
It is not possible to calculate the Jacobian without first deriving the forward kinematics model (FKM).
We saw how to do that in class, so here is the answer:
This means that, from inspection,
Step 2: Calculate the differential kinematics by hand¶
We first calculate the Jacobian by hand, because programmatically there’s nothing for you to do yet.
The analytical Jacobian is given by
As we did in class, we find each element by calculating the partial derivative of the respective task-space value with respect to the configuration-space value
resulting in
Step 3: Calculate the Jacobian in your code¶
We’re now equipped to solve the first question by doing the following
# Sample values, the particular values do not matter
q_0 = pi / 4
q_1 = pi / 3
l_0 = 0.2
l_1 = 0.1
# To possibly make it easier for you to read
J_1_1 = -l_0 * sin(q_0) - l_1 * sin(q_0 + q_1)
J_1_2 = -l_1 * sin(q_0 + q_1)
J_2_1 = l_0 * cos(q_0) + l_1 * cos(q_0 + q_1)
J_2_2 = l_1 * cos(q_0 + q_1)
J_3_1 = 1
J_3_2 = 1
J = np.array(
[[J_1_1, J_1_2],
[J_2_1, J_2_2],
[J_3_1, J_3_2]]
)
print(f"The analytical Jacobian at {q_0} and {q_1} is {J}")
The analytical Jacobian at 0.7853981633974483 and 1.0471975511965976 is [[-0.23801394 -0.09659258]
[ 0.11553945 -0.0258819 ]
[ 1. 1. ]]
With the correct definition of the Jacobian as above, we can calculate the second question as
q_dot = np.array(
[[5],
[10]]
)
x_dot = J @ q_dot
print(f"In these conditions, x_dot = {x_dot}")
In these conditions, x_dot = [[-2.15599552]
[ 0.31887821]
[15. ]]