NDSU Syllabus & Introduction ECE 761 - JSG ECE … Syllabus and Matrix... · ECE 761 Advanced...

15
ECE 761 Advanced Controls: Robotics (3cr) Summer 2018 Course Information: Instructor: Jacob Glower Office: ECE 201A Class Time: MTWRF 8:00 - 10:30 AM Room: ECE 123 Phone: 701-231-8068 Email: [email protected] Bulletin Description: Advanced topics in control systems. Course Objectives: By the end of the semester, students should be able to: Translate a point in one coordinate frame to another (coordinate transforms) Be able to determine the location of the tip of a robot given the joint angles (forward kinematics) Be able to determine the joint angles given the tip position of a robot (inverse kinematics) Be able to determine the dynamics of a robot manipulator (LaGrangian dynamics), and Be able to determine the joint forces required to apply a force at the tip (Jacobians) Required Student Resources: All lecture notes are on-line at www.BisonAcademy.com. A reference text-book is also recommended. Some suggestions are: An Introduction to Robotics, John J. Craig Robot Manipulators, Richard P. Paul Evaluation Procedures and Grading Criteria Grades will be the average of the following: Homework 100% Grades are rounded to the nearest 1%, with your final grade being A B C D F 90% or more 80% - 89% 70% - 79% 60% - 69% 59% or less NDSU Syllabus & Introduction ECE 761 - JSG 1 May 14, 2018

Transcript of NDSU Syllabus & Introduction ECE 761 - JSG ECE … Syllabus and Matrix... · ECE 761 Advanced...

ECE 761 Advanced Controls: Robotics (3cr)Summer 2018

Course Information:Instructor: Jacob GlowerOffice: ECE 201AClass Time: MTWRF 8:00 - 10:30 AMRoom: ECE 123Phone: 701-231-8068Email: [email protected]

Bulletin Description:Advanced topics in control systems.

Course Objectives:By the end of the semester, students should be able to:

Translate a point in one coordinate frame to another (coordinate transforms)Be able to determine the location of the tip of a robot given the joint angles (forward kinematics)Be able to determine the joint angles given the tip position of a robot (inverse kinematics)Be able to determine the dynamics of a robot manipulator (LaGrangian dynamics), andBe able to determine the joint forces required to apply a force at the tip (Jacobians)

Required Student Resources:All lecture notes are on-line at www.BisonAcademy.com. A reference text-book is also recommended.

Some suggestions are:An Introduction to Robotics, John J. CraigRobot Manipulators, Richard P. Paul

Evaluation Procedures and Grading CriteriaGrades will be the average of the following:

Homework100%

Grades are rounded to the nearest 1%, with your final grade being

A B C D F90% or more 80% - 89% 70% - 79% 60% - 69% 59% or less

NDSU Syllabus & Introduction ECE 761 - JSG

1 May 14, 2018

Course Schedule

Class Date Topic HomeworkM May 14 holidayT May 15 Introduction and Matrix Algebra #1W May 16 Coordinate Frames and Rotation Matricies #2R May 17 Translation Matricies & Reference Frames #3F May 18 Forward Kinematics of a PPP and RRR Robot #4M May 21 Forward Kinematics: 2-Link Arm #5T May 22 Forward Kinematics of a Puma Robot #6W May 23 Inverse Kinematics #7R May 24 Path Planning #8F May 25 Robot Programming #9M May 28 holidayT May 29 Dynamics: LaGrangian Formulation #10W May 30 Dynamics of a 2-Link Arm #11R May 31 Servo Motor Control #12F June 1 DC Motor Control #13M June 4 Servo Control of a Robot with Gears #14T June 5 Current Control of a 2-Link Robot #15W June 6 Jacobians and Cartesian Control #16R June 7 Jacobians and Force Control #17F June 8 Impact Forces #18

Legal StuffAttendance: According to NDSU Policy 333 (www.ndsu.edu/fileadmin/policy/333.pdf), attendance in classes is expected. Students are responsible for thematerial covered in class and in assignments regardless of their attendance. Note that all lecture notes, homework sets, and solutions are available on-line atwww.BisonAcademy.com

Students with Special Needs: Any students with disabilities or other special needs, who need special accommodations in this course, are invited to sharethese concerns or requests with the instructor and contact the Disability Services Office (www.ndsu.edu/disabilityservices) as soon as possible.

Academic Honesty: The academic community is operated on the basis of honesty, integrity, and fair play. NDSU Policy 335: Code of AcademicResponsibility and Conduct applies to cases in which cheating, plagiarism, or other academic misconduct have occurred in an instructional context. Studentsfound guilty of academic misconduct are subject to penalties, up to and possibly including suspension and/or expulsion. Student academic misconductrecords are maintained by the Office of Registration and Records. Informational resources about academic honesty for students and instructional staffmembers can be found at www.ndsu.edu/academichonesty.

Academic Honesty Defined: All written and oral presentations must “respect the intellectual rights of others. Statements lifted verbatim from publicationsmust be cited as quotations. Ideas, summaries or paraphrased material, and other information taken from the literature must be properly referenced” (Guidelines for the Presentation of Disquisitions, NDSU Graduate School).

ECE Honor Code: On my honor I will not give nor receive unauthorized assistance in completing assignments and work submitted for review or assessment.Furthermore, I understand the requirements in the College of Engineering Honor System and accept the responsibility I have to complete all my work withcomplete integrity.

Veterans and Student Soldiers: Veterans and student soldiers with special circumstances or who are activated are encouraged to notify the instructor inadvance.

NDSU Syllabus & Introduction ECE 761 - JSG

2 May 14, 2018

NotationVector

Plane

Coordinate Frames

Vectors

v =

⎢⎢

⎢⎢

xyzw

⎥⎥

⎥⎥

Point = [x, y, z]'.

Zoom = w

0 vector at infinity (the size of the image is zero when you're infinitely far away)

1 scale = 1 (normal scaling)

2 Zoom in 2x

MagnitudeThe magnitude of a vector is

a =ax

ay

az

= ax2 + ay

2 + az2

Dot productA dot producto is a scalar: the length of vector a projected on vector b

a ⋅ b =⎡

⎣⎢⎢⎢

ax

ay

az

⎦⎥⎥⎥⋅⎡

⎣⎢⎢⎢

bx

by

bz

⎦⎥⎥⎥= axbx + ayby + azbz

Cross ProductA cross product is a vector

The direction is perpindiculat to vector a and bThe magnitude is a measure of how orthogonal the vector are

a × b =⎡

⎣⎢⎢⎢

ax

ay

az

⎦⎥⎥⎥×⎡

⎣⎢⎢⎢

bx

by

bz

⎦⎥⎥⎥=

ix iy iz

ax ay az

bx by bz

NDSU Syllabus & Introduction ECE 761 - JSG

3 May 14, 2018

a × b =⎡

⎣⎢⎢⎢

aybz − azby

azbx − axbz

axby − aybx

⎦⎥⎥⎥

PlanesA plane is a row vector

P = [px, py, pz, pw]

The dot product of a plane and a point is the distance from the plane to the point. A dot-product of zero means thepoint is on the plane.

A positive dot-product indicates you're above the plane, a negative dot-product indicates the point is below theplane.

Transformation MatriciesA transform matrix is a way to

Shift a point by the vector (x, y, z)Rotate the coordinate frame, andZoom in and out with a scaling factor of w.

Since each point is defined by a 4x1 vector, the transformation matrix needs to be a 4x4 matrix:

a4x1 = T4x4b4x1

T is composed of three parts:A 3x3 rotation matrix (identity in this example)A 3x1 translation matrix ( [bx, by, bz]T )A 1x1 scalar (w) defining the zoom in / zoom out factor.

ax

ay

az. ..aw

⎥=

1 0 0 ... x

0 1 0 ... y

0 0 1 ... z

. .. . .. . .. . ..0 0 0 .

.. w

bx

by

bz. ..bw

Example 1: Shift the point [1,2,3] by [x, y, z] Use a scaling factor of one (w=1).

NDSU Syllabus & Introduction ECE 761 - JSG

4 May 14, 2018

b =

⎢⎢

⎢⎢

1231

⎥⎥

⎥⎥

a =

⎢⎢

⎢⎢

1 0 0 x0 1 0 y0 0 1 z0 0 0 1

⎥⎥

⎥⎥

⎢⎢

⎢⎢

1231

⎥⎥

⎥⎥=

⎢⎢

⎢⎢

1 + x2 + y3 + z

1

⎥⎥

⎥⎥

Point b has been shifted by [x,y,z].

Zoom in with a scaling factor of 2

a =

⎢⎢

⎢⎢

1 0 0 00 1 0 00 0 1 00 0 0 2

⎥⎥

⎥⎥

⎢⎢

⎢⎢

1231

⎥⎥

⎥⎥=

⎢⎢

⎢⎢

1232

⎥⎥

⎥⎥

This means if you plot the point (1,2,3), it will be doubled (zoomed in with a factor of 2)

X0

Y0

Z0

X1

Y1

Z1

x

y

z

⎢⎢

⎢⎢

x0

y0

z0

1

⎥⎥

⎥⎥=

⎢⎢

⎢⎢

1 0 0 x0 1 0 y0 0 1 z0 0 0 1

⎥⎥

⎥⎥

⎢⎢

⎢⎢

x1

y1

z1

1

⎥⎥

⎥⎥

NDSU Syllabus & Introduction ECE 761 - JSG

5 May 14, 2018

Matlab Review BeginnersBecoming familiar with MATLAB

The consoleThe editorThe graphics windowsThe help menuSaving your data (diary)

General environment and the console

Simple numerical calculations

>> x = 17/3

5.6667

>> y = (3+4)*5

35

Particular numbers

>> e = exp(1)

2.7183

>> pi

3.1416

NDSU Syllabus & Introduction ECE 761 - JSG

6 May 14, 2018

>> i

0 + 1.0000i

>> j

0 + 1.0000i

Do and don't display results>> x = 2*pi

6.2832

>> x = 2*pi;

Displaying number of decimal places

>> format short>> pi

3.1416

>> format long>> pi

3.141592653589793

>> format longe>> pi^30

8.212893304027486e+014

>> format shorteng>> pi^30

821.2893e+012

Matrices[ start of matrix] end of matrix, next element; next row

>> A = [1,2,3]

1 2 3

>> B = [1,2,3;4,5,6]

1 2 3 4 5 6

>> C = A'

1 2

NDSU Syllabus & Introduction ECE 761 - JSG

7 May 14, 2018

3

>> D = zeros(1,3)

0 0 0

Random Numbers: Uniform distribution from (0, 1)

>> rand(2,4)

0.8147 0.1270 0.6324 0.2785 0.9058 0.9134 0.0975 0.5469

Normal distrubution: N(0,1)>> randn(2,4)

3.5784 -1.3499 0.7254 0.7147 2.7694 3.0349 -0.0631 -0.2050

for loops:>> x = zeros(1,5);>> for i=1:5 x(i) = i*i; end>> x

x =

1 4 9 16 25

while

if

if else end

Example: Roll five 6-sided dice

>> x = [1:5]

1 2 3 4 5

>> rand(1,5)

0.7298 0.8908 0.9823 0.7690 0.5814

>> dice = ceil( 6*rand(1,5) )

3 6 2 4 4

>> dice = ceil( 6*rand(1,5) )

1 4 3 1 3

>> sum( ceil( 6*rand(1,5) ) )

8

NDSU Syllabus & Introduction ECE 761 - JSG

8 May 14, 2018

>> sum( ceil( 6*rand(1,5) ) )

16

Roll 5d6 one-hundred times and record how many rolls you get for each total:

>> X = zeros(30,1);>> for i=1:100 D = sum( ceil( 6*rand(1,5) ) ); X(D) = X(D) + 1; end>> bar(X)>> >> xlabel('Die Total');>> ylabel('Frequency');>> title('100 die rolls')

Result from rolling 5d6 100 times

Roll 5d6 10,000 times and record the frequency of each outcome:

>> X = zeros(30,1);>> for i=1:10000 D = sum( ceil( 6*rand(1,5) ) ); X(D) = X(D) + 1; end>> bar(X)>> xlabel('Die Total');>> ylabel('Frequency');>> title('10000 die rolls')

NDSU Syllabus & Introduction ECE 761 - JSG

9 May 14, 2018

Result of rolling 5d6 10,000 times

Numerical Integration:Simplest (and least accurate) is Euler integration

Area = Width * height

Example: Determine how much energy a 1.5m2 solar panel will generate in Fargo, ND over the past two weeks.Assume the efficiency of the solar panel is 20%

Solution: Get solar data from NDAWN:

https://ndawn.ndsu.nodak.edu/

Select Weather Data - Hourly - Fargo - Solar Total

NDSU Syllabus & Introduction ECE 761 - JSG

10 May 14, 2018

Export to a CVS file and copy the data to the clip board. From Matlab

>> Sun = [ paste in the data ];

>> size(Sun)

336 1

>> h = [1:336]';>> plot(h,Sun);>> xlabel('Hour')>> ylabel('MJ/m2')>>

Solar Radiation in Fargo for the last two weeks

NDSU Syllabus & Introduction ECE 761 - JSG

11 May 14, 2018

This is hourly data. To convert to Joules, integrate

height =data * 1,000,000 (MJ total over an hour)

width = 1 hour

Area = Width * height = Joules

>> MJ = sum(Sun)

MJ =

280.2130

To convert that to kWh

1MJ = 0.2778 kWh

>> kWh = MJ * 0.2778

kWh =

77.8432

At 20% efficiency, a solar panel would generate 15.5kWh over this 2 week span. This is worth about $1.55

>> kWh * 0.2

15.5686

Bouncing Ballx = 0;y = 1;

dx = 1;dy = 0;

ddx = 0;ddy = 0;

dt = 0.01;

for i=1:1000 ddy = -9.8; dx = dx + ddx*dt; dy = dy + ddy*dt;

x = x + dx*dt; y = y + dy*dt;

if (x > 1) dx = -abs(dx); end if (x < -1) dx = abs(dx); end if (y < -1)

NDSU Syllabus & Introduction ECE 761 - JSG

12 May 14, 2018

dy = abs(dy); end

hold off plot([-1,1],[-1,1],'.'); hold on plot(x,y,'o') pause(0.01); end

Bouncing Ball

NDSU Syllabus & Introduction ECE 761 - JSG

13 May 14, 2018

Analysissqrt(x) square root of xlog(x) log base elog10(x) log base 10exp(x) e^xexp10(x) 10^xabs(x) |x|round(x) round to the nearest integerfloor(x) round down (integer value of x)ceil(x) round up to the next integerreal(x) real part of a complex numberimag(x) imaginary part of a complex numberabs(x) absolute value of x, magnitude of a complex numberangle(x) angle of a complex number (answer in radians)unwrap(x) remove the discontinuity at pi (180 degrees) for a vector of angles

Polynomialspoly(x)roots(x)conv(x,y)

Trig Functionssin(x) sin(x) where x is in radianscos(x) cos()tan(x) tan()asin(x) arcsin(x)acos(x) arccos(x)atan(x) arctan(x)atan2(y,x) angle to a point (x,y)

Probability and Statisticsfactorial(x) (x-1)!gamma(x) x!rand(n,m) create an nxm matrix of random numbers between 0 and 1randn(n,m) create an nxm matrix of random numbers with a normal distributionsum(x) sum the columns of xprod(x) multiply the columns of xsort(x) sort the columns of x from smallest to largestlength(x) return the dimensions of xmean(x) mean (average) of the columns of xstd() standard deviation of the columns of x

Display Functionsplot(x) plot x vs sample numberplot(x,y) plot x vs. ysemilogx(x,y) log(x) vs ysemilogy(x,y) x vs log(y)loglog(x,y) log(x) vs log(y)mesh(x) 3d plot where the height is the value at x(a,b)contour(x) contour plot

NDSU Syllabus & Introduction ECE 761 - JSG

14 May 14, 2018

bar(x,y) draw a bar graphxlabel('time') label the x axis with the word 'time'ylabel() label the y axistitle() put a title on the plotgrid() draw the grid lines

Useful Commandshold on don't erase the current graphhold off do erase the current graphdiary create a text file to save whatever goes to the screenlinepace(a, b, n) create a 1xn array starting at a, increment by blogspace(a,b,n) create a 1xn array starting at 10^a going to 10^b, spaced logarithmicallysubplot() create several plots on the same screendisp('hello') display the message hello

Utilitiesformat set the display formatzeros(n,m) create an nxm matrix of zeroseye(n,m) create an nxm matrix with ones on the diagonalones(n,m) create an nxm matrix of oneshelp help using different functionspause(x) pause x seconds (can be a fraction). Show the graph as wellclock the present timeetime the difference between to timestic start a stopwatchtoc the number of seconds since tic

NDSU Syllabus & Introduction ECE 761 - JSG

15 May 14, 2018