alt lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •checkpoint 2 –april 11 by 5pm...

32
Alt Lab 5

Upload: others

Post on 13-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Alt Lab 5

Page 2: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Lecture Plan

• Review Key Dates

• Review lab changes

• Some hints for Lab 5

• Talk about the simulation

• Work an example

• Questions

Page 3: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Key Dates

• Checkpoint 1 – April 4 by 5PM• Note: Lab 4 Report due at the same time!

• Checkpoint 2 – April 11 by 5PM

• Checkpoint 3 – April 18 by 5PM

• Lab Report – April 25 by 5PM

• (Lab is over, there is no Lab 6)

Page 4: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Key Changes

• You now have to submit a checkpoint each week for credit• No late credit

• There is no demo, you will be graded on your solution to two test points

• You are provided points in the workspace of the robot to test

• You can verify your Lab 5 code by using your Lab 4 code

• Your code will be graded, so make sure it is clear and commented

Page 5: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Checkpoint Requirements

• Checkpoints are not intended to be complex, just an indication of your progress.

• Show your current solutions or discuss your progress if it is not finished yet.

• It will not be graded for correctness

• Must be typeset

Page 6: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Code

• Neatly organize the code

• Use functions to keep it simple

• Clearly name important variables and functions

• Use comments to explain the code

• All functions should have comments that explain their use and purpose

Page 7: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Hints

• Follow the order and suggestions of the lab manual

• The first joint 𝜃1is the hardest to get so don’t get too discouraged if you are struggling with it.

• There are many ways to approach this, but some are not complete solutions. Make sure your solution is robust and works in many places.

• Keep it simple. None of the calculations are complex. But they are not always easy to see at first glance.

Page 8: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Simulation

• Mario has created a simulation in CoppeliaSim to help you visualize the UR3

• It contains the key points needed to solve the inverse kinematics and you can move the arm as needed to see their relationships

Page 9: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Example Walkthrough

Page 10: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

What are Inverse Kinematics?

• Inverse Kinematics translates from an end effector position and orientation to joint angles

• 𝑇0𝑛 → 𝜃1, 𝜃2, … 𝜃𝑛• (𝑥𝑔𝑟𝑖𝑝, 𝑦𝑔𝑟𝑖𝑝, 𝑧𝑔𝑟𝑖𝑝, 𝜃𝑦𝑎𝑤 , 𝜃𝑝𝑖𝑡𝑐ℎ , 𝜃𝑟𝑜𝑙𝑙) → 𝜃1, 𝜃2, … 𝜃𝑛

• We will be doing this analytically using geometry

Page 11: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Why do we care about Inverse Kinematics?

• Inverse Kinematics is much more useful than Forward Kinematics for what we wish to do

• We control the robot by joint angles, but we live and operate in a 3D – x-y-z world.

• Could you describe a straight-line path in terms of 𝜃1, 𝜃2, 𝜃3, 𝜃4…? It is pretty hard to do.

• We need a way to translate our x-y-z world to the joint angles the robot needs

• Inverse Kinematics is the tool that allows us to do that.

Page 12: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Background

• In class you have studied Numerical Inverse Kinematics which uses numerical methods to solve the problem

• In lab we will find the Geometric Inverse Kinematics. We will use geometric relationships to find formulas to solve the problem

• With Forward Kinematics, there is a single solution to the problem, but with Inverse Kinematics, there are often multiple solutions

• We deal with multiple solutions by imposing constraints on our arms

• Sometimes there are multiple solutions to an angle, but not all solutions are good• Some solutions fail in certain configurations.

Page 13: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Useful Tools

• Basic Trigonometry – sines, cosines, and tangents

• Law of Cosines

• atan2(y,x)or arctan2(y,x)

• Takes into account signs of x and y in arctan(y/x) and places angle in correct quadrant

Page 14: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

10cm

15cm

13cm

Our Example Robot

Center of Gripper(x, y, z)

Tabletop

zw

xw

yw

This is our given.

Our goal:(𝑥𝑔𝑟𝑖𝑝, 𝑦𝑔𝑟𝑖𝑝, 𝑧𝑔𝑟𝑖𝑝) → 𝜃1, 𝜃2, 𝜃3

Page 15: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Set up

• This is a simple robot, so we only need to worry about Elbow Up or Elbow Down configurations• Let’s solve for Elbow Up

• Again, because we have a simple design, the solution order is not important• We will solve for 𝜃1, then 𝜃2, and finally 𝜃3.

• It is important to know what information you have available, so you don’t solve for 𝜃1 in terms of 𝜃2 and 𝜃2 in terms of 𝜃1.

Elbow Up

Elbow Down

Page 16: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Top View(x-y plane)

(x, y)

We want 𝜃1, what can we do?

One useful technique is to project the robot on different planes to eliminate confusing details. Here we are looking down on the robot and at the x-y plane. We have placed the robot in an arbitrary configuration so our solutions are universal, but we still have take care that we can deal with the whole workspace.

𝜃1

Page 17: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Top View(x-y plane)

(x, y)

Given that we know x and y, it is logical to use an arctan to solve this problem. We use the atan2function in computing to deal with how tangent behaves in different quadrants.

Solution:𝜃1 = atan2(y, x)

𝜃1

Page 18: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” ViewWhat plane is this?

What lengths and angles do we know in this view?

(x,y,z) We now look at a different plane view of the robot. This allows us to isolate 𝜃2 and 𝜃3. We want to start by putting in the known information.

Page 19: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

(x,y,z)−𝜃2

𝜃3

We can add in the angles - 𝜃2 and 𝜃3 and the lengths of the links.

“Side” View1

0cm

Page 20: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

We can split up the area and create more triangles to work with.

10

cm

Page 21: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

We can split up the area and create more triangles to work with.

10

cm

α

Page 22: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

d = z - 10

10cm

Even with only (x, y, z) and the construction of the robot, we know a lot of information.

10

cm

α

Page 23: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

αd = z - 10

Let’s use this information to find α.

Solution:α = arcsin(d/R)

Page 24: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

αβ

Now we know α, if we could find β we would know 𝜃2.

Page 25: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

αβ

Now we know α, if we could find β we would know 𝜃2.

Solution:Law of Cosinesβ = arccos((R2 +152 – 132)/(2*15*R))

Page 26: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

αβ

Solution:−𝜃2=α + β𝜃2=-α - β

Does this change if the end effector is below the red line? i.e. If 𝜃2 is positive?

Page 27: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

What about arccos?

(x,y,z)−𝜃2

𝜃3

α

Would a solution using α = arccos(D/R) make sense?

D2=x2+y2

Page 28: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

γNow if we know γ, we could know 𝜃3.

Page 29: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

γNow if we know γ, we could know 𝜃3.

Solution:Law of Cosinesγ = arccos((152 + 132 -R2)/(2*15*13))

Page 30: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Table Top

“Side” View

(x,y,z)−𝜃2

𝜃3

γ

Solution:𝜃3=π - γ

Page 31: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Summary of the Solution

Solution:𝜃1 = atan2(y, x)d = z - 10R2 = x2+y2+d2

α = arcsin(d/R)β = arccos((R2 +152 – 132)/(2*15*R))𝜃2 = -α - βγ = arccos((152 + 132 - R2)/(2*15*13))𝜃3 = π - γ

We now have a solution that can calculate 𝜃1, 𝜃2, 𝜃3 given (𝑥𝑔𝑟𝑖𝑝, 𝑦𝑔𝑟𝑖𝑝, 𝑧𝑔𝑟𝑖𝑝).

Page 32: Alt Lab 5publish.illinois.edu/ece470-intro-robotics/files/... · •Checkpoint 2 –April 11 by 5PM •Checkpoint 3 –April 18 by 5PM •Lab Report –April 25 by 5PM •(Lab is

Questions?