Challenge

Week 2- 2R Robotic Arm Challenge

https://youtu.be/xo5FQQhN6z4

https://drive.google.com/file/d/1HpsfCN4I1y6cx2QeB9RU63pDfd--_D7D/view?usp=sharing

* I have provided the links above for movie and if google link video do not start please download the video then play it.

* I have attached the script.

* I have not faced many errors but only faced errors in making movie because it was a new concept for me and i have attached the error screenshot also.

* The error was simple it was a case sensitive error

* steps to solve the error

1. I saw the video twice and matched my coding and tried changing the alphabets from small to capital and vice versa but nothing happened.

2. then I checked online and saw some videos online.

3. then i modyfied my code a little bit but the error did not go.

4. so then when i typed ,like writevideo or other commands i used the TAB button for suggestion and then finally my video runs.

% A program in Matlab to simulate the forward kinematics of a 2R Robotic Arm
 
 %inputs
 L1=1; %length of link 1
 L2=0.5; %length of link 2
 
 theta1=linspace(0,90,10);%angle between base and link 1
                          %linspace used for equal interval 
                          
 theta2=linspace(0,90,10);%angle between imaginary base(at the end of link 1) and link 2
                          %linspace used for equal interval
                          
 videofile=VideoWriter('forward kinematics.avi','Uncompressed AVI');%name of video
 
 open(videofile);  %opening videofile
 
 ct=1;  %counter
 %for loop
 for i=1:length(theta1)     %it will access values from 1 to theta1 value 
     THETA1=theta1(i);      %assigning a new variable THETA1
     for j=1:length(theta2) %it will access values from 1 to theta2 value 
     THETA2=theta2(j);      %assigning a new variable THETA2
    
  %co-ordinates
 x0=0; %value of x0
 y0=0; %value of y0
 
 x1=L1*cosd( THETA1); %formula to calculate x1
 y1=L1*sind( THETA1); %formula to calculate y1
 
 x2=x1+L2*cosd(THETA2); %formula to calculate x2
 y2=y1+L2*sind(THETA2); %formula to calculate y2
 
 %plotting

  plot([x0 x1],[y0 y1],[x1 x2],[y1 y2]); %plotting the values
  axis([-1 1.5 0 1.5]) %used this command to show the graph nicely by shifting x axis and y axis accordingly
  pause(0.03) %it stops the fig every 0.03 seconds 
 
  f=getframe(gcf); %to get the frame
  ct=ct+1;         %increamenting the counter by 1
  writeVideo(videofile,f); %writing the videofile
     end
 end

 videofile.close(); %closing the video
 
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.