Changing Trajectory and finding theta for inverse kinematics

6 views (last 30 days)
For my dissertation, I would like to deploy a 2 DOF robot manipulator using the following code, however I want to change the trajectory to go straight to an end point rather than follow a circular trajectory but I am struggling to alter the code in this way. How would I go about changing the path to achieve this particular end point?
Secondly once I have set this end point, I need to discover both values for theta 1 and theta 2. Is there a way to discover this from the code? If not how else should I try to find these values?

Accepted Answer

Karsh Tharyani
Karsh Tharyani on 28 Oct 2021
Edited: Karsh Tharyani on 28 Oct 2021
Hi Evan,
I think you were referring to this example. The example demonstrates how to use inverseKinematics in obtaining the joints' positions when the end-effector of the robot is placed at a certain pose.
End effector's (specified by endEffector) pose is trvec2tform(point) as shown below:
for i = 1:count
% Solve for the configuration satisfying the desired end effector
% position
point = points(i,:);
qSol = ik(endEffector,trvec2tform(point),weights,qInitial);
% Store the configuration
qs(i,:) = qSol;
% Start from prior solution
qInitial = qSol;
qSol are your joint angles which you refer to as theta1 and thetat2 in your question. The points are generated in the section (just above this snippet) here:
t = (0:0.2:10)'; % Time
count = length(t);
center = [0.3 0.1 0];
radius = 0.15;
theta = t*(2*pi/t(end));
points = center + radius*[cos(theta) sin(theta) zeros(size(theta))];
As you can see, points are defined by the parameteric equation (parameterized by theta) of the circle. You can, accordingly, use the parameteric equation of a line via a starting point r and a direction v. In your case, you can think of v as the velocity of the end-effector origin along the X and Y axes, respectively.
For instance, a starting point (1,2) and moving with velocity (-3,2) units.
Hope that helps!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!