Changing Trajectory and finding theta for inverse kinematics
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Evan Rose
le 1 Mai 2021
Modifié(e) : Karsh Tharyani
le 28 Oct 2021
Hello,
For my dissertation, I would like to deploy a 2 DOF robot manipulator using the following code https://www.mathworks.com/help/robotics/ug/2d-inverse-kinematics-example.html, 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?
Thanks,
Evan
0 commentaires
Réponse acceptée
Karsh Tharyani
le 28 Oct 2021
Modifié(e) : Karsh Tharyani
le 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;
end
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.
r=[1,2]';
v=[-3,2]';
t=0:0.1:100;
points=r+v*t;
plot(points(1,:),points(2,:))
Hope that helps!
Best,
Karsh
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Robotics dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!