This repo containes educational examples on Franka Emika 7 DOF robot using python and robtotics toolbox and numpy. We hope that it will be helpful for students and engineers to get a better understanding for topics like calibration and control.
This work is based on Optimal Pose Selection for the Identification of Geometric and Elastostatic Parameters of Machining Robots
From a manifacturing stand point it is extremely challenging to produce robots with zero erros in joints lenghts. Therefore each produced manipulator has small errors from the factory. Keep in mind all these small errors will affect the accuracy if not considered. It has been reported by a number of authors, the manipulator geometric errors are responsible for about 90% of the total positioning errors.
Fig.1.1 - The schematic of robot calibration procedure
-
The first step (modeling) is aimed at developing a suitable geometric model, which properly describes the relation between the manipulator geometric parameters (link lengths and joint angles) and the end-effector location (position and orientation).
-
The second step (design of experiments) is aimed at choosing optimal measurement configurations. It should rely on an appropriate performance measure, which takes into account the particularities of technological process. It should be also able to obtain solution within the work-cell constraints, and to adjust the number of experiments based on the error estimation.
-
The third step (measurements) deals with carrying out calibration experiments using the obtained configurations. Depending on the measurement methods (measurement tools and devices, marker location, etc.), it may provide different experimental data (the end-effector position/location, etc.).
-
At the fourth step (identification) the errors in geometric parameters are computed using the corresponding model and proper identification algorithm. Using the experimental data, it is possible to evaluate identification accuracy for the parameters of interest.
-
At the last step (implementation), the geometric errors are compensated by modification of the geometric parameters embedded in the robot controller.
In this step we assum that the manipulator links are rigid enough and the non-geometric factors are negligible in this level of calibration, the general expression of the geometric model for a
where
There are a number of techniques that allows us to obtain the manipulator model of such type, which is definitely complete but includes redundant parameters to be eliminated. In this work, we will use the model generation technique that is based on dedicated analytical elimination rules and includes the following steps:
- Construction of the complete and obviously reducible model in the form of homogeneous matrices product.
- The base transformation
$T_{Base}=[T_x T_y T_z R_x R_y R_z]_b$ - The joint and link transformation
$T_{joint,j} . T_{Link,j}$ - for revolute joint
$T_{joint,j} . T_{Link,j}= R_{e,j}(q_j,\pi_{qj}).[T_u T_v R_u R_v]_{Lj} $ - for prismatic joint
$T_{joint,j} . T_{Link,j}= T_{e,j}(q_j,\pi_{qj}).[R_u R_v ]_{Lj}$
- for revolute joint
- The tool transformation
$T_{tool}=[T_x T_y T_z R_x R_y R_z]_t$
- Elimination of non-identifiable and semi-identifiable parameters in accordance with specific rules for different nature and structure of consecutive joints.
-
For the case of consecutive revolute joint
$R_{e,j}(q_j,\pi_{qj})$ - if
$e_j \perp e_{j-1}$ , eliminate the term$R_{u,L_{j-1}}$ or$R_{v,L_{j-1}}$ that corresponds to$R_{e,j}$ - if
$e_j \parallel e_{j-1}$ , eliminate the term$T_{u,L_{j-k}}$ or$T_{v,L_{j-k}}$ that defines the translation orthogonal to the joint axes, for which$k$ is minimum$( k \geq 1 )$
- if
-
For the case of consecutive prismatic joint
$T_{e,j}(q_j,\pi_{qj})$ - if
$e_j \perp e_{j-1}$ , eliminate the term$T_{u,L_{j-1}}$ or$T_{v,L_{j-1}}$ that corresponds to$T_{e,j}$ - if
$e_j \parallel e_{j-1}$ , eliminate the term$T_{u,L_{j-k}}$ or$T_{v,L_{j-k}}$ that defines the translation in the direction of axis$e_j$ , for which$k$ is minimum$( k \geq 1 )$
- if
Fig.2.1 - Manipulator segment with perpendicular and parallel axes
Applying the previous steps to the 7-DoF Panda robot we got the following:
-
Complete (but redundant) reducable model:
$T=[T_xT_yT_zR_xR_yR_z]_b.$ $R_z(q_1+\Delta q_1).[T_xT_yR_xR_y].$ $R_y(q_2+\Delta q_2).[T_xT_zR_xR_z].$ $R_z(q_3+\Delta q_3).[T_xT_yR_xR_y].$ $R_y(q_4+\Delta q_4).[T_xT_zR_xR_z].$ $R_z(q_5+\Delta q_5).[T_xT_yR_xR_y].$ $R_y(q_6+\Delta q_6).[T_xT_zR_xR_z].$ $R_z(q_7+\Delta q_7).[T_xT_yR_xR_y].$ $[T_xT_yT_zR_xR_yR_z]_t$ -
Applying the elimination rules for the case of consecutive revolute joints, the following parameters are sequentially eliminated from the redundant model :
$T=[T_xT_yT_zR_xR_yR_z]_b.$ $R_z(q_1+\cancel{\Delta q_1}).[T_xT_yR_x\cancel{R_y}].$ $R_y(q_2+\Delta q_2).[T_xT_zR_x\cancel{R_z}].$ $R_z(q_3+\Delta q_3).[T_xT_yR_x\cancel{R_y}].$ $R_y(q_4+\Delta q_4).[T_xT_zR_x\cancel{R_z}].$ $R_z(q_5+\Delta q_5).[T_xT_yR_x\cancel{R_y}].$ $R_y(q_6+\Delta q_6).[T_x\cancel{T_z}R_x\cancel{R_z}].$ $R_z(q_7+\cancel{\Delta q_7}).[\cancel{T_x}\cancel{T_y}\cancel{R_x}\cancel{R_y}].$ $[\cancel{T_x}\cancel{T_y}\cancel{T_z}\cancel{R_x}\cancel{R_y}\cancel{R_z}]_t$ -
Final complete and irreducable geometric model:
$T_{robot}=R_z(q_1).[T_xT_yR_x].R_y(q_2+ \Delta q_2).[T_xT_zR_x].R_z(q_3+\Delta q_3).[T_xT_yR_x].$ $R_y(q_4+\Delta q_4).[T_xT_zR_x].R_z(q_5+\Delta q_5).[T_xT_yR_x].R_y(q_6+\Delta q_6).[T_xR_x].R_z(q_7)$
This model will be further used for geometric calibration of the Panda robot. let us collect parameters in a single vecotr.
Where
Parameters | ||||||
---|---|---|---|---|---|---|
Nominal Values (mm) | 0.333 | 0.316 | 0.0825 | -0.0825 | 0.384 | 0.088 |
There are different ways to compute the identification Jacobian matrix
The general transformation matrix of the manipulator geometric model based on semi-analytical differentiation is presented in the following form:
where :
-
$T_1 (q, π)$ and$T_2 ( q, π)$ : are the transformation matrices on the left and right sides of the currently considered parameter$\pi_k$ -
$H (π_k)$ refers to the elementary homogeneous transformation (which is either a translation or a rotation) related to the parameter$π_k$ . -
$T_{base}$ and$T_{tool}$ are the transformation matrices of the robot and the tool respectively.
The partial derivatives of T with respect to the parameter
-
$\dot H ( π_k)$ is the differential transformation matrix, which can be easily obtained analytically.It should be mentioned that these derivatives are computed in the neighborhood of the nominal values$π_0$
since any homogeneous matrix
- The position part of the Jacobian column is simply the vector
$p$ , so:
- The orientation part can be computed in a similar way but current orientation of the manipulator end-effector must be taken into account:
Matrix derivatives for geometric model of the robot
Parameters | Matrix derivative |
---|---|
Model correction
for our robot we considered only the following parameters to have deflections:
- The links lengths
- The joints positions
The initial value:
so we have 10 parameters to calibrate,by using the linearized model
$\Delta P_i=P_i-P_0$ $J_a=[J_1 \quad J_2 \cdots J_m]$ $\Delta P_{a}=[\Delta P_{1} \quad \Delta P_{2} \cdots \Delta P_{m}]$
Testing our soultion: we tested the model to get the errors:
Parameter | recovered error | actual error |
---|---|---|
q2 | -0.00986713374649666 | 0.01 |
d1 | 0.0031824970212210434 | 0.00316 |
q3 | -0.010195168119300014 | 0.01 |
d2 | 0.0007354404443950024 | 0.000825 |
q4 | 0.009942197257039613 | -0.01 |
d3 | -0.0007859627934828278 | -0.000825 |
d4 | 0.0038338831997834608 | 0.00384 |
q5 | 0.0008054082974624351 | 0 |
For path path planning we use Rapidly-exploring random tree algorithm known as RRT, we highly recommend to read the original paper by Steven M. LaValle to gain a solid understanding for the of how is algorithm works.
A rapidly exploring random tree (RRT) is an algorithm designed to efficiently search nonconvex, high-dimensional spaces by randomly building a space-filling tree. The tree is constructed incrementally from samples drawn randomly from the search space and is inherently biased to grow towards large unsearched areas of the problem. RRTs were developed by Steven M. LaValle and James J. Kuffner Jr. They easily handle problems with obstacles and differential constraints (nonholonomic and kinodynamic) and have been widely used in autonomous robotic motion planning and can be used to compute approximate control policies to control high dimensional nonlinear systems with state and action constraints.
For a general configuration space C, the algorithm in pseudocode is as follows:
Algorithm BuildRRT
Input: Initial configuration qinit, number of vertices in RRT K, incremental distance Δq
Output: RRT graph G
G.init(qinit)
for k = 1 to K do
qrand ← RAND_CONF()
qnear ← NEAREST_VERTEX(qrand, G)
qnew ← NEW_CONF(qnear, qrand, Δq)
G.add_vertex(qnew)
G.add_edge(qnear, qnew)
return G
Here are some examples:
Fig.5.1 - Example for path planning with multiple obstacles
Fig.5.2 - Example for path planning with multiple obstacles
We do some postprocessing to the path like smoothing using Bézier curve and path shortening.
The paths found by the planning methods of Section Path planning are collision-free but might not be optimal in terms of path length. Some planning methods allow finding optimal paths, such as PRM* or RRT*, but they tend to be much slower and more difficult to implement compared to their non-optimal counterparts PRM and RRT. An efficient and widely-used approach consists in post-processing the paths found by PRM and RRT to improve the path quality. The algorithm below shows how to post-process a path by repeatedly applying shortcuts.
'Algorithm: PATH_SHORTCUTTING
'Input: A collision-free path q
'Effect: Decrease the path length of q
FOR rep = 1 TO maxrep
Pick two random points t1, t2 along the path
IF the straight segment [q(t1),q(t2)] is collision-free THEN
Replace original portion by the straight segment
* Add an obstcale with position (x=0.5, y= 0.0,z= 0.5) and radius of r=0.05 (m)
* defive start point (x=0.45 , y= 0.25 , z= 0.5) and goal (x=0.45,y=-0.25 ,z=0.50 )
* generate the path
we implemented a feedforward controller
* take the numerical dervitave of (q1-q7) (from the generated) considering dt=0.01
* take the numerical dervitave of (dq1-dq7) considering dt=0.01
* now we have (q , dq ,ddq ) the input of our controller (feedforward controller)