This website contains my lecture notes from a lecture by Lorenzo Masia from the academic year 2022/2023 (University of Heidelberg). If you find something incorrect/unclear, or would like to contribute, feel free to submit a pull request (or let me know via email).
Acknowledgements
Thanks to Pascal Hansen and Kiryl Kiril for corrections.
An excellent resource for more formal an in-depth study is Robot modeling and Control by Mark W. Spong, which the lecture frequently references.
The first edition can be downloaded for free, while the second needs to be purchased (or downloaded too, if you know where to look).
Robotics Components
Definition (link/member): individual bodies making up a mechanism
Definition (joint): connection between multiple links
Definition (kinematic pair): two links in contact such that it limits their relative movement
low-order kinematic pairs: point of contact is a surface (eg. revolute/prismatic/spherical)
high-order kinematic pairs: point of contact is a dot/line (eg. gears)
Definition (kinematic chain): assembly of links connected by joints
is a closed loop (left image) if every link is connected to every other by at least two paths (including the ground β imagine it as a single link), else itβs open (right image)
Degrees of Freedom
This is pretty important and will most likely be on the final, so it is best to practice this. Here are some of the examples from the exercises with my solutions (sorry for my terrible drawing).
Definition (degree of freedom) of a mechanical system is the number of independent parameters that define its configuration. It can be calculated by the GrΓΌbler Formula:
DOF=Ξ»(nβ1)βi=1βjβciβ
where
Ξ»β¦ DOF of the operating space (3 for 2D, 6 for 3D)
in 2D itβs 1 for orientation and 2 for position
in 3D itβs 3 for orientation and 3 for position
n⦠number of links
j⦠number of kinematic pairs
notice that this is not the number of joints β if a joint includes more kinematics pairs, it needs to be split for the equation to work (see coincident joints below)
cjββ¦ degree of constraint of the i-th kinematic pair
eg. a revolute joint in 2D takes away 2 DOF (we can only rotate)
For example, the following has 3(4β1)β2β 4=1 DOF:
If youβre viewing this in dark theme, the links are colored light blue (red in the equation) and the joints are colored yellow (blue in the equation) β sorry!
Definition (coincident joints): when there are more than two kinematic pairs in the same joint
Actuators
Definition (actuator): a mechanical device for moving or controlling something
DC brushed motor: based on Lorentzβ force law (electromagnetic fields)
brushed because the metal brush powers the magnets (theyβre turning)
brushless uses the position of the motor to turn on/off currents for specific windings
usually contains gears reductions to trade torque for speed and sensors to measure the position of the motor (see further)
since the voltage controls the motor but setting it to a specific value is impractical, pulse width modulation (PWM) is used:
to measure the position of the motor, optical shaft encoders (incremental/absolute) are used:
Kinematics
establishment of various coordinate systems to represent the positions and orientations of rigid objects and with transformations among these coordinate systems
the dimension of the configuration space (n) must be larger or equal to the dimension of the task space (m) to ensure the existence of kinematic solutions: nβ₯m
Forward (direct) Kinematics
Definition (forward/direct kinematics): the process of finding the position/orientation of the end-effector(r1β,β¦,rmβ) given a set of joint parameters (q1β,β¦,qnβ).
(r1β,β¦,rmβ)=F(q1β,β¦,qnβ)
Body Pose
The pose/frame of a rigid body can be described by its position and orientation (wrt. a frame)
the position is a vector PβR3
the rotation is an orthonormal matrixRβR3Γ3 with det(R)=1 (a determinant of β1 would flip the object, we only want rotation)
important to remember for calculating robot kinematics (or just think about what the rotation about an axis is doing to the other two axes, itβs not too hard to remember)
positive values for the rotation are always counter-clockwise (just like normal rotations)
for remembering where the minus is, itβs flipped only for y
When discussing multiple frames, we use the following notation:
fromtoβR=toβRfromβ=Rfromtoβ
E.g. if we have the same point p0β,p1β,p2β in three different frames, we know that
For the inverse problem (calculating angles from a matrix of numbers), we can do
ΟΟΟβ=atan2(r2,3β,r1,3β)=atan2(r1,32β+r2,32ββ,r3,3β)Οβ(0,Ο)Β sinceΒ weΒ tookΒ +Β sign=atan2(r3,2β,βr3,1β)β
if we divide by zero somewhere we get degenerate solutions where we can only get the sum of the angles (one of the problems with Euler angles)
alternative is RPY angles, which are also three rotations (roll, pitch, yaw) and are just as bad
Denavit & Hartenberg Notation
This is a really important concept and will 99% be on the final, so it is best to practice this. Here is a useful PDF with examples (starting at page 13) where you can practice creating the DH tables and Forward Kinematics matrices.
For relating the base and the end effector, we need to both rotate and translate, so weβll use homogeneous coordinates (matrix is 4Γ4), encoding both rotation and translation:
To create the homogeneous coordinates in a standardized way, we use the Denavit & Hartenberg (DH) notation which systematically relates the frames of two consecutive links. We have 4 parameters, each of which relates frame i to frame iβ1:
parameter
meaning
link length aiβ
distance between ziβ and ziβ1β along xiβ
link offset diβ
distance between xiβ and xiβ1β along ziβ1β
link twist Ξ±iβ
angle between ziβ and ziβ1β around xiβ
joint angle Οiβ
angle between xiβ and xiβ1β around ziβ1β
A mnemonic to remember which parameter relates which is that itβs from a to z (i.e. a relates zs).
To get the final transformations, we can multiply the matrices and get T30β(q)=A10βA21βA32β
This will yield the entire homogeneous matrix β if we only want position (in this case a homogeneous one with the last element being 1), we can only focus on the last row, which can simplify the computation: p30β(q)=A10βA21βA32ββ (0,0,0,1)T
Things to keep in mind:
the Z axis is always the one we rotate about by Ο
if the joint is prismatic, Z axis is instead the one that moves by diβ
good idea to fill in the variables first and the rest after
Inverse Kinematics
Definition (inverse kinematics): the process of finding a set of joint parameters (q1β,β¦,qnβ) given the position/orientation of the end-effector(r1β,β¦,rmβ).
(q1β,β¦,qnβ)=G(r1β,β¦,rmβ)
Definition (redundancy): arises when there are multiple inverse solutions
When dealing with inverse kinematics, an important notion are workspaces:
primary workspace: set WS1β of positions p that can be reached with at least one orientation
secondary workspace: set WS2β of positions p that can be reached with all orientations
Analytical solution (closed form)
preferred (if it can be found)
use geometric inspection, solve system of equations
The matrix R is a ZYZ Euler rotation matrix and can be solved as such (see Body pose).
we use indexes 3 to 6, because the wrist is usually at an end of another manipulator
For solving various manipulators (SCARA, for example), the law of cosines might also be quite useful: c2a2b2β=a2+b2β2Β abcosΞ³=b2+c2β2Β bccosΞ±=a2+c2β2Β accosΞ²β
Definition (decoupling): dividing inverse kinematics problem for two simpler problems, inverse position kinematics and inverse orientation kinematics
is applicable for manipulators with at least 6 joints where the last 3 intersect at a point
the general approach is the following:
calculate the orientations and position where the wrist needs to be
calculate the orientations of the rest of the robot
Numerical solution (iterative form)
Two major ways of solving it, namely:
Newton method:
uses Taylor series around point qkβ to expand the forward kinematics r=F(q)=F(qkβ)+JacobianΒ J(qkβ)βqβF(qkβ)βββ(qβqkβ)+neglectedO(β£β£qβqkββ£β£2)ββ
stripping the higher-order terms and solving for q, we get rrβF(qkβ)Jβ1(qkβ)(rβF(qkβ))q=qk+1ββ=F(qkβ)+J(qkβ)(qβqkβ)=J(qkβ)(qβqkβ)=(qβqkβ)=qkβ+Jrβ1β(qkβ)error(rβF(qkβ)ββ)β
is nice when n=m, otherwise we have to use the pseudo-inverse
bad for problems near singularities (becomes unstable)
note: weβre using the Jacobian as a function here but itβs just a matrix
Gradient method:
aims to minimize the squared error (the 1/2 is there for nicer calculations): H(q)=21ββ£β£F(q)βrβ£β£=21β[F(q)βr]T[F(q)βr]
the gradient of βqβH(q) is the steepest direction to minimize this error: βqβH(q)=J(q)T[F(q)βr]
to move in this direction (given the current solution), we do the following: qk+1ββ=qkββΞ±βqβH(qkβ)=qkββΞ±J(q)T[F(q)βr]β
Ξ± should be chosen appropriately (dictates the size of iteration steps)
we donβt use the inverse but the transpose, which is nice!
may not converge but never diverges
The methods could also be combined β gradient first (slow but steady), then Newton.
Velocity Kinematics
relate linear/angular velocitiespΛβ of the end effector to those of the jointsqΛβ
ziβ1β is the orientation of the z axis in the (iβ1)th frame and
piβ1,EEβ is the distance from the center of the (iβ1)th frame to the end-effector
aΓb is the cross product between the vectors a,b, defined like this (just remember 2-3-1): aΓb=βa2βb3ββa3βb2βa3βb1ββa1βb3βa1βb2ββa2βb1βββ
And they can be calculated from the forward kinematics matrix (namely the DH matrices A):
ziβ1βpiβ1,EEββ=(R10β(q1β,β¦,qnβ)βofΒ matrixΒ A10βrotationΒ partβββ β¦β Riβ1iβ2β(q1β,β¦,qnβ)βofΒ matrixΒ Aiβ1iβ2βrotationΒ partββ)(0,0,1)TβjustΒ getΒ zβ=matrixΒ AEE0βinΒ lastΒ columnΒ ofβp0,EEβ(q1β,β¦,qnβ)βββmatrixΒ AEEiβ1βinΒ lastΒ columnΒ ofβp0,iβ1β(q1β,β¦,qiβ1βββ)β
We therefore get p0,1β=(a1βc1β,a1βs1β,0)Tp0,EEβ=(a1βc1β+a2βc12β,a1βs1β+a2βs12β,0)T
Since p1,EEβ=p0,EEββp0,1β, we get the ps and, as we see, z0β=z1β=z2β=(0,0,1)T
The full Jacobian matrix looks like this:
J=(z0βΓp0,EEβz0ββz1βΓp1,EEβz1ββ)=ββa1βs1ββa2βs12βa1βc1β+a2βc12β0001ββa2βs12βa2βc12β0001ββ
The rank of the matrix is between 1 and 2, depending on the joint configuration.
Higher-orders
For calculating other differential relations, we can just continue to derivate:
for square non-singular J, we can just do qΛβ=Jβ1(q)pΛβ
has problems:
qΛβ is large near singularities
for redundant robots, we donβt have an inverse (see pseudo-inverse)
Singularities
In configurations where the Jacobian loses rank, weβre in a kinematic singularity β we cannot find a joint velocity that realizes the desired end-effector velocity in an arbitrary direction of the task space. Close to the singularity, the joint velocities might be very large and exceed the limits.
To remedy this, certain methods exist that balance error and velocity to make the robot movement smoother, like damped least squares, which minimizes the sum of minimum error norm on achieved end-effector velocity and minimum norm of joint velocity.
Pseudo-inverse
In the case that there is no solution to JqΛβ=pΛβ (singularities, the robot simply canβt move that way, etc.), we still want to find a vector qΛβ that minimizes β£β£JqΛββpΛββ£β£
This turns out to be the vector qΛβ=J#pΛβ, where J# is the pseudo-inverse:
can be obtained using SVD and
satisfies the following conditions:
JJ#J=J
J#JJ#=J#
(J#J)T=J#J
(JJ#)T=JJ#
Force Kinematics
We can again use the Jacobian to relate forces of the end effector to those of the joints.
Given ΟβRnΓ1 as the vector of infinitesimal joint forces/torques and Ξ³βRmΓ1 as the vector of infinitesimal end effector forces/torques. Applying the principle of virtual work (the work of the forces applied to the system are zero: (dW=dFΒ dx=0)), we get
dWΟβdWΞ³ββΞ΄qΞ΄WΟββ=ΟTΒ dq=Ξ³eTβJ(q)Β dq=Ξ΄WΞ³ββ#Β joints#Β EE#Β virtualΒ workβ
Simplifying, we get Ο=JT(q)Ξ³
This creates kinetostatic duality of the Jacobian
As a linear algebra reminder:
rank(J): max number of rows/columns of J that are linearly independent
rank(J)β€min(m,n)
if the rank of J is full (typically m), then the robotβs EE can move in any direction; if not, there exists a direction in which the robot cannot move
range(J): vector subspace generated by all possible linear combinations of columns of J
i.e. is a set of all possible values of where J can map vectors
determines the velocities that EE can reach based on velocities of joints
kernel(J): vector subspace generated by all vectors v such that Jv=0
i.e. is a set of all possible values of where J maps to the vector 0
is the set of joint velocities that produce no EE velocity
Note that the problems are switched: compare the two equations pΛβ=J(q)qΛββvelocityΒ kinematicsβΟ=JT(q)Ξ³β(inverse)Β forceΒ kinematicsβ
for velocities, it is trivial to calculate the end-effector velocity from joint velocities
for torques, it is trivial to calculate the joint torques from the end-effector torques
For completeness, here are some properties of the Jacobian and its transpose:
range(J)range(JT)kernel(J)kernel(JT)range(J)+kernel(JT)range(JT)+kernel(J)β={pΛββRmβ£βqΛββRn,JqΛβ=pΛβ}={ΟβRnβ£βΞ³βRm,Ο=JTΞ³}={qΛββRnβ£JqΛβ=0}={Ξ³βRmβ£JTΞ³=0}=Rm=Rnβ
Trajectory Planning
Task: generate reference inputs to the controller when given:
only start and end defined (minimum requirements)
sequence of points defined (more difficult)
Definition (path): set of points in the joint space which the manipulator has to follow in the execution of the assigned motion (purely geometric).
Definition (trajectory): a path on which a timing is specified (velocities, accelerations, etc.).
i.e. trajectory = geometric path + time law
notation is q=q(Ξ»)βΞ»=Ξ»(t)
To plan the trajectory, we do the following:
get the sequence of pose points (i.e. knots) in the Cartesian space
create a geometric path linking the knots (interpolation)
sample the path and transform the sequence to the Joint space
interpolate in the Joint space
We do this because planning in the Cartesian space can easily move the robot into configurations that canβt be realized, which isnβt the case for the Joint space.
The time law is chosen based on task specification:
stop at a point, move at constant velocity
considers constraints and capabilities (max velocity, accelerations)
may attempt to optimize some metric (min transfer time, min energy, etc.)
In Joint Space
Task: smoothly interpolate between points in the joint space
Cubic polynomial
Useful for interpolating between two positions (q0β,q1β) given the start and end velocity (v0β,v1β):
q(0)=q0βq(1)=q1βqβ²(0)=v0βqβ²(1)=v1β
The cubic polynomial in the normalized form is the following: q(Ξ»)=q0β+βq[aΞ»3+bΞ»2+cΞ»+d]forΒ βq=q1ββq0β;Ξ»β[0,1]
Plugging for known values helps us solve the polynomial:
q(0)=q0ββd=0
qβ²(0)=βqβ cβc=v0β/βq
q(1)=q1ββa+b+c=1
qβ²(1)=βqβ (3a+2b+c)β3a+2b+c=v1β/βq
If we donβt care about normalization, the general form is the following: q(Ξ»)=aΞ»3+bΞ»2+cΞ»+d
Splines
When we have N knots and want continuity up to the second derivative, we can concatenate Nβ1 cubic polynomials, which minimizes the curvature among all interpolating functions (with 2nd derivatives)
4(Nβ1) coefficients
4(Nβ1)β2 conditions:
2(Nβ1) for the positions of the knots
2(Nβ2) for the continuity for first and second derivative at the internal knots
β we have 2 free parameters for assigning v1β,vNβ
In Cartesian Space
Notation here is p=p(s)βs=s(t) (as opposed to q=q(Ξ»)βΞ»=Ξ»(t)), since weβre planning the position of the end-effector, not the position in the joint space.
Has advantages and disadvantages:
[+] allows more direct visualization of the generated path
[+] can account for obstacles + lack of βwanderingβ
[-] needs on-line kinematic inversion
When calculating the path:
for simplicity, position and orientation are considered separately
the number of knots is typically low (2 or 3), simple interpolating paths are considered
Position
Given piβ,pfβ,vmaxβ,amaxβ and viβ,vfβ (usually 0), we want to analyze the trajectory.
For a linear path from piβ to pfβ:
path parametrization is p(s)=piβ+s(pfββpiβ) with sβ[0,1]
setting s=Ο/L,Οβ[0,L] (given the length of the path)
we can differentiate to get velocity and acceleration: pΛβpΒ¨ββ=dsdpβsΛ=ds2d2sβsΛ2+dsdpβsΒ¨β=(pfββpiβ)sΛ=LpfββpiββΟΛ=(pfββpiβ)sΒ¨=LpfββpiββΟΒ¨β
For the motion, we use the trapezoidal speed (bang-coast-bang):
To generalize this (i.e. concatenate the paths), we can over-fly the point in between.
A specific example of how this would look like is the following:
Orientation
use minimal representations (e.g. ZYZ Euler angles) and plan the trajectory independently
use axis/angle representation:
determine a neutral axis and an angle by which to rotate
plan a timing law to interpolate the angle and the axis
Optimal trajectories
For Cartesian robots (PPP):
straight line joining the two positions is one of those
can be executed in minimum time under velocity-acceleration constraints
optimal timing law is the bang-coast-bang
For articulated robots (at least one R):
and 2. are no longer true in general case, but time-optimality still holds in the joint space
note that straight lines in joint space donβt correspond to those in Cartesian space!
Uniform time scaling
Say we want to slow a given timing law down or speed it up because of constraints, we donβt need to recalculate all of the motion profiles: velocity scales linearly, acceleration scales quadratically:
dp/dtd2p/dt2β=dp/dsβ ds/dΟβ 1/T=(d2p/ds2β (ds/dΟ)2+dp/dsβ d2s/dΟ2)β 1/T2β
Minimum uniform time scaling is therefore k=max{1,kvelβ,kaccββ}
Manipulability
Velocity manipulability
In a given configuration, we want to evaluate how βeffectiveβ is the mechanical transformation between joint velocities and EE velocities (how βeasilyβ can EE move in various directions of the task space).
we consider all EE velocities that can be obtained by choosing joint velocities of unit norm:
qΛβTqΛβ=ellipsoidvTJ#TJ#vββ=1
Force manipulability
We can apply the exact same concept to forces:
ΟTΟ=ellipsoidFTJJTFββ=1
The comparison between the two is interesting β they are orthogonal (velocity left; force right):
The explanation that the teacher gave in class is pretty good: if your arm is almost stretched, it can move very quickly up and down but not too quickly forward/backward. On the other hand (pun not intended), the forces you can apply up/down are not nearly as large as when pushing/pulling.