Skip to content

HW 4: Orientation in Robotics ‐ Exponential Coordinates, and Euler Angles

Madi Babaiasl edited this page Nov 25, 2023 · 1 revision

This homework assignment is designed to test your understanding of Exponential coordinates of rotation and Euler angles.

Question 1:

In terms of the $\hat{x}_s$, $\hat{y}_s$, $\hat{z}_s$ coordinates of a fixed space frame {s}, the frame {a} has its $\hat{x}_a$ axis pointing in the direction (0,0,1) and its $\hat{y}_a$ axis pointing in the direction (-1,0,0), and the frame {b} has its $\hat{x}_b$ axis pointing in the direction (1,0,0) and its $\hat{y}_b$ axis pointing in the direction (0,0,-1).

(a) Calculate the matrix logarithm $[\hat{\omega}]\theta$ of $R_{sa}$. Do this first by hand, then write a Python/MATLAB program that gets a rotation matrix and gives its axis-angle representation. Also, the program should be able to draw the axis in the {s} frame. Verify that what you have calculated by hand is the same as the axis and angle that your program provided. Note that your program should be able to handle all cases of rotation matrices.

(b) Calculate the matrix exponential corresponding to the exponential coordinates of rotation $\hat{\omega}\theta = (1,2,0)$. Draw the corresponding frame relative to {s}, as well as the rotation axis $\hat{\omega}$. Write a Python/MATLAB program that verifies this for you.

Question 2:

(a) Given the rotation matrix

$R = \begin{pmatrix} 0 & 0 & 1\\ 0 & -1 & 0\\ 1 & 0 & 0 \end{pmatrix}$

find all possible values for $\hat{\omega} \in \mathbb{R}^3, ||\hat{\omega}|| = 1$, and $\theta \in [0,2\pi)$ such that $e^{[\hat{\omega}]\theta} = R$. Verify this by the code that you wrote in the previous question.

(b) The two vectors $v_1,v_2 \in \mathbb{R}^3$ are related by

$v_2 = Rv_1 = e^{[\hat{\omega}]\theta}v_1$

where $\hat{\omega} \in \mathbb{R}^3$ has length 1, and $\theta \in [-\pi,\pi]$. Given $\hat{\omega} = (\frac{2}{3},\frac{2}{3},\frac{1}{3}), v_1 = (1,0,1), v_2 = (0,1,1)$, find all the angles $\theta$ that satisfy the above equation.

Question 3: XYZ Roll-Pitch-Yaw angles

Another type of Euler Angles that is very common in aerospace applications is called XYZ Roll-Pitch-Yaw angles. Roll-pitch-yaw angles are a sequence of rotations about axes of the space frame. Visualize Roll-Pitch-Yaw angles as a sequence of rotations relative to the space frame as the following:

roll-pitch-yaw-angles-visualization-four-frames-2

Visualization of the XYZ roll-pitch-yaw angles. The body frame is initially coincident with the space frame and then goes through a rotation about the space frame’s x-axis followed by a rotation about the space frame’s y-axis and finally a rotation about the space frame’s z-axis.

The terms roll, pitch, and yaw are traditionally used to describe the rotational motion of a ship or an aircraft where the roll is considered to be in the forward motion direction, the pitch is in the direction of the wing, and the yaw is towards the ground (or up):

roll-pitch-yaw-airplane.-.HD.720p.mov

Demonstration for roll-pitch-yaw angles. This simulation is from the website www.wolfram.com.

(a) Find the rotation matrix that represents XYZ roll-pitch-yaw angles depicted above. Note here that all the rotations happen w.r.t the space frame (successive rotations about the fixed frame axes).

(b) The result that you get from (a) should be the same as the ZYX Euler angles that we studied in the lesson. Though the orientations are the same at the end, does this mean that the physical interpretations are the same as well? Think about this in terms of the order in which the rotations are written and how they are happening.

(c) Inverse problem: Suppose the representation of an orientation is given by a rotation matrix R as:

$R = \begin{pmatrix} 0.6 & 0.79 & -0.01\\ 0.47 & -0.34 & 0.81\\ 0.64 & -0.5 & -0.58\ \end{pmatrix}$

Find the equivalent sets of roll-pitch-yaw angles that can represent this orientation. You should find two sets of roll-pitch-yaw angles that give the same orientation. Show this in simulation using RoboDk that these two sets of Euler angles will result in the same orientation (in the drop-down menu use a convention that uses XYZ roll-pitch-yaw angles for the rotation).

Question 4: Converting the Orientation given by roll-pitch-yaw angles to the Equivalent Euler Angles

Suppose that we have a remote controller with a known orientation given by the roll-pitch-yaw angles $(\gamma_{rpy},\beta_{rpy},\alpha_{rpy})$:

remote-control-roll-pitch-yaw-angles

The orientation of the remote control is given by the set of roll-pitch-yaw angles. In practical applications, the orientation of an object can be measured using sensors such as a gyroscope.

(a) We want to find a transformation that transforms the orientation of the remote control given by roll-pitch-yaw angles $(\gamma_{rpy},\beta_{rpy},\alpha_{rpy})$ to the ZYZ Euler angles (successive rotations in the body frame) $(\alpha_{zyz},\beta_{zyz},\gamma_{zyz})$ representation of the orientation of the robotic hand.

ZYZ euler angles

  • Note: think about the orientation of the remote control as the desired (known) orientation that the robot hand wants to achieve. What sets of ZYZ Euler angles does it need? You will get two sets of such angles.

  • You can always use MATLAB/Python's symbolic computing features for ease of calculations. For example, in MATLAB you can define theta as a symbol like: syms theta and from that time you can use theta and it will do all calculations symbolically (use simplify function to make the answer simpler if possible). For Python, we learned how to do that in this lesson's lab.

(b) As a numerical example, if the sensor attached to the remote control measures the orientation of the remote control approximately as the Roll-Pitch-Yaw angles of $(30^{o},60^{o},45^{o})$, then in order for the robotic hand to follow this orientation, find the ZYZ Euler angles using the equations that you symbolically calculated above.

(c) Use RoboDK and show that these sets of Euler angles will give the same orientation as the set of the roll-pitch-yaw angles representing the orientation of the remote. Record a video of your demonstration.

Submission:

  • Submit your answers via Canvas in a PDF and video format. It is OK to write the math and draw the drawings by hand if you are short of time. If the video is large you can include a link to a Drive and I can download it from there.

  • For the coding section, give a link to your GitHub page so that I can check the code.

Good luck!

Clone this wiki locally