100% found this document useful (1 vote)
10 views

Modelling Robots

The document discusses kinematic modeling for robots, focusing on Forward Kinematics (FK) and Inverse Kinematics (IK). It explains the use of Denavit-Hartenberg parameters and homogeneous transformation matrices for FK, while detailing numerical methods for solving IK, including Jacobian-based approaches. Additionally, it covers differential drive kinematics for mobile robots and provides examples and pseudocode for both FK and IK computations.

Uploaded by

PENIEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
10 views

Modelling Robots

The document discusses kinematic modeling for robots, focusing on Forward Kinematics (FK) and Inverse Kinematics (IK). It explains the use of Denavit-Hartenberg parameters and homogeneous transformation matrices for FK, while detailing numerical methods for solving IK, including Jacobian-based approaches. Additionally, it covers differential drive kinematics for mobile robots and provides examples and pseudocode for both FK and IK computations.

Uploaded by

PENIEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Modelling clarification request

Could you please clarify what you mean by "Modelling"? Are you referring to:

3D modeling (e.g., using software like SolidWorks, Blender, or AutoCAD)?

Mathematical or system modeling (e.g., for control systems or simulations)?

Statistical or machine learning modeling?

Process or data modeling (e.g., UML, ER diagrams)?

Fashion or character modeling?

Let me know the context so I can give you the most relevant help.

Great! You're referring to kinematic modeling for robots, which involves:

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.

🔧 Forward Kinematics (FK)


FK is generally straightforward and uses:

Denavit–Hartenberg (DH) parameters to represent the geometry of each link.

Homogeneous transformation matrices to combine the motion from each joint to the
next.

Steps:

1. Define the DH table for each link/joint.

2. Compute the transformation matrices.

3. Multiply them in sequence to get the final pose of the end-effector.

🔍 Inverse Kinematics (IK)


1/13
IK is more complex. There can be:

Multiple solutions (especially for arms with more than 2 DoF),

No solution (if the target pose is unreachable),

Singularities (where joint movement doesn’t affect the end-effector pose).

There are two main approaches:

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.

✅ Example: 2-DOF Planar Arm (Simplified)


Let:

Joint 1 (shoulder): angle = θ₁

Joint 2 (elbow): angle = θ₂

Link lengths: L₁ and L₂

Forward Kinematics:

x = L1 ∗ cos(θ1 ) + L2 ∗ cos(θ1 + θ2 )y = L1 ∗ sin(θ1 ) + L2 ∗ sin(θ1 + θ2 )


​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Inverse Kinematics (solving for θ₁ and θ₂ from x and y):

1. Use the law of cosines:

cos(θ2 ) = (x2 + y 2 − L21 − L22 )/(2 ∗ L1 ∗ L2 )


​ ​ ​ ​ ​

2. Then solve for θ₁ using trigonometry.

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).

Each wheel can rotate independently.

Robot moves forward/backward or rotates based on wheel speeds.

Let:

R = radius of each wheel


L = distance between wheels (wheelbase)
ωL , ωR = angular velocities of left and right wheels (rad/s)
​ ​

vL = RωL , vR = RωR = linear velocities of the wheels


​ ​ ​ ​

🧮 Forward Kinematics (Kinematic Model)


To compute the robot’s linear and angular velocity in its local (robot-centered) frame:

Linear and Angular Velocity

vR + vL
v=
​ ​

2

vR − vL
ω=
​ ​

L
Where:

v is the forward linear velocity of the robot


ω is the angular velocity (rotation about the vertical axis)

📍 Position Update (Global Frame)


Let the robot's pose be:

(x, y) = position in world coordinates


θ = orientation (angle w.r.t. x-axis)

3/13
Then the differential equations for position are:

ẋ = v cos(θ)

ẏ = v sin(θ)

θ̇ = ω

Substitute v and ω from earlier:

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

🧠 Summary of Use Cases:


Forward kinematics: simulate motion from wheel speeds.

Inverse kinematics: compute wheel commands to achieve a desired motion.

Used in path following, odometry, and trajectory tracking.

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.

🤖 Forward Kinematics with Homogeneous Transforms


1. What Is Forward Kinematics?
In robotics, FK calculates the position and orientation (pose) of the end-effector given
known joint parameters (angles or displacements).

2. Why Use Homogeneous Transformation Matrices?


They combine:

Rotation (3×3 matrix)

Translation (3×1 vector)


Into a single 4×4 matrix that allows for efficient chaining of transformations between
links.

3. Basic Homogeneous Transformation Matrix


A transform from frame i to frame i − 1:

Rii−1 di−1
Tii−1 =[ i ]
​ ​

000 1
​ ​ ​

Where:

Rii−1 : 3×3 rotation matrix


di−1
i : 3×1 translation vector

4. Denavit–Hartenberg (DH) Parameters

5/13
Each link is described by 4 parameters:

Parameter Description

θi ​ Joint angle (variable for revolute)

di ​ Offset along Z-axis

ai ​ Link length along X-axis

αi ​ Twist angle between Z axes

5. DH-Based Transformation Matrix

cos θi ​ − sin θi cos αi


​ ​ sin θi sin αi
​ ​ ai cos θi
​ ​

sin θi cos θi cos αi − cos θi sin αi ai sin θi


Tii−1 =
​ ​ ​ ​ ​ ​ ​

0 sin αi cos αi di
​ ​ ​ ​ ​ ​ ​

​ ​ ​

0 0 0 1

6. Overall Forward Kinematics


Given a robot with n joints, the final transformation from base to end-effector is:

T0n = T01 ⋅ T12 ⋅ ⋯ ⋅ Tn−1


​ ​
n
​ ​

Each Tii−1 is built using the DH parameters of link i.


✅ Example: 2-DOF Planar Arm (Revolute Joints)


Let:

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
​ ​

sin θ1 cos θ1 0 a1 sin θ1


T10 =
​ ​ ​ ​

0 0 1 0
​ ​ ​ ​ ​ ​ ​

0 0 0 1

cos θ2 ​ − sin θ2 ​ 0 a2 cos θ2


​ ​

sin θ2 cos θ2 0 a2 sin θ2


T21 =
​ ​ ​ ​

0 0 1 0
​ ​ ​ ​ ​ ​ ​

0 0 0 1

Final transformation:

T02 = T10 ⋅ T21


​ ​

Multiply them to get the position of the end-effector.

Would you like me to compute the full matrix multiplication for that 2-DOF arm or give you
Python/MATLAB code for it?

🔄 Numerical Inverse Kinematics (IK)


Numerical IK solves for joint variables iteratively, often using optimization or Jacobian-based
methods. This is crucial for robots with more than 3 degrees of freedom (DoF), where
analytical IK becomes complex or impossible.

📌 Key Concepts
Let:

q = [q1 , q2 , ..., qn ]T be the joint variables (angles or displacements).


​ ​ ​

x = f (q) be the forward kinematics function, giving the end-effector position and
orientation.

The goal is:

Find q such that f (q) = xdesired ​

We use iterative updates:

7/13
qk+1 = qk + Δq
​ ​

Where Δq is computed to minimize the pose error:

e = xdesired − f (qk ) ​ ​

🔧 Jacobian-Based Methods
The Jacobian J(q) relates joint velocities to end-effector velocities:

ẋ = J(q)q̇ ​

Use this to compute joint updates:

Δq = J † (q) ⋅ e

Where J † is the pseudoinverse of J :

For square and full-rank Jacobians:

J † = J −1
For redundant (more DoF than task space) or non-square systems:

J † = J T (JJ T )−1

🔁 Iterative Numerical IK Algorithm


1. Initialize joint angles q0 ​

2. Compute current end-effector pose f (qk ) ​

3. Calculate error e = xdesired − f (qk )


4. Compute Jacobian J(qk ) ​

5. Update joint angles:

qk+1 = qk + λJ † (qk )e
​ ​ ​

(λ = step size or damping factor)

6. Repeat until ∥e∥ is below a threshold

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.

Newton-Raphson: Uses second-order derivatives (less common due to complexity).

Levenberg–Marquardt: Hybrid between Gauss-Newton and gradient descent.

✅ Python Pseudocode Example (2D Arm)


python

import numpy as np

def forward_kinematics(q, link_lengths):


theta1, theta2 = q
l1, l2 = link_lengths
x = l1 * np.cos(theta1) + l2 * np.cos(theta1 + theta2)
y = l1 * np.sin(theta1) + l2 * np.sin(theta1 + theta2)
return np.array([x, y])

def jacobian(q, link_lengths):


theta1, theta2 = q
l1, l2 = link_lengths
j11 = -l1 * np.sin(theta1) - l2 * np.sin(theta1 + theta2)
j12 = -l2 * np.sin(theta1 + theta2)
j21 = l1 * np.cos(theta1) + l2 * np.cos(theta1 + theta2)
j22 = l2 * np.cos(theta1 + theta2)
return np.array([[j11, j12],
[j21, j22]])

def inverse_kinematics_numerical(x_desired, q_init, link_lengths, max_iter=100,


tol=1e-3):
q = np.array(q_init)
for i in range(max_iter):
x_current = forward_kinematics(q, link_lengths)

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.

🔄 Generalized Numerical Inverse Kinematics for Robots


Numerical IK is a method to compute joint parameters for any robot manipulator or mobile
system, based on a desired end-effector pose (position and/or orientation). It works
iteratively, using optimization and Jacobian-based updates.

✅ Problem Statement (General)


Given:

A robot with n joints → joint vector q = [q1 , ..., qn ]T


​ ​

A desired end-effector pose xdes ​


∈ Rm (typically m = 6: 3 for position, 3 for
orientation)

Goal:

Find q∗ such that f (q∗ ) = xdes ​

Where:

f (q) is the forward kinematics function mapping joint space to task space

10/13
⚙️ General Iterative Numerical IK Algorithm
Step 1: Initialization

Start with an initial guess:

q0 = initial joint configuration


Step 2: Loop

Repeat until convergence:

1. Forward Kinematics: Compute current pose

xk = f (qk )
​ ​

2. Compute Error:

ek = xdes − xk
​ ​ ​

3. Compute Jacobian:

∂f
Jk = ∈ Rm×n
∂q
​ ​ ​ ​

qk ​

This gives the relationship:

ẋ = Jk q̇ ​

4. Update Rule (using pseudoinverse or damping):


Δ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.

📘 Jacobian Pseudoinverse (General Case)


For any robot:

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

🎯 Features of Numerical IK for General Robots


Feature Notes

✅ Works on any robot Serial, parallel, redundant, mobile

🔁 Iterative Not closed-form; needs multiple steps

⚠️ Needs Jacobian Must compute or approximate it

🧩 Handles constraints Via cost functions or joint limits

🔄 Can optimize secondary goals E.g., posture, joint minimization

🧠 Example Applications
6-DOF industrial arms (e.g., UR5, KUKA)

7-DOF redundant arms (e.g., Baxter)

Legged robots (inverse kinematics for foot placement)

Mobile manipulators (base + arm coordination)

Humanoid robots (e.g., posture balance, walking)

💡 Additional Enhancements
12/13
Joint limits: clamp q within limits at each step

Orientation error: use axis-angle or quaternion difference

Optimization-based IK: define a cost function C(q) and solve:

min ∥f (q) − xdes ∥2 + penalties


​ ​

Would you like code for a generalized numerical IK implementation, or integration into ROS
or MATLAB Robotics Toolbox?

13/13

You might also like