robotics section 4 matlab practice

robotics section 4 matlab practice

使用matlab robot toolbox工具箱编程求解工作空间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% 加载内置的 Puma560 模型
mdl_puma560
robot = p560;

% 获取每个关节的范围(这里假设是 +-160° 的范围,单位转为弧度)
q1 = deg2rad(linspace(-160, 160, 20));
q2 = deg2rad(linspace(-110, 110, 20));
q3 = deg2rad(linspace(-135, 135, 20));
q4 = deg2rad(linspace(-266, 266, 10));
q5 = deg2rad(linspace(-100, 100, 10));
q6 = deg2rad(linspace(-266, 266, 10));

workspace = [];

for i = 1:length(q1)
for j = 1:length(q2)
for k = 1:length(q3)
T = robot.fkine([q1(i), q2(j), q3(k), 0, 0, 0]);
position = transl(T); % 提取平移部分
workspace = [workspace; position];
end
end
end

figure;
plot3(workspace(:,1), workspace(:,2), workspace(:,3), '.', 'MarkerSize', 1);
xlabel('X (m)');
ylabel('Y (m)');
zlabel('Z (m)');
title('Puma560 Robot Workspace');
grid on;
axis equal;

得到结果:

result

robotics section 4 matlab practice
https://symcreg.github.io/2025/04/24/robotics-section-4-matlab-practice/
作者
sm
发布于
2025年4月24日
许可协议