Geometric Representations and Transformations€¦ · Geometric Modeling The world W(R2 or R3)...
Transcript of Geometric Representations and Transformations€¦ · Geometric Modeling The world W(R2 or R3)...
Geometric Representations and Transformations
J. Irving Vasquez
Centro de Innovacion y Desarrollo Tecnologico en Computo
20 de febrero de 2020
1 / 44
Introduccion
Image from[Kostas]
2 / 44
Body Frame
Figura: A sensor (red point) is not always in the center of the body frame.
3 / 44
Definitions
Espacio euclidiano Un espacio euclidiado de dimension n, es elconjunto de tuplas de dimension n,(x1, x2 . . . , xn),
que satisface la metrica(∑n
i=1 x2i
) 12
Point Una tupla de n-elementos, (x1, x2 . . . , xn)
Linea Dados dos puntos, una linea esta formada lacombinacion lineal de ellos.
αp1 + (1− α)p2 α ∈ R
Segmento de linea Un segmento de linea es la combinacionconvexa de dos puntos.
αp1 + (1− α)p2 α ∈ [0, 1]
4 / 44
Definitions
Convex set A set X ⊂ Rn is called convex if and only if, for anypair of points in X , all the points along the linesegment that connects them are contained in X .
λx1 + (1− λ)x2 ∈ X
Convex Hull The convex hull of a set of points, S , in En is theboundary of the smallest convex set in En containingS .
Polygon A polygon is a set of vertices and edges, Q = (V ,E ),where V is a set of points on the plane and E is a setof 2-d vertices tuples.
5 / 44
Geometric Modeling
The world W (R2 or R3) contains closed sets:
RobotsA ⊆ WObstaclesO ⊆ W
Representation approaches:
BoundarySolid
6 / 44
Polygonal Models
We can construct bodies by primitives and set theory operations.
Boundary representation
2D, convex polygons, G = {V ,E}Solid
Intersection of half planes
y < mx + b
7 / 44
Nonconvex polygons
Nonconvex polygon
A collection of convex polygons
O = O1 ∪ O2 ∪ · · · ∪ On (1)
8 / 44
Polyhedral models
A 3D world
Boundary:A set of vertices, edges and faces P = {V ,E ,F}Solid: half spaces representation
9 / 44
3D triangles
A triangle = {(x1, y1, z1), (x2, y2, z2), (x3, y3, z3)}A set of triangles represents a body.Triangular meshes
Figura: Triangular Mesh of the Bebop drone
10 / 44
Semi algebraic models
for algebraic models, the functions are linear
for semi-algebraic models, the functions can be anypolynomial with real-valued coefficients.
11 / 44
Assignment
Implement in Python:
Notebook: “representacion poligono”Represent a robot with a polygonPlot the Polygon
Figura: A triangular representing a robot.
12 / 44
Assignment
Display the following geometric models in RViz:A Polygon
A Mesh (binary .stl or Ogre .mesh in 1.0, COLLADA (.dae) in1.1)
13 / 44
Rigid Motions
14 / 44
We will use an analytic approach
The superscript is used to denote the reference frame:
p0 = [5, 6] , p1 = [−2.8, 4.2] (2)
p is a geometric entity and it is independent from itscoordinate representation.
a vector has direction and magnitude.
Thus, v1 and v2 are invariant with respect to the choice ofcoordinate systems,
The representation by coordinates of these vectors dependsdirectly on the choice of reference coordinate frame.
15 / 44
Rotations
Rotations in the plane
We can represent the coordinates of the point p1 in the frameO0 by getting the proyections of the verctors over the frame.
We obtain:R0
1 =[x0
1 |y01
]where x0
1 and y01 are the coordinates in frame O0 of unit
vectors x1 and y1.
It is called Rotation Matrix.
R01 =
[cos θ − sin θsin θ cos θ
]
16 / 44
Special orthogonal group
17 / 44
Assigment
Mestre que la inversa de una rotacion por el angulo θ es iguala la transpuesta.
18 / 44
Rotations in three dimensions
In three dimensions, each axis of the frame x1, y1 y z1 isprojected onto coordinate frame x0, y0 y z0. The resultingrotation matrix is given by
19 / 44
Rotation in z
20 / 44
Rotation in z
21 / 44
The basic rotations
22 / 44
Rigid Body
A rigid body is a geometric representation of a physical bodyso that its shape does not change over time.
Figura: Two rigid bodies in the environment (A Kinect Sensor and a box).
23 / 44
The rotational transformation
Given the coordinates p1 of the point p (i.e., given thecoordinates of p with respect to the frame x1 y1 z1 ), we wishto determine the coordinates of p relative to a fixed referenceframe x0 y0 z0.
p = ux1 + vy1 + wz1
Recalling that the dot product of two unit vectors gives theprojection of one onto the other
p0 =
p · x0
p · y0
p · z0
24 / 44
The rotational transformation
25 / 44
The rotational transformation
26 / 44
Rigid motions
We can use rotation matrices to represent rigid motions thatcorrespond to pure rotations (In the same frame).
27 / 44
Rigid motions
We can rotate a point in the same reference frame by doing:
p0b = Rz,πp
0a
In general,p0b = Rp0
a
28 / 44
Note!
A rotation matrix can be interpreted in three distinct ways:
It represents a coordinate transformation relating thecoordinates of a point p in two different frames.
It gives the orientation of a transformed coordinate frame withrespect to a fixed coordinate frame.
It is an operator taking a vector and rotating it to a newvector in the same coordinate system.
29 / 44
Composition of Rotations
Consider two sequential rotations:
p0 = R01p
1
p1 = R12p
2
p0 = R02p
2
Then:
p0 = R01R
12p2
Composition law (post-multiplication)
R02 = R0
1R12
30 / 44
Composition of Rotations
Exercise. Suppose a rotation matrix R represents a rotation ofangle φ about the current y -axis followed by a rotation of angle θabout the current z-axis. What is the rotation matrix?
31 / 44
Rotations with respect of a fixed frame
Some times it is desired to perform a sequence of rotations,each about a given fixed coordinate frame, rather than aboutsuccessive current frames.
The matrices are multiplied in the reverse order
R02 = R0
1
[(R0
1
)−1RR0
1
]= RR0
1
32 / 44
Note!
33 / 44
Assignment
Lets suppose a mobile robot rotated by θ = 35o, that observes afeature point at probot = [10, 32, 52].
34 / 44
Parameterized representations
An arbitrary rotation ca be represented using only threeindependent variables.
Some conventions are:
Euler anglesYaw, pitch, rollAxis-angle
35 / 44
Euler Rotations
Given three sucesive angles (φ, θ, ψ):
First rotate about z by φThen rotate about y by θFinally rotate about the current z by ψ
RZYZ = Rz,φRy ,θRz,ψ
36 / 44
Roll, pitch, yaw angles
Given three sucesive angles (φ, θ, ψ):
First rotate about z by φThen rotate about y by θFinally rotate about the current x by ψ
RZYX = Rz,φRy ,θRx ,ψ
Figura:
37 / 44
Assigment
https://github.com/irvingvasquez/ra_programas
Resolver el ejercicio Rotaciones de Euler
38 / 44
Gimbal Lock
When all three gimbals are lined up, the system can only move intwo dimensions.
Figura:
39 / 44
Quaternions
A generalization of complex numbers
William Hamilton (1843)
i2 = j2 = k2 = ijk = −1
q = a + bi + cj + dk
40 / 44
Performing rotations
We need the quaternion
q = a + bi + cj + dk
and its inverse
q = a− bi − cj − dk
then
p = [xyz ]T
pnew = qpq
41 / 44
Euler to Quaternion
42 / 44
Quaternion to Euler
43 / 44
Quaternion to Rotation
44 / 44