Rigid Body Transformations

F1/10th Racing
Rigid Body Transformations
(Or How Different sensors see the same
world)
By,
Paritosh Kelkar
Mapping the surroundings
Specify destination and
generate path to goal
The colored cells represent a potential that
is used to plan paths
Rviz is used to specify different goals
to the robot
Why should you watch these lectures
Following the wall here blindly is going to be really hard
You will need a very complicated Route definition file
Why should you watch these lectures
Simultaneous Localization and Planning
Planning
Lets begin
Scope of the Lecture
PART 1
• The concept of frames and transforms (different views of the same
world) – Why is this important to us
• The Homogenous Transformation Matrix
PART 2
• How ROS deals with these frames, conventions in ROS
Frames of Reference
Part 1
Transformations and Frames: Heads up
1. w.r.t = with respect to
2. Map frame – where are you w.r.t the map – co-oridnates from origin
Transformations and Frames: Heads up
• The Sensor frame – how does the world look w.r.t the sensor
Does this tell you anything about where obstacles are in the map?
Does this tell you anything about where we are in the map?
We must link frames together
Transformations
Transformations and Frames
• The frame of reference in which the measurement is taken
Z
X
𝛥𝑧
Distance measurements returned by LIDAR
Transformations and Frames
• The frame of reference in which the measurement is taken
The scan Values from the LIDAR will not tell us how far
away are the obstacles. We must take care of the
offsets
Z
X
𝛥𝑧
Y
𝛥𝑥
Transformations and Frames
Z
X
𝛥𝑧
Y
Note:
Axes X,Y,Z of Frames of Reference are orthogonal(90o) to
each other.
X,Y,Z represent the axes along the 3 dimensions.
Transformations and Frames
Z
Y
laser frame
X
Between frames there will exist
transformations that convert measurements
from one frame to another
Y
Car frame
Y
Map frame
Important Point:
Note what the
transformation means
w.r.t frames
Transformations and Frames
Between frames there will exist transformations that convert
measurements from one frame to another
Z
There should exist a relationship
Between these frames
Transform from car to laser
X
Y
Car frame
Y
Y
laser frame
Y
Y
Y
Map frame
Transform from map to car
A world without frames and transformations
The actual motion of the car
Rigid Body Transforms: An Aside
• What’s with it being Rigid?
The distance between any two given
points of a rigid body remains constant
in time regardless of external forces
exerted on it.
Play-Doh: Obviously not a rigid body
Rigid Body Transforms
YA
ZA
XA
Rigid Body Transforms
YA
ZA
XA
Rigid Body Transforms
𝜃
YA
ZA
XA
Rigid Body Transforms
𝜃
YA
A
ZA
XA
dB
Rigid Body Transforms
B
p
𝜃
YA
A
ZA
XA
dB
Rigid Body Transforms
B
A
YA
A
ZA
XA
dB
p
p
𝜃
Rigid Body Transforms
• What we need is Point p with respect to
Frame A, given its pose in Frame B
B
A
YA
A
ZA
XA
dB
p
p
𝜃
Rigid Body Transforms
• Special type of matrices called Rotation matrices
෢𝐵 = 𝑅11 𝑋
෢𝐴 + 𝑅21 𝑌෡𝐴 + 𝑅31 𝑍
෢𝐴
𝑋
෢
෢
෡
෢
𝑌
=
𝑅
𝑋
+
𝑅
𝑌
+
𝑅
𝑍
𝐵
12 𝐴
22 𝐴
32 𝐴
෢𝐵 = 𝑅13 𝑋
෢𝐴 + 𝑅23 𝑌෡𝐴 + 𝑅33 𝑍
෢𝐴
𝑍
YA
ZA
XA
𝜃
Rigid Body Transforms
• Special type of matrices called Rotation matrices
YA
෢𝐵 = 𝑅11 𝑋
෢𝐴 + 𝑅21 𝑌෡𝐴 + 𝑅31 𝑍
෢𝐴
𝑋
෢
෢
෡
෢
𝑌
𝐵 = 𝑅12 𝑋𝐴 + 𝑅22 𝑌𝐴 + 𝑅32 𝑍𝐴
෢𝐵 = 𝑅13 𝑋
෢𝐴 + 𝑅23 𝑌෡𝐴 + 𝑅33 𝑍
෢𝐴
𝑍
ZA
𝑅11
A
RB = 𝑅21
𝑅31
𝑅12
𝑅22
𝑅32
𝑅13
𝑅23
𝑅33
Takes points in
frame B and
represents their
orientation in
frame A
XA
𝜃
Rigid Body Transforms: Rotation Matrices
෢𝐵 = 𝑅11 𝑋
෢𝐴 + 𝑅21 𝑌෡𝐴 + 𝑅31 𝑍
෢𝐴
𝑋
A
෢
෢
෢𝐴
𝑌
𝑌෡𝐴 + 𝑅32 𝑍
𝐵 = 𝑅12 𝑋𝐴 + 𝑅=
22?
෢𝐵 = 𝑅13 𝑋
෢𝐴 + 𝑅23 𝑌෡𝐴 + 𝑅33 𝑍
෢𝐴
𝑍
p
(0,5,0)
YA
෢𝐵 = cos(𝜃) × 𝑋
෢𝐴 +sin(𝜃) × 𝑌෡𝐴+0 × 𝑍
෢𝐴
𝑋
𝑅11
𝑅21
𝑅31
B
p
ZA
Sine
component
𝜃
Cosine component
XA
Rigid Body Transforms: Rotation Matrices
A
RB
Cos(𝜃) 𝑅12
= Sin(𝜃) 𝑅22
0
𝑅32
෢𝐵
𝑋
෢
𝑌
𝐵
𝑅13
𝑅23
𝑅33
෢𝐵
𝑍
෢𝐴
𝑋
𝑌෡𝐴
෢𝐴
𝑍
C
A
RB   S
 0
 S
C
0
0
0 
1 
𝐶𝜃 = Cos(𝜃)
𝑆𝜃 = Sin(𝜃)
We have the Rotation Matrix, so now what?
A
0.86
𝑅 = 0.5
0
p  RB  p
A
We now
have the
point P as
referenced
in frame A
B
Known
−0.5
0.86
0
0
0
1
Known
(-2.5,4.3,0)
YA
A
p
For example
𝜃 = 𝜋Τ6 ⇒
A
p = (-2.5,4.3,0)
ZA
XA
Important point to remember
• The rotation matrix will take care of perspectives of orientation, what
about displacement?
YA
YA
ZA
ZA
XA
XA
Origins of both the frames are at the same location
A
dB
Rigid Body Transforms: And We are back to
the Future
A
p  RB  p  d B
A
A
YB
ZB
YA
ZA
B
XA
XB
Rigid Body Transforms
• What we need is Point p with respect to
Frame A, given its pose in Frame B
𝑝
A
p  AH B  B p
B
A
p
p
𝜃
YA
A
ZA
XA
C
A
RB   S
 0
dB
A
H B= Homogenous transformations that transforms
measurements in Frame B to those in Frame A
 S
C
0
A

RB
A
HB  
 0
0
0 
1 
A
dB 

1 
Part 2
Map frame
Map Frame
Map frame: Importance
• Position with respect to map
MAP FRAME
Map Frame: Properties
• Used as a long term reference
• Dependence on localization engine (Adaptive Monte Carlo
Localization AMCL – used in our system – more about this in later
lectures)
• Localization engine - responsible for providing pose w.r.t map – Frame
Authority
Map Frame: ROS
• The tf package – tracks multiple 3D coordinate frames - maintains a
tree structure b/w frames – access relationship b/w any 2 frames at
any point of time
• ROS REP(ROS Enhancement Proposals) 105 describes the various
frames involved
A tf tree is a structure that
• Normal hierarchy
Has no parent
maintains relations between
world_frame
map
Note:
Tf = transformer class
the linked frames.
Child of world frame
Odom Frame
Odom frame: Calculation
• Frame in which odometry is measured
• Odometry is used by some robots,
whether they be legged or wheeled, to
estimate (not determine) their position
relative to a starting location
-Wikipedia
Source: eg: Wheel encoders.
Count wheel ticks
Odom Frame: Calculation
• Difference in count of ticks of wheels – orientation
• Integrating the commanded velocities/accelarations
• Integrating values from IMU
Odom Frame: Uncertainty
Initial Position
• Error can accumulate – leading to a drift in values
• Incorrect diameter used?
• Slippage?
• Dead Reckoning
Notice how the
uncertainty
increases
Odom Frame: Properties
• Continuous – actual data from actuators/motors
• Evolves in a smooth manner, without discrete jumps
• Short term ; accurate local reference
Odom Frame: ROS
• General ROS frame
hierarchy
world_frame
map
odom
Tf tree
Note that if the frame is connected in the tf tree,
we can obtain a representation of that frame
with any other frame in the tree
Base_link and fixed frames attached to the
robot
Base link: What is it
• Attached to the robot itself – base_footprint; base_link;
base_stabilized
Base link: Properties
• Odom -> base link transform provided by Odometry source
• Map -> base_link transform provided by localization component
Fixed Frames: Source – Where do we get the
relationships between the fixed frame on the car
• Frame for various hardware
components(sensors)
• Robot description – provides
the transformations
• Urdf file – Look up the
tutorial related to this
lecture
Base_link Frame: ROS
• General ROS frame
hierarchy
world_frame
map
odom
base_link
Tf tree
ROS.W.T.F
• Its actually a tool – just very cleverly named
• Host of tf debugging tools provided by ROS
• Look at tutorial for further details
$ rosrun tf view_frames
$ roswtf
$ rosrun tf view_monitor
In Conclusion
• Rigid Body Transformations – the concept and the importance in
robotic systems
• We now know how to correlate measurements from different sensors
• The upcoming lecture – SLAM – Simultaneous Localization and
Mapping
Why do you have to remember all of this
stuff
• Again, you are developing the platform in this framework
• Don’t you want to know how you could get maps of your
surroundings ? what we just covered are building blocks of the
upcoming topics
Upcoming Lectures
We will go into detail about the packages that we use
for mapping and localizing
Map frame: Properties
Discontinuity
Y
Z
Map frame (0,0,0)
X
Map frame: Properties
Discontinuity
New sensor reading gives us new information
Y
Jump in position, i.e, not continuous
Z
Map frame (0,0,0)
X
(2,0,0)
Map Frame: Properties
Map Frame: Why Discontinuity is a Problem
• What pose coordinates will the controller act on?
Transformations and Frames
• The frame of reference in which the measurement is taken
Z
X
𝛥𝑧
Y
𝛥𝑥
Odom Frame: Uncertainty
Initial placement of odom
and map frames
Final placement of odom and
map frames – after robot has
moved some distance