Modelling Robots
Modelling Robots
Could you please clarify what you mean by "Modelling"? Are you referring to:
Let me know the context so I can give you the most relevant help.
1. Forward Kinematics (FK) – Determining the position and orientation of the robot's
end-effector given the joint parameters (angles for revolute joints or displacements for
prismatic joints).
2. Inverse Kinematics (IK) – Determining the joint parameters required to place the end-
effector at a desired position and orientation.
Homogeneous transformation matrices to combine the motion from each joint to the
next.
Steps:
Analytical IK: Solve equations algebraically (feasible for simple 2-3 DoF arms).
Numerical IK: Iterative methods (Jacobian-based, gradient descent, etc.), used for
complex robots.
Forward Kinematics:
Would you like me to walk you through a full example of FK and IK for a specific robot (e.g.,
2-DOF or 3-DOF arm)?
Differential drive is a common locomotion method used in mobile robots, especially two-
wheeled robots, where each wheel is independently driven. Understanding its kinematic
model is essential for robot navigation and control.
2/13
🧭 Differential Drive Robot Overview
Two wheels separated by a distance L (wheelbase).
Let:
vR + vL
v=
2
vR − vL
ω=
L
Where:
3/13
Then the differential equations for position are:
ẋ = v cos(θ)
ẏ = v sin(θ)
θ̇ = ω
vR + vL
ẋ = cos(θ)
2
vR + vL
ẏ = sin(θ)
2
vR − vL
θ̇ =
L
These equations model how the robot's position and orientation evolve over time.
🔄 Inverse Kinematics
Given desired v and ω , find wheel velocities:
L
vR = v + ω
2
L
vL = v − ω
2
Or in angular form:
vR vL
ωR = , ωL =
R R
Would you like a diagram or simulation code (e.g., in Python or MATLAB) to visualize this?
4/13
Great — let’s now dive into Forward Kinematics (FK) using Homogeneous Transformation
Matrices, which are foundational for modeling multi-link robotic arms.
Rii−1 di−1
Tii−1 =[ i ]
000 1
Where:
di−1
i : 3×1 translation vector
5/13
Each link is described by 4 parameters:
Parameter Description
0 sin αi cos αi di
0 0 0 1
Link lengths: a1 , a2
Joint angles: θ1 , θ2
Assume α1 = α2 = d 1 = d 2 = 0
Then:
6/13
cos θ1 − sin θ1 0 a1 cos θ1
0 0 1 0
0 0 0 1
0 0 1 0
0 0 0 1
Final transformation:
Would you like me to compute the full matrix multiplication for that 2-DOF arm or give you
Python/MATLAB code for it?
📌 Key Concepts
Let:
x = f (q) be the forward kinematics function, giving the end-effector position and
orientation.
7/13
qk+1 = qk + Δq
e = xdesired − f (qk )
🔧 Jacobian-Based Methods
The Jacobian J(q) relates joint velocities to end-effector velocities:
ẋ = J(q)q̇
Δq = J † (q) ⋅ e
J † = J −1
For redundant (more DoF than task space) or non-square systems:
J † = J T (JJ T )−1
qk+1 = qk + λJ † (qk )e
8/13
🧠 Variants and Improvements
Damped Least Squares (DLS): Handles singularities better.
J † = J T (JJ T + λ2 I)−1
Gradient Descent IK: Minimizes a cost function, slower but robust.
import numpy as np
9/13
error = x_desired - x_current
if np.linalg.norm(error) < tol:
break
J = jacobian(q, link_lengths)
dq = np.linalg.pinv(J) @ error
q += dq
return q
Would you like this for a 3D robot arm or with orientation included using rotation matrices
or quaternions?
Certainly! Here's a generalized explanation of Numerical Inverse Kinematics (IK) for any
type of robot, not limited to planar arms or specific configurations.
Goal:
Where:
f (q) is the forward kinematics function mapping joint space to task space
10/13
⚙️ General Iterative Numerical IK Algorithm
Step 1: Initialization
Step 2: Loop
xk = f (qk )
2. Compute Error:
ek = xdes − xk
3. Compute Jacobian:
∂f
Jk = ∈ Rm×n
∂q
qk
ẋ = Jk q̇
†
Δq = Jk ⋅ ek
qk+1 = qk + λΔq
λ: step size
Jk† : pseudoinverse (can use Damped Least Squares if near singularity)
5. Check convergence:
If ∥ek ∥
< tolerance, stop.
11/13
Underactuated or square system:
J † = J T (JJ T )−1
Redundant system (n > m):
J † = (J T J)−1 J T
Damped Least Squares (to avoid singularities):
J † = J T (JJ T + λ2 I)−1
🧠 Example Applications
6-DOF industrial arms (e.g., UR5, KUKA)
💡 Additional Enhancements
12/13
Joint limits: clamp q within limits at each step
Would you like code for a generalized numerical IK implementation, or integration into ROS
or MATLAB Robotics Toolbox?
13/13