46
6.141: Robotics systems and science Lecture 14: Forward and Inverse Kinematics Lecture Notes Prepared by Daniela Rus EECS/MIT Spring 2011 Reading: Chapter3, Craig: Robotics http://courses.csail.mit.edu/6.141/ Challenge: Build a Shelter on Mars

6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

  • Upload
    dinhdan

  • View
    223

  • Download
    3

Embed Size (px)

Citation preview

Page 1: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

6.141: Robotics systems and science Lecture 14: Forward and Inverse Kinematics

Lecture Notes Prepared by Daniela Rus EECS/MIT

Spring 2011

Reading: Chapter3, Craig: Robotics

http://courses.csail.mit.edu/6.141/!Challenge: Build a Shelter on Mars!

Page 2: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

  Last time: grasping   Today in class: grasping, FK, IK   Today in lab: Lab 7, Lab 6

presentations   Monday: Arthur Licata on Robot Ethics

What is coming up in RSS

Page 3: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Point Contact with Friction   Consider a point contact exerting force at some

angle θ to the surface normal. What happens?

F Ft

Surface

2 tan-1 µ

θcrit = tan-1 µ θ

Fn

•  Produces a “friction cone” of force directions

Page 4: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasp Synthesis with Friction   Pick f1 and valid green direction   Intersect with edge to get f2

f1

f2

Page 5: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasp Analysis With Friction Consider forces f1, f2 at frictional contacts p1, p2

When can f1, f2 oppose one another without sliding? Each force must apply within its own friction cone Point p1 (resp. p2) must lie in cone of f2 (resp. f1)

f1

f2

f1

f2

p1

p2

p1

p2

Page 6: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasp Synthesis With Friction Choose a compatible pair of edges e1, e2

Intuition? Using what data? How to choose?

Small µ Large µ

e1 e2

e1

e2

Page 7: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasp Synthesis (regions)   f2 placement has error ε   f2 can point to any force in pink region

f1

f2

Page 8: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasp Synthesis (regions)   But if we put f1 in the pink region,

which points in the blue region can point to it?

f1

f2

Page 9: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasp Synthesis (friction)

  2 Finger Forces have to be within friction cones to stick

  2 Finger Forces have to point at each other

  So…   We need to find 2 edges with

overlapping friction cones

Page 10: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasp Synthesis With Friction Choose target region for contact point p1

Determine feasible target region for contact p2 Orient and scale f1, f2 so as to cancel along p1p2

f2

p1

p2

e1

e2

p1

p2

p1

p2

f1

Page 11: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Example: 6.141 robot

Page 12: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Arm Control to Reach   Mechanism design   Forward kinematics   Inverse kinematics

Page 13: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Kinematic Mechanisms

Link: rigid body Joint: constraint on two links Kinematic mechanism: links and joints

Page 14: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

The Planar 3-R manipulator

  Planar kinematic chain   All joints are revolute

END-EFFECTOR

ACTUATORS

R

R

R

Link 1

Link 2

Link 3

Joint 1

Joint 2

Joint 3

Page 15: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Kinematic modeling

  Link   Actuated joint   End effector (EE)

  Reference point on EE

  Joint coordinates θ1, θ2, θ3

  End effector coordinates x, y, φ

  Link lengths (li)

Link 1

Link 2

The image cannot be displayed. Your computer may not have enough

REFERENCE

POINT

l 1

l 2

l 3

θ 3

θ 2

θ 1

φ ( x , y )

x

y

Link 3 (EE)

Page 16: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Kinematic transformations

  Direct kinematics   Joint coordinates to end effector coordinates

  Sensors are located at the joints. DK algorithm is used to figure out where the robot is in 3-D space.

  Robot “thinks” in joint coordinates. Programmer/engineer thinks in “world coordinates” or end effector coordinates.

  Inverse kinematics   End effector coordinates to joint coordinates

  Given a desired position and orientation of the EE, we want to be able to get the robot to move to the desired goal. IK algorithm used to obtain the joint coordinates.

  Essential for control.

Page 17: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Inverse kinematics has multiple solutions

Which is the correct robot pose ?

(x,y,z,α)

Page 18: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Robot kinematic calculations deal with the relationship between joint positions and an external fixed Cartesian coordinate frame.

Dynamics, force, momentum etc. are not considered.

Forward Kinematic Equations

Inverse Kinematic Equations

Joint space

(J1,J2 ..)

Cartesianspace (x,y,z,Ο,Α,Τ)

Kinematics Summary

Page 19: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Forward and Inverse Kinematics   So far, have cast computations in Cartesian space   But manipulators controlled in configuration space:

  Rigid links constrained by joints   For now, focus on joint values

  Example 3-link mechanism:   Joint coordinates θ1, θ2, θ3   Link lengths L1 , L2 , L3

  End effector coordinates   “Reference pose” described

by x, y, and φ (w.r.t. vertical)   How can we relate EE to

configuration variables?

Link 1

Link 2

REFERENCE POSE (x, y, φ)

θ3

Link 3 (EE)

φ

θ2

θ1

x

y L3 L2

L1

Page 20: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Forward Kinematics

REFERENCE POINT (x, y)

θ

x

y

1 1

d

•  Given mechanism description and joint values, express end effector pose in Cartesian coordinates –  Example: two-link arm with one sliding, one rotating

joint

•  Configuration variables: –  Joint coordinates d, θ –  Link lengths (both 1)

•  End effector coordinates –  “Reference point” (x, y)

•  Challenge: express as x = x (d, θ) = 1 + cos θ y = y (d, θ) = d + sin θ

Page 21: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Inverse Kinematics

REFERENCE POSE (x, y)

θ

x

y

1 1

d

•  Given end effector pose in Cartesian coordinates, identify the joint values that yield specified pose

•  Challenge: solve for joint values in terms of pose θ = θ (x, y) = cos-1 (x-1) d = d (x, y) = y ∓ (1 – (x-1)2)1/2

Hints: x = 1 + cos θ y = d + sin θ cos2θ = (x-1)2 sin2θ = (y-d)2

1 = (x-1)2 + (y-d)2

(y-d)2 = (x-1)2 - 1

Page 22: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Why is IK difficult?   Nonlinear

  Revolute joints → inverse trigonometry

  Multi-valued   Often multiple solutions for a single Cartesian pose

  Discontinuities and singularities   Can lose one or more DOFs in some configurations

  Possibly over-constrained (no exact solution)   Use of approximation and iterative algorithms

  Dynamics   In reality, want to apply forces and torques (while

respecting physical constraints), not just move arm!

θ

Page 23: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Direct kinematics

  Transform joint coordinates to end effector coordinates

( ) ( )( ) ( )

( )321

321321211

321321211

sinsinsincoscoscos

θ+θ+θ=φ

θ+θ+θ+θ+θ+θ=

θ+θ+θ+θ+θ+θ=

lllylllx

The image cannot be displayed. Your computer may not have enough memory to

REFERENCE

POINT

l 1

l 2

l 3

θ 3

θ 2

θ 1

φ ( x , y )

x

y

Page 24: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Inverse kinematics

  Transform end effector coordinates to joint coordinates

Given x, y, φ, solve for θ1, θ2, θ3

( ) ( )( ) ( )

( )321

321321211

321321211

sinsinsincoscoscos

θ+θ+θ=φ

θ+θ+θ+θ+θ+θ=

θ+θ+θ+θ+θ+θ=

lllylllx

The image cannot be displayed. Your computer may not have enough memory to

REFERENCE

POINT

l 1

l 2

l 3

θ 3

θ 2

θ 1

φ ( x , y )

x

y

Page 25: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

A Trigonometric Digression sinθ = −sin(−θ ) = − cos(θ + π

2) = cos(θ − π

2)

cosθ = cos(−θ ) = sin(θ + π2

) = − sin(θ − π2

)

cos2θ + sin2θ = 1

sinθ = ± 1− cos2θ

sin(α + β ) = sinα cosβ + cosα sinβcos(α + β ) = cosα cos β − sinα sin βsin(α − β ) = sinα cosβ − cosα sinβcos(α − β ) = cosα cos β + sinα sin β

cos θ = (1-t2) / (1+t2)

sin θ = 2t / (1 +t2)

Page 26: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

By definition , but tan has a period of π, whereas

sin and cos have a period of 2π. If it is known that

then recover with

Arctangents tanθ = sinθ

cosθ

x = r cosθ, y = rsinθ, r > 0

θ = arctan yx⎛ ⎝ ⎜ ⎞ ⎠ ⎟ = arctan r sinθ

rcosθ⎛ ⎝ ⎜ ⎞

⎠ ⎟

tanθ = yx

, sinθ =y

x2 + y2, cosθ = x

x2 + y2

θ ← atan2(y, x)

But, this only gives solution in first and fourth quadrants. The signs of x and y actually uniquely determine the quadrant, so use:

and then

Page 27: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Forward Kinematics   Traverse kinematic tree and

propagate transformations downward   Use stack   Compose parent transformation with

child’s   Pop stack when leaf is reached

  High DOF models are tedious to control this way

Page 28: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Planar Example

θ2

θ1

a1

a2

O2

O1

O0

x1

x0

x2

y1

y2

y0

Page 29: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Three revolute joints. Write and for and respectively. Downward elbow angle is write:

Example: 3DOF Revolute Arm

s1 c1 sinθ1 cosθ1

θ3− 2 = θ3 −θ2

s3−2 = sinθ3−2 = sin(θ3 −θ2 )c3− 2 = cosθ3−2 = cos(θ3 −θ2 )

Page 30: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Forward Kinematics

h = z − l1 = l2s2 − l3s3−2

r = x2 + y2 = l2c2 + l3c3−2 x = [l2c2 + l3c3− 2 ]c1y = [l2c2 + l3c3− 2]s1z = l1 + l2s2 − l3s3−2

Page 31: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

•  Analytic solution of 2-link inverse kinematics

•  Two solutions: elbow up & elbow down

θ2

θ1

a1

a2

O2

O1

O0

x1

x0

x2

y1

y2

y0

φ

ψ

(x,y)

θ2

( ) ( )( ) ( )

( ) ( )( ) ( )22

221

22

22222

211

2

222

21

22

22222

21

22

21

2221

22

21

222122

21

22

21

22

2

22122

21

22

tan2

22

cos1cos1

2tan

accuracygreater for 2

cos

)cos(2

aayxyxaa

aayxyxaa

aayxaaaayxaa

aaaayxaaaayx

−−+

+−+±=

−−+

+−+=

−−++

++−−=

+

−=

−−+=

−−+=+

−θ

θθθ

θ

θπ

Solution for Planar Example

Page 32: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Inverse Kinematics of 3DOF Manipulator

h = z − l1 = l2s2 − l3s3−2

r = x2 + y2 = l2c2 + l3c3−2

x2 + y2 + (z − l1 )2 = r 2 + h2

= l22c22 + l3

2c3−22 + 2l2l3c2[c3c2 + s3s2 ] + l2

2s22 + l3

2s3−22 − 2l2l3s2[s3c2 − c3s2 ]

= l22 + l32 + 2l2l3[c22c3 + s22c3]

= l22 + l3

2 + 2l2l3c3 c3 =x2 + y2 + (z − l1 )2 − l22 − l32

2l2l3

Page 33: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Can choose an “up elbow” solution with

or a “down elbow” solution with

where

In either case can then recover with

Solving for the Elbow

θ3 = atan2(s3,c3 )

s3 = − 1 − c32

s3 = + 1 − c32

c3 =x2 + y2 + (z − l1 )2 − l22 − l32

2l2l3

θ3

Page 34: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Pushing On...

r = l2c2 + l3c3−2 = l2c2 + l3c3c2 + l3s3s2 = k1c2 + k2s2h = l2s2 − l3s3−2 = l2s2 − l3s3c2 + l3c3s2 = k1s2 − k2c2

k1 = l2 + l3c3k2 = l3s3

where

d = + k12 + k2

2

γ = atan2(k2 ,k1)k1 = d cosγk2 = d sinγ

and so substitute in...

Page 35: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

And on...

r = d cosγ cosθ2 + d sinγ sinθ2 = d cos(θ2 − γ )h = d cosγ sinθ2 − d sinγ cosθ2 = d sin(θ2 − γ )

θ2 − γ = atan2(hd, rd) = atan2(h,r ) d > 0since

matches intuition

Page 36: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Final Inverse Kinematics θ1← atan2(y, x)

c3 ←x 2 + y2 + (z − l1)

2 − l22 − l3

2

2l2l3s3 ← + 1− c3

2

θ3 ← atan2(s3, c3)

θ2 ← atan2(z − l1, x2 + y2 ) − atan2(l3s3,l2 + l3c3 )

Page 37: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Putting it All Together: Grasping

θ

x

y

•  Input workspace, obstacles, and manipuland: –  Determine a feasible grasp (set of contact points) –  Use IK to solve for target end-effector pose in c-space –  Plan a collision-free reach to the computed pose –  Control end-effector along desired trajectory

d

d

θ

IK

Cartesian space Configuration space

Start

Goal

Page 38: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

What have we swept under the rug?   Sensing

  Shape, pose of target object, accessibility of surfaces   Classification of material type from sensor data   Freespace through which grasping action will occur

  Prior knowledge   Estimate of µ, mass, moments given material type   Internal, articulated, even active degrees of freedom

  Uncertainty & compliance   Tolerate noise inherent in sensing and actuation   Ensure that slight sensing, actuation errors won’t cause damage   Handle soft fingers making contact over a finite area (not a point)

  Dynamics   All of the above factors may be changing in real time

Page 39: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Pushing

  Straight-line motion

Page 40: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Pushing

  Clockwise rotation

Page 41: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Pushing

  Counter-clockwise rotation

Page 42: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Pushing

  Robust translation

What if we do not know where the center of mass is?

Page 43: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Pushing

  Robust translation

Push and sense: if clockwise rotation, move right if counterclockwise rotation move left

Page 44: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Moving Parts

Page 45: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Mini Manipulator

Page 46: 6.141: Robotics systems and science Lecture 14: Forward ...courses.csail.mit.edu/6.141/spring2011/pub/lectures/Lec14... · Robotics systems and science Lecture 14: Forward and Inverse

Grasping and manipulation summary

  Reaching: forward and inverse kinematics

  Grasping: analysis and synthesis of closure grasps

  Manipulation: prehensile and non-prehensile