필터 지우기
필터 지우기

Changing Trajectory and finding theta for inverse kinematics

조회 수: 6 (최근 30일)
Evan Rose
Evan Rose 2021년 5월 1일
편집: Karsh Tharyani 2021년 10월 28일
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

채택된 답변

Karsh Tharyani
Karsh Tharyani 2021년 10월 28일
편집: Karsh Tharyani 2021년 10월 28일
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개)

카테고리

Help CenterFile Exchange에서 Robotics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by