1 / 34

Servo Motor Control

Servo Motor Control. Basic computer control of motor position and velocity. Reading. Chapter 12. watch the motor movement. http://www.youtube.com/watch?v=7coUcEHxnYA - notice the choppy movement between taught points

eze
Télécharger la présentation

Servo Motor Control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Servo Motor Control Basic computer control of motor position and velocity

  2. Reading • Chapter 12

  3. watch the motor movement http://www.youtube.com/watch?v=7coUcEHxnYA - notice the choppy movement between taught points http://www.youtube.com/user/CompassAutomation?v=lpY2P4lDYwg - notice that the movements have been smoothed out

  4. smooth movement starts slow, speeds up, finishes slow Position vs. time Velocity vs. time

  5. How do you judge position? Encoder

  6. How do you judge speed (velocity)? Attach motor shaft to small generator Use the motor to generate electricity Faster = more voltage/current Called a Tachometer

  7. drive using position vs. time power to the motor

  8. more accurate

  9. constant adjustment based on results

  10. How do you teach a robot? • manually stepping through specific points

  11. the problem You know "basically" where the robot arm should be, with a few points. Very choppy. To run smoothly in real time, you need thousands, actually a descriptive formula, p= f(t), and v= f(t)

  12. we must smooth out the curve to this taught manually derived from a formula

  13. how we solve it • Program 11 pts. Capture the (x,y) value of each point. y = [ 0 7.5 20 30 45 50 45 30 20 7.5 0 ] x = [ 0 10 25 30 40 50 60 70 75 90 100 ] • Find a polynomial equation that generates the same y's, from those x's (that is, an equation that matches the x,y curve). y = ax2 + bx + c, or more terms than that... • Generate 100s of x,y points using the formula

  14. polynomials • 2nd order: y = ax2 + bx + c • 3rd order: y = ax3 + bx2 + cx + d • 4th order: y = ax4 + bx3 + cx2 + dx + e number of coefficients = order+1

  15. step 1 y = [0 7.5 20 30 45 50 45 30 20 7.5 0 ] x = [0 10 25 30 40 50 60 70 75 90 100 ] figure(1) plot( x, y)

  16. coeff = polyfit(x, y, n) • find a polynomial of the nth order that fits the x vs y vectors • coeff will be a column vector of n+1 values • if n = 2, then MATLAB will return coeff(1), coeff(2), and coeff(3) so that • vel = coeff(1) * x2 + coeff(2) * x + coeff(3) • remember : x = [0 10 25 30 40 50 60 70 75 90 100 ] vel = [ 11 new pts ]

  17. order = 2 coeff = polyfit(x,y,2) vel = (coeff(1)*x.^2)+(coeff(2)*x)+coeff(3) coeff % -0.0182 1.8182 -5.0000 figure(2) plot(x, vel) note x.^2 means x2

  18. with n = 2 (3 Coeffs)

  19. order = 3 coeff = polyfit(x,y,3) vel = (coeff(1)*x.^3)+(coeff(2)*x.^2)+(coeff(3)*x) + coeff(4) figure(3) plot(x, vel)

  20. order = 4 (5 coeffs) coeff = polyfit(x,y,4) vel =(coeff(1)*x.^4)+(coeff(2)*x.^3)+(coeff(3)*x.^2) + (coeff(4)*x) +coeff(5) figure(4) plot(x, vel)

  21. order = 5 (6 coeffs) coeff = polyfit(x,y,5) vel = (coeff(1)*x.^5)+(coeff(2)*x.^4)+(coeff(3)*x.^3)+(coeff(4)*x.^2)+(coeff(5)*x) + coeff(6) figure(5) plot(x, vel)

  22. order = 6 (7 coeffs) coeff = polyfit(x,y,6) vel = (coeff(1)*x.^6)+(coeff(2)*x.^5)+(coeff(3)*x.^4)+(coeff(4)*x.^3)+(coeff(5)*x.^2)+ (coeff(6)*x)+coeff(7) figure(6) plot(x, vel)

  23. pretty close

  24. now plot for 1000 values of X x = [1: .1 :100] vel = (coeff(1)*x.^6)+(coeff(2)*x.^5)+(coeff(3)*x.^4)+(coeff(4)*x.^3)+(coeff(5)*x.^2)+ (coeff(6)*x)+coeff(7) figure(7) plot(x, vel)

  25. Actual robot code % here's an actual robot curve v vs. t degrees = [0: 20: 360] radians = degrees*pi/180 % divide curve into 100 increments t = degrees/3.6 y1 = 25*(1-cos(radians)) %not a polynomial figure(8) plot(t,y1)

  26. Actual robot code % position p vs. t degrees = [0: 20 :180] radians = degrees*pi/180 position = 20*(1-cos(radians)) t = degrees / 1.8 % move 1 degree in 1.8 sec figure(9) plot(t, position)

  27. practice for the exam: %define an x row vector of 5 pts: x = [1:20:100] %get a y function of 5 pts y = 40*( 1-sin(x*pi/180) ) figure(10) plot( x, y)

  28. polyfit to order = 2 coeff = polyfit(x,y,2) vel = (coeff(1)*x.^2)+(coeff(2)*x)+coeff(3) figure(11) plot(x, vel)

  29. test that curve with 100 pts. x = [1:100] y = (coeff(1)*x.^2)+(coeff(2)*x)+coeff(3) figure(12) plot(x, y)

  30. try 6th order %define an x row vector of 5 pts: x = [1:20:100] %get a y function of 5 pts y = 40*(1-sin(x*pi/180)) coeff = polyfit(x,y,6) vel = (coeff(1)*x.^6) + (coeff(2)*x.^5) +(coeff(3)*x.^4) + (coeff(4)*x.^3) + (coeff(5)*x.^2)+(coeff(6)*x)+coeff(7) figure(13) plot(x, vel)

  31. warning Warning: Polynomial is not unique; degree >= number of data points. NOTE: the polynomial order must be less than the number of data points

  32. try 4th order %define an x row vector of 5 pts: x = [1:20:100] %get a y function of 5 pts y = 40*(1-sin(x*pi/180)) coeff = polyfit(x,y,4) vel = (coeff(1)*x.^4) + (coeff(2)*x.^3) + (coeff(3)*x.^2)+(coeff(4)*x)+coeff(5) figure(14) plot(x, vel)

  33. smooth it out x = [1:100] y = 40*(1-sin(x*pi/180)) coeff = polyfit(x,y,4) y = (coeff(1)*x.^4) + (coeff(2)*x.^3) + (coeff(3)*x.^2)+(coeff(4)*x)+coeff(5) figure(15) plot(x, y)

More Related