Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf ·...
Transcript of Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf ·...
![Page 1: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/1.jpg)
Kinematics and Orientations
HierarchiesForward KinematicsTransformations (review) Euler anglesQuaternionsYaw and evaluation function
for assignment 2
![Page 2: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/2.jpg)
Building a character
Just translate, rotate, and scale each body part to get the right size, shape, position, and orientation.
Looks great--until you try to make it move.
![Page 3: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/3.jpg)
The Right Control KnobsAs soon as you want to change
something, the model falls apartReason: the thing you’re modeling is
constrained but your model doesn’t know it
What we need: some sort of representation of structurea set of “control knobs” (parameters) that make it easy
to move our stick person through legal configurations
Key is to structure the transformations in the right way: using a hierarchy
![Page 4: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/4.jpg)
Making an Articulated Model
• A minimal 2-D jointed object:– Two pieces, A (“forearm”) and B (“upper arm”)– Attach point q on B to point r on A (“elbow”)– Desired control knobs:
• T: shoulder position (point at which p winds up)• u: shoulder angle (A and B rotate together about p)• v: elbow angle (A rotates about r, which stays attached to q)
AAr BB qpBBp
AArq
T
![Page 5: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/5.jpg)
Making an Arm, step 1
• Start with A and B in their untransformed configurations (B is hiding behind A)
• First apply a series of transformations to A, leaving B where it is…
AAr
![Page 6: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/6.jpg)
Making an Arm, step 2
• Translate by -r, bringing r to the origin• B is now peeking out from behind A
BB qpAAr
AAr
![Page 7: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/7.jpg)
Making an Arm, step 3
Next, we rotate A by v (the “elbow” angle)
BB qp AArBB qpAAr
![Page 8: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/8.jpg)
Making an Arm, step 4
Translate A by q, bringing r and q together to form the elbow joint
We can regard q as the origin of the lower arm coordinate system, and regard A as being in this coordinate system.
BB qp AArBB qp AAr
![Page 9: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/9.jpg)
Making an Arm, step 5
From now on, each transformation applies to bothA and B (This is important!)
First, translate by -p, bringing p to the originA and B both move together, so the elbow doesn’t
separate
BB qp AArBB qp AAr
![Page 10: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/10.jpg)
Making an Arm, step 6
Then, we rotate by u, the “shoulder” angle Again, A and B rotate together
BBp
AAr
BB qp AAr
![Page 11: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/11.jpg)
Making an Arm, step 7
Finally, translate by T, bringing the arm where we want it
p is at origin of upper arm coordinate system
BBq
pAAr
BBq
p
AAr
![Page 12: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/12.jpg)
Transformation Hierarchy• The build-an-arm sequence,
represented as a tree• Interpretation:
– Leaves are geometric primitives– Internal nodes are transformations– Transformations apply to everything under
them
Trans -r
Rot v
Trans q
A
Trans -p
Rot u
Trans T
B
Control KnobPrimitiveStructural
![Page 13: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/13.jpg)
Transformation HierarchyAnother point of view:• The shoulder coordinate
transformation moves everything below it with respect to the shoulder:– B– A and its transformation
• The elbow coordinate transformation moves A with respect to the shoulder coordinate transform
Trans -r
Rot v
Trans q
A
Trans -p
Rot u
Trans T
B
Shoulder coordinate xformElbow coordinate xformPrimitive
![Page 14: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/14.jpg)
A Schematic Humanoid• Each node represents
– rotation(s)– geometric primitive(s)– structural transformations
• The root can be anywhere. We chose the pelvis (can re-root)
• Control knob for each joint angle, plus global position and orientation for the root
• This is how amc file in 2nd
assignment works
hip
torso
headl. arm2
l. arm1 r. arm1
r. arm2
l. leg1
l. leg2
r. leg1
r. leg 2shoulder
neck
![Page 15: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/15.jpg)
What Hierarchies Can and Can’t DoAdvantages:
Reasonable control knobsMaintains structural constraints
Disadvantages:Doesn’t always give the “right” control knobs trivially
e.g. hand or foot position - re-rooting may help
Can’t do closed kinematic chains easily (keep hand on hip)
Missing other constraints: do not walk through walls
![Page 16: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/16.jpg)
So What Have We Done?Forward Kinematics
Given the model and the joint angles, where is the end effector? Compute this so you know where to draw primitives
Inverse KinematicsGiven a desired location of the end effector, what are the
required joint angles to put it there? Required to place the end effector near to an object in the real world.
Kinematics is easy, IK is hard because of redundancy.
![Page 17: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/17.jpg)
Kinematics and Orientations
• Hierarchies• Forward Kinematics• Transformations (review) • Euler angles• Quaternions• Washing out yaw
for assignment 2
![Page 18: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/18.jpg)
![Page 19: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/19.jpg)
![Page 20: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/20.jpg)
![Page 21: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/21.jpg)
![Page 22: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/22.jpg)
![Page 23: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/23.jpg)
Interpolation
Trivial for translation: t=k * t1 + (1-k) * t2Easy for rotation in 1DNot so easy for 3D rotation
![Page 24: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/24.jpg)
![Page 25: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/25.jpg)
![Page 26: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/26.jpg)
![Page 27: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/27.jpg)
![Page 28: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/28.jpg)
![Page 29: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/29.jpg)
Gimbal Lock
Gimbal
y
zx
A Gimbal is a hardware implementation of Euler angles (used for mounting gyroscopes, expensive globes)
Gimbal lock is a basic problem with representing 3-D rotations using Euler angles
y
zx
Locked Gimbal
![Page 30: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/30.jpg)
![Page 31: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/31.jpg)
Interpolating Rotations
• Q: What kind of a compound rotation do you get by successively turning about each of the three axes of the rotation at a constant rate?
• A: not the one you want.
![Page 32: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/32.jpg)
![Page 33: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/33.jpg)
![Page 34: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/34.jpg)
![Page 35: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/35.jpg)
![Page 36: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/36.jpg)
![Page 37: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/37.jpg)
![Page 38: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/38.jpg)
![Page 39: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/39.jpg)
![Page 40: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/40.jpg)
2-angle (θ-φ) rotation(unit sphere)
Interpolating rotations means moving on n-D sphere
Quaternion InterpolationWe can think of rotations as lying on an n-D unit sphere
1-angle (θ) rotation(unit circle)
θ1
θ2
![Page 41: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/41.jpg)
2-angle (θ-φ) rotation(unit sphere)
![Page 42: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/42.jpg)
![Page 43: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/43.jpg)
![Page 44: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/44.jpg)
![Page 45: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/45.jpg)
![Page 46: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/46.jpg)
![Page 47: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/47.jpg)
![Page 48: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/48.jpg)
Washing out Yaw
Amc file format in Euler anglesYou want roll and pitch + delta yaw not roll, pitch,
yawConvert to yaw, roll, pitch Euler angles
http://vered.rose.utoronto.ca/people/david_dir/GEMS/GEMS.html
Compute delta yaw between framesRe-animate by incrementing yaw by delta yaw.
Compute new rotation matrix.Compute delta x,z and increment to animate
![Page 49: Kinematics and Orientations - Carnegie Mellon School of ...jkh/video_games/kinematics.pdf · Kinematics and Orientations Hierarchies Forward Kinematics Transformations (review) Euler](https://reader031.fdocuments.in/reader031/viewer/2022021510/5b1461377f8b9a347c8cd905/html5/thumbnails/49.jpg)
Evaluation function?
Lots of possibilities here:joint anglesweighted joint angles (visually big ones)root height, roll, pitchscattered points (a la Kovar and Gleicher)contact statewhat else?