Week 2- 2R Robotic Arm Challenge
Explanation of the Program:
- Basic Math and Principles of the Program.
- The robotic arm consists of 2 links and a tool to complete a job at one end.
- Link 1 is of length l1=1.0 and Link 2 is of length l2=0.5.
- Link 1 (x0,y0 and x1,y1) is fixed at the origin and it's angle with the x axis is `theta1`. (x0,y0)=(0,0).
- x1=l1*cos(`theta1`) and y1=l1*sin(`theta1`).
- Link 2 is pin-jointed to end of Link 1.
- So Link 2 is x1,y1 and x2,y2. Angle `theta2` with x axis.
- x2=x1+l2*cos(`theta2`) and y2=y1+l2*sin(`theta2`).
- As theta1 moves from 90 to 0, theta2 makes 1 360-degree turn. Hence showing the forward motion of the Kinematic Chain.
- Flow of the Program.
- close, clear all plots and variables and clear the command window.
- Define l1, l2, Matrix theta1, Matrix theta2.
- Create a for loop with the length of theta1.
- Create another for loop inside the first for loop with the length of theta2.
- Inside this loop define x0, y0, x1, y1, x2, y2.
- Plot the graph, define axis, use pause function.
- close loops
- Use functions to make a video file of the plot
- Errors Faced
- Snytax errors: attached file er1, er2, er3.
- mistake: used 'uncompressed AVI' as 'uncompressed.avi'
- Both errors are fixed in program.
- OUTPUT
- shows a plot with a moving lines imitating a robotic arm.
- makes a video file named 'FKM.avi'-attached