Robotic Arm, Trajectory Generation

2 次查看(过去 30 天)
Amna
Amna 2025-2-6
编辑: Amna 2025-2-10
Hi Everyone,
I want to generate the trajectory of PFRR Serial Manipulator. Basically i want to show the translation of the prismatic link along the x-axis from 0 to -50. The code that are provided below give the translation of prismatic link along the z-aixs. I implement all the techniques like trot command and many more but still I didn't get the translation along the x-axis. Can anyone please help me to generate the correct trajectory (I want to show the movement of the prismatic link like a screw lead move along the x-axis in MATLAB not in Simulink).
Manipulator Discription:
Manipulator consist of four links
  1. Prismatic Link: like a screw lead
  2. Fixed link: perpendicular to the First link.
  3. Revolute Joint Link: Rotate from -pi to pi.
  4. Revolute Joint Link: Rotate from -pi to pi.
Code:
clc;
clear all;
close all;
L(1) = Link([0, 0, 127, pi/2, 1]);
L(2) = Link([0, 0, 58.864*2, 0]);
L(3) = Link([pi/7, 0, 55.88*2, pi/2, 0]);
L(4) = Link([pi/4, 0, 13.97*3, 0, 0]);
L(1).offset = 0;
L(1).qlim = [0, 127];
L(2).qlim = [0, 0];
L(3).qlim = [-pi, pi];
L(4).qlim = [-pi, pi];
PFRR = SerialLink(L);
PFRR.name = 'PFRR';
q_start = [50, 0, 0, 0];
q_end = [127, 0, pi/2, pi/3];
t = linspace(0, 5, 100);
[q_traj, qd_traj, qdd_traj] = jtraj(q_start, q_end, t);
videoFilename = 'manipulator_trajectory_PFRR.avi';
v = VideoWriter(videoFilename);
open(v);
figure;
hold on;
grid on;
set(gcf, 'Color', 'w');
axis([-150, 500, -250, 250, 0, 300]);
view(30, 30);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Trajectory of PFRR Manipulator');
[x, y] = meshgrid(-150:10:500, -250:10:250);
z = zeros(size(x));
surf(x, y, z, 'FaceColor', [0.8 0.8 0.8], 'EdgeColor', 'none', 'FaceAlpha', 0.5);
for i = 1:size(q_traj, 1)
q = q_traj(i, :)
PFRR.plot(q, 'workspace', [-150 500 -250 250 0 300], 'noarrow');
T = PFRR.fkine(q);
plot3(T.t(1), T.t(2), T.t(3), 'r.', 'MarkerSize', 8);
frame = getframe(gcf);
writeVideo(v, frame);
pause(0.1);
end
hold off;
close(v);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Assembly 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by