Week 3.2 - 2R Robotic Arm Challenge
Aim:
1. Write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm, as shown in the video.
2.Create an animation file of the plot.
3.Upload an animation on You tube and provide the You tube link for an animation in the report.
Objective:
1.watch the full vedio.
2.write the code script for making robotic arm and movement of the links.
3.Learning the concept of making plots.
4.learning the concept of creating animation vedio by the help of codescript.
Clear all is used to clear previous variables, values, size arrays from the workspace
Close all is used to close all the previous program.
Clc is used to clear all the values from the command window.
As per the video for making the robotic arm we need link. Here I am taking 2 link .
I am assuming the size of the link1 is 1 and link2 is 0.5. If i assume that
link1 and link2 connected with each other with rotational joint and the link 1 is joined
with base with rotational joints.
step 1 - will be finding the position of link 1.
step-2- will be finding the position of link 2.
we need calculate the co-ordinate of the starting value
for rotating them we need theta as degree. for getting the rotation rotation
we need different values of theta to rotate.
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10);
for getting iteration for different value of theta we have to use for loop.
if in 2d plot if there two graph x and y then we can divide them in a component method where we can get the position of the
liks. So, there are three co-ordinates.
so, we start from 'zero' which is the base of the robot.
initialy i start the value of the 'ct' as 1 and after first iteration it will go to second iteration and it will runs automatically untill the last itteration.ct= 1;
here, i am taking the varriable M as an array and for getting the iteration of 10 times .
i want an increment the ct as each and everytime forloop get executes. thatswhy i am writing ,'ct =ct+1'
after that i am ending the two for loops so that code get complete the iteration as per the equation inside the for loop and get
different positioned plot which is used to make the video.
for fixing the axis of the links,
axis([-0.5 1.5 0 1.5]) - command is used.
For getting the visualise the animation for particular time i will use
pause(' write required time')
For making movie I am using movie(M) command.
for naming the Videofile = VideoWriter('forward_kinematics.avi'); command is used
for open the vedio file open(videofile) command is used.
to write the vedio 'writeVideo(Videofile,M)' command is used.
for closing the vediofile 'close(Videofile)' command is used.
after running the whole code matlav succesfully created a vedio by using the plot.
2.How to get frame or plots one by one as per the iteration,
3.How to use movie command to create vedio, save vediofile with the proper name.