R1. Rotations and homogenous transformations

Table of Contents

1 Info

The assignment presents properties of rotations and homogenous transformations in 2D and 3D cases.

The points marked with (*) are optional (not obligatory).

2 Preparation

Download and Unpack

Download the Robotic toolbox package from the link on laboratory page. Unzip the package in your matlab tollbox directory (e.g ~/matlab/toolbox).

Install

>> addpath <your toolboxes directory>/rvctools/
>> startup_rvc

3 Tasks

Task 1: Planar rotations

  • Choose a value of an angle θ
  • Write a formula for a rotation matrix R in planar case (\mathcal{R}2)
  • Define matrix R1 in Matlab
    >>  R1=rot2( theta )
    

    check transpose, determinant and inverse of R1.

  • Define matrix R2 for a different angle and verify properties of R2.
  • Calculate the product of R1 and R2, verify its properties.
  • Repeat for the changed order of R1 and R2.
  • Compute the logarithm matrix S1 of R1, and exponent of the result
    >>  S1=logm( R1 )
    >>  expm(S1)
    

    verify the properties of S1.

  • Check transformations between a number om1 and a skew-symmetric matrix S1
    >>  om1=vex(S1)
    >>  S1b=skew(om1)
    

    What is a relation between om1 and theta? Does it hold for other angles?

  • Repeat the last step for the product of two matrices for theta1 and theta2
    >>  R_pr=R1*R2
    >>  S_pr=logm(R_pr)
    >>  om_pr=vex(S_pr)
    

    What is a releation between ompr, theta1 and theta2?

  • Questions:
    1. What is the form of a rotation matrix on a plane, to what group it belongs, what are the properties of the elements of the group?
    2. What is the form of a logarithm of rotation matrix? To what group it belongs, what are its properties?
    3. What are properties of a product of two rotations?

Task 2: Homogenous transformations in 2D

  • Define homogenous transformations for rotations and translations for two different angles and vectors
    >> Tt1=transl2(1, 2)
    >> Tr1=trot2(30, 'deg')
    >> Tr2=trot2(pi/6)
    

    Observe the structure of matrices, then plot the examples

    >> plotvol([0 5 0 5]);
    >> trplot2(Tt1,'frame', '1', 'color', 'r')
    
  • Calculate compounds of transformations (two rotations, two translations, mixed rotation and translation in various order). Observe the properties of results.
  • Check commutativity of compound (note: use also transformations with both angle and shift non-zero). Plot the results.
  • Define a point with chosen coordinates P and homogenous transformation T1
    >> P=[3;1.5];
    >> plot_point(P, 'label', 'P', 'solid', 'ko');
    >> Ph=e2h(P)
    >> h2e(Ph)
    

    Find a point P1 having coordinates P in coordinate system defined by T1. Calculate its coordinates in original system and plot it.

  • Find a position of P in coordinate system defined by T1.
  • Questions:
    1. What is the form of a homogenous transformations and to what group it belongs?
    2. What are properties of compounds of transformations?
    3. How to transform coordinates of a point between an original and transformed coordinate frames (and back)?

Task 3: Basic rotations in 3D

  • Define rotations around main axes (rotx, roty, rotz) and visualize them
    >> Rx = rotx(pi/6)
    >> trplot(Rx)
    

    check the properties as in task 1.

  • Follow the steps of the task 1 in 3D case.
  • Questions:
    1. What are similarities and differences between planar and spatial case?

Task 4: Three parameter represenation

  • Choose 3 angles φ, θ, ψ representing Euler angles ZYZ. Calculate basic rotations around respective axes and a resulting compound rotation. Compare the result with the result of package function.
    >> R = eul2r(phi, theta, psi)
    
  • For a rotation matrix calculate corresponding Euler angles.
    >> tr2eul(R)
    

    Observe the result.

  • Repeat the previous steps for angles φ=0.1 , θ=-0.2, ψ=0.3.
  • Follow the same steps in RPY representation
    >> rpy2r(0.1, 0.2, 0.3)
    >> tr2rpy(R)
    
  • Questions:
    1. What is the reason of the result in step 3?
    2. Which 3 angles for RPY representation have the same property?
  • Note: a tripleangle application may be used a help to understand the 3 angle representations

Task 5: Vector angle representation

  • Choose a rotation matrix R2 (with 2 or 3 non-zero parameters in Euler representation), let R1 be identity.
  • Calculate axis-angle representation of R2 (tr2angvec)
  • Choose another axis and angle of rotation, calculate corresponding matrix R3 (angvec2r)
  • For one of above cases plot initial and final orientation and the axis of rotation, add intermediate orientations (by using intermediate angles and calculations in loop)
  • (*) Extend the previous case by using translations to obtain a spiral motion along the axis, with a center of coordinate frame in a distance d from the axis of rotation
  • To report:
    1. Include the plot and code illustrating the rotation around the axis

Task 6: Homogenous transformations

  • Define and visualize exemplary transformations
    Tt=transl(1, 2, 3)
    Tr=eul2tr(0.3, 0.4, 0.5)
    trplot(Tt*Tr)
    
  • Follow the steps from task 2
  • Questions:
    1. What are similarities and differences between planar and spatial case?
    2. What is a structure of inverse matrix in 3D case?

Task 7: (*) Toward kinematics

  • Define length parameters and angles of double pendulum
  • Calculate points corresponding to the center of rotation and the end-points of each link using homogenous transformations.
  • Plot the double pendulum and coordinate systems associated with each link
  • Define initial and final angles, divide pendulum motion time to k periods, plot intermediate poses
  • (*) use tranimate() or <object>.animate to show animated motion
  • (**) use ode solver to calculate a solution of the pendulum motion, animate the result
  • To report:
    1. Include code, parameters and final illustration of the example

4 Summary

  • The report should include the result of the tasks and answers to the questions.
  • Please do not forget to indicate the author of the report!
  • The report in PDF format should be submitted before the beginning of next classes using a method defined by the instructor.

Author: Janusz Jakubiak

Created: 2018-03-21 śro 00:12

Emacs 23.4.1 (Org mode 8.0.7)

Validate XHTML 1.0