Challenge

Week 2- 2R Robotic Arm Challenge

  1. clear all
  2. close all
  3. clc
  4. %inputs
  5. l1=1;
  6. l2=0.5;
  7. theta1=linspace(0,90,40);
  8. theta2=linspace(0,90,40);
  9. ct=1;
  10. for i=1:length(theta1)
  11. THETA1=theta1(i);
  12. for j=1:length(theta2)
  13. THETA2=theta2(j);
  14. x0=0;
  15. y0=0;
  16. x1= l1*cosd(THETA1);
  17. y1= l2*sind(THETA1);
  18. x2= x1 + l2*cosd(THETA2);
  19. y2= y1 + l2*sind(THETA2);
  20. % plotting
  21. plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
  22. axis ([-0.1 1.5 0 1.5])
  23. pause (0.5)
  24. M(ct)=getframe(gcf);
  25. ct=ct+1;
  26. end
  27. end
  28. Movie(M)
  29. videofile= videowriter('forward_kinematic.avi','uncompressed AVI');
  30. open(videofile)
  31. write_video (videofile,M)
  32. close(videofile)

explanation:

Let see about inputs

l1,l2 are length of the robotic arms.the row

11,12 denotes the theta value assume like [0,90] differs as 10 values

for continuos action we use for loop condition

ct use for each and every frame

start the for contion i=1:length(theta1) which means i=1:90

plotting all the axixes and mention the width of the line

arrange the axis to show the ploting graph in centre place

pause command to show the speed for the arms

and end the for conditions

in the row 49 to 53 the commands use to make the movie for kinematic 2d robotic arm for continuous motion

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.