Clear Filters
Clear Filters

2-D Kinematic robot example code

9 views (last 30 days)
Evan Rose
Evan Rose on 12 Apr 2021
Answered: Remo Pillat on 13 Apr 2021
Good Afternoon,
I have three questions.
1) I am using the following code, and I am struggling to move the base from the coordinates 0,0. I can move the other links however how can I change the coordinates in the base to any location in this workspace?
2) When using this code I see the following in line 62---> points = center + radius*[cos(theta) sin(theta) zeros(size(theta))];
What does the cos(theta) sin(theta) mean and why is this specific equation relevant to this movement as opposed to other kinematic equations?
3) I would like to show how the end effector can be in a position to measure a certain area of a figure. Is it possible to merge a figure from another script so that the kinematics appear to be acting on that specific figure?
Thank you,

Accepted Answer

Remo Pillat
Remo Pillat on 13 Apr 2021
Hi Evan,
Line 62 defines the shape of the figure that the robot should draw (a circle in the case of this example). Points on a unit circle (with radius 1 and center point [0,0]) are defined by x = cos(theta) and y = sin(theta). The equation is simply multiplying by the radius to scale the circle and moving it to a different center point. See
This equation generates a number of discrete points on the circle and the rest of the example uses those discrete points to calculate inverse kinematics solutions for the robot arm to reach these points. You could replace the circle with any other figure you have, as long as you have a way to calculate discrete points on the figure that the robot can follow.
For your question (1): for inverse kinematics purposes, the coordinates that the end effector should reach are always relative to the robot base. If you have global coordinates for end effector poses, you need to convert them to coordinates relative to the robot base and then you should be able to use that code.
Hope this helps,

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!