Advertisement
Guest User

Untitled

a guest
May 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.34 KB | None | 0 0
  1. m = 0.03; %wheel mass
  2. M = 0.5; %mbot mass
  3. R = 0.03; %wheel radius
  4. Jw = m*(R^2)/2; %wheel inertia moment
  5. n = 1; %gear ratio;
  6. W = 0.133; %body width
  7. D = 0.05; %body depth
  8. H = 0.129; %body height
  9. g = 9.8; %gravity acceleration
  10. L = H/2; %distance of the center of the mass from the wheel axle
  11. Jfork = M*(L^2)/3; %body pitch inertia moment
  12. Jphi = M*((W^2) + (D^2))/12; %body yaw inertia moment
  13. Jm = 1e-5; %dc motor inertia moment
  14. Rm = 6.69; %[ohm], dc motor resistance
  15. Kb = 0.468; % [V sec / rad] dc motor back emf constant
  16. Kt = 0.317; %[Nm/A] dc motor torque constant
  17. fm = 0.0022; %friction coefficient between body and dc motor
  18. fw = 0; % friction coefficient between body and motion surface
  19.  
  20. e12 = M*L*R - 2*n^2*Jm;
  21. e11 = (2*m + M) * R^2 + 2*Jw + 2*n^2*Jm;
  22. e22 = M*(L^2) + Jfork + 2*n^2*Jm;
  23.  
  24. detE = e11*e22-(e12^2);
  25.  
  26. alpha = n*Kt/Rm;
  27. beta = n*Kt*Kb/Rm + fm;
  28. sigma = beta + fw;
  29.  
  30. a32 = -g*M*L*e12/detE;
  31. a42 = g*M*L*e11/detE;
  32. a33 = -2*(sigma*e22 + beta*e12) / detE;
  33. a43 = 2 * (sigma * e12 + beta * e11)/detE;
  34. a34 = 2 * beta * (e22 + e12) / detE;
  35. a44 = -2 * beta *(e11 + e12) / detE;
  36. b3 = alpha * (e11 + e12) / detE;
  37. b4 = -alpha * (e11 + e12) / detE;
  38.  
  39. A = [0 0 1 0; 0 0 0 1; 0 a32 a33 a34; 0 a42 a43 a44];
  40. B = [0 0; 0 0; b3 b3; b4 b4];
  41.  
  42. %Discretizing
  43.  
  44. Ad = expm(A*0.01);
  45. Bd = A\(Ad - eye(size(Ad))) * B;
  46. eig(A); %poles => unstable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement