HW3: Tool Orientation of PincherX 100 Robot Arm Using Exponential Coordinates and Some Exercise Questions - madibabaiasl/kinematics-robotic-arms-modern-approach GitHub Wiki
Learning Objectives
- Apply exponential coordinate representation to determine the orientation of a robotic manipulator.
- Use Rodrigues’s formula to compute orientation matrices through code and symbolic math.
- Express robot orientations using ZYX Euler angles and verify them in simulation.
Learning Outcomes
After completing this homework, you will be able to:
- Calculate the orientation of the PincherX 100 tool frame using exponential coordinates.
- Implement matrix exponentials and skew-symmetric matrices in Python to compute rotation matrices.
- Determine if a given desired orientation is achievable within the robot’s joint limits.
- Extract Euler angles from a given rotation matrix and verify their correctness using simulation tools such as RViz and RoboDK.
- Recognize how different mathematical representations describe the same physical orientation of a robot’s end-effector.
Why This Matters
In Lesson 4, you learned how exponential coordinates and Euler angles provide compact and intuitive ways to represent orientation: the “how” of rotational motion. This homework brings that theory into practice by applying those tools to a real robot, the PincherX 100. Using exponential coordinates, you will express the robot’s orientation as a series of rotations about joint axes, just as the robot physically moves. Then, by comparing it to the rotation matrix, you’ll see how different mathematical languages can describe the same orientation.
Objectives of HW 3
- Reiterate the concepts learned regarding the orientation of the robot arm, and show you alternative methods for calculating the orientation of the PincherX 100 robot arm's end effector.
- Practice more on orientation in robotics (Exponential Coordinates and Euler Angles)
Required hardware and software
- Computer running Ubuntu 22.04
- PincherX 100 robot arm along with its RViz simulation environment
- Python programming environment (VS code)
- Pen and paper
Part 1: Tool Orientation of the Pincherx 100 Robot Arm Using Exponential Coordinates
Similar to what we did in the previous homework, we want to find the orientation of the tool frame w.r.t the base frame but this time using exponential coordinates of rotation.
Step 1. Using the diagram that you drew in HW 2, find the orientation of the tool frame w.r.t the base frame for the set of joint angles $\theta_1 = 90^{0}, \theta_2 = -45^{o}, \theta_3 = 0, \theta_4 = 45^{o}$ using exponential coordinates. Complete the following equation (7 points):
$R = Ie^{[\hat{z}]\theta_1}e^{[\hat{y}]\theta_2}--$.
Note here that since all rotations starting from the first joint happen w.r.t the current (body) frame (you can verify this with your joint control code of the robot), we post-multiply all the rotations.
Now write a Python program that can calculate the rotation matrix R. Follow these steps:
-
Calculate the skew-symmetric matrices $
[\hat{z}]$, and $[\hat{y}]$ (7 points). -
Use Rodrigue's formula to find each exponential function (7 points).
-
Find the final result by multiplying the successive rotations (7 points).
You can start with the following code:
import numpy as np
np.set_printoptions(suppress=True)
# Angles in radians
theta_1 =
theta_2 =
theta_3 =
theta_4 =
# Skew-symmetric matrices
z_hat_bracket =
y_hat_bracket =
# Calculate the rotation matrices using Rodrigue's formula
e_z_hat_bracket_theta_1 =
e_y_hat_bracket_theta_2 =
e_y_hat_bracket_theta_3 =
e_y_hat_bracket_theta_4 =
# Calculate the final rotation matrix product of exponentials
R =
# Print the final rotation matrix
print(R)
# Question: Is this familiar to you?
Is this rotation matrix familiar to you? (7 points)
Step 2. Can the tool of the Pincherx 100 robot arm reach the following orientation? In other words, what is the set of joint angles that can give the following orientation of the tool frame?
$R_{desired} = \begin{pmatrix} -1 & 0 & 0\\ 0 & 0 & -1\\ 0 & -1 & 0 \end{pmatrix}$.
To solve this follow the steps below:
a) Solve the final tool orientation symbolically from the multiplication of the exponential functions. You can complete the code below (7 points):
import sympy as sp
# Define symbolic variables
t1, t2, t3, t4 = sp.symbols('t1 t2 t3 t4')
# Define the skew-symmetric matrices
z_hat_bracket = sp.Matrix()
y_hat_bracket =
# Calculate e_bracket_z_t1
e_bracket_z_t1 = sp.eye(3) + ...
# Calculate e_bracket_y_t2
e_bracket_y_t2 =
# Calculate e_bracket_y_t3
e_bracket_y_t3 =
# Calculate e_bracket_y_t4
e_bracket_y_t4 =
# Calculate the final result
result = e_bracket_z_t1 @ e_bracket_y_t2 @ e_bracket_y_t3 @ e_bracket_y_t4
# Simplify the result
simplified_result = sp.simplify(result)
# Display the simplified result
print(simplified_result)
b) Now equate this orientation to the desired orientation given above. What do you see? Can the tool frame of the Pincherx 100 reach the given orientation? In other words, can you find $\theta_1$, $\theta_2$, $\theta_3$, and $\theta_4$ such that the desired orientation can be achieved (7 points)?
Part 2: Determining the ZYX Euler Angles for the Robotic Wrist's Desired Orientation
Suppose we have a robotic wrist mechanism that has 3 DOF, and the axes of three joints intersect at a point. Initially, the wrist mechanism is in its zero position, meaning that all three joint angles are set to zero.
Given the rotation matrix representing the wrist's orientation (w.r.t the world frame) as:
$\begin{pmatrix} 0.866 & -0.5 & 0 \\ 0.5 & 0.866 & 0 \\ 0 & 0 & 1 \\ \end{pmatrix}$
- Draw the coordinate frame representing this orientation using the code that you wrote in HW 2 (7 points).
- Determine the ZYX Euler angles $
(\alpha,\beta,\gamma) \in [0, 2\pi)$ that represent this orientation of the robotic wrist (7 points). - Download and install the free version of RoboDK, add a coordinate frame, then choose ABB/KUKA/Nachi from the drop-down menu and apply these sets of angles that you calculated. Do you get the same orientation as your drawn coordinate frame? Show this (9 points). Also, check and show if the two sets of Euler angles that you calculated give the same orientation (8 points).
Report Requirements for Homework 3
- Submit reports individually.
- Title, Name (5 points)
- Meeting the requirements of each part or question above that has points in front of it.
- Reflection: A short reflection on any interesting observations, surprises, difficulties, new directions that can be taken and any other feedback you may have (10 points)
- References: Note that utilizing (or not utilizing) AI should be disclosed here. You can use AI according to the allowed instances in the Syllabus. Also, 100% AI-generated content will get 0 (5 points).
- The codes can be submitted through a GitHub repo (with link provided) or alternatively be uploaded to/included in the submission.
Note: This activity is eligible for "best report" points in our reward system (see the reward system sheet for the criteria).