# Robot Kinematics

## Initialize Robot Model

• A robot model, at a very minimum, is a kinematic chain
• The kinematic chain is defined by a series of parameters
``````

In [1]:

from pybotics.robot import Robot
from pybotics.predefined_models import ur10

robot = Robot.from_parameters(ur10())

``````

## Forward Kinematics

• The forward kinematics (FK) refer to the use of the kinematic equations of a robot to compute the pose of the end-effector (i.e., 4x4 transform matrix) from specified values for the joint parameters (i.e., joint angles)
• ELI5: Where am I with the given joint angles?
``````

In [2]:

import numpy as np
np.set_printoptions(suppress=True)

pose = robot.fk(joints)
display(pose)

``````
``````

array([[    0.94003631,    -0.34106157,     0.00295846, -1124.43089247],
[   -0.00491322,    -0.02221388,    -0.99974117,  -355.10102738],
[    0.34103901,     0.93977846,    -0.02255757,  -148.49504763],
[    0.        ,     0.        ,     0.        ,     1.        ]])

``````

## Inverse Kinematics

• The inverse kinematics (IK) makes use of the kinematics equations to determine the joint parameters that provide a desired position for the robot's end-effector
• The default internal IK implementation uses scipy.optimize.least_squares with joint limit bounds
• ELI5: What joint angles do I need to have this position?
``````

In [3]:

solved_joints = robot.ik(pose)

``````
``````

array([5.00000032, 4.97126286, 5.05937406, 4.95609777, 5.00005964,
5.01321487])

``````