Skip to content

Commit

Permalink
静态抓取
Browse files Browse the repository at this point in the history
  • Loading branch information
骏文 钟 committed Apr 16, 2019
1 parent 6939535 commit a0a7f60
Show file tree
Hide file tree
Showing 50 changed files with 16,182 additions and 146,265 deletions.
6 changes: 4 additions & 2 deletions 三次样条插值/test.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
clear all;
%三次样条测试
%原始数据点
X = [0, 0.422955130, 0.598557636, 0.734591320, 0.850603738, 0.953558869, 1.056514000, 1.159469131, 1.274332912, 1.409208218, 1.585026197, 2];
Y = [0, 0.14881055128822188, 0.2976136037517004, 0.4464166562151788, 0.5952197086786574, 0.7440227611421358, 0.8928258136056142, 1.0416288660690929, 1.1904319185325714, 1.3392349709960498, 1.4880380234595283, 1.6368410759230068];
% X = [0, 0.422955130, 0.598557636, 0.734591320, 0.850603738, 0.953558869, 1.056514000, 1.159469131, 1.274332912, 1.409208218, 1.585026197, 2];
% Y = [0, 0.14881055128822188, 0.2976136037517004, 0.4464166562151788, 0.5952197086786574, 0.7440227611421358, 0.8928258136056142, 1.0416288660690929, 1.1904319185325714, 1.3392349709960498, 1.4880380234595283, 1.6368410759230068];
X = [0,1,2,3,4,5,6,7,8,9,10];
Y = [0,1,2,3,3,3,3,3,2,1,0];
s = csapi(X,Y); %三次样条
fnplt(s, 'r'); %绘制样条曲线
hold on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
% robot.Gravity = [0 0 -9.80];%重力方向设置


Q_zero = [0,0,0,0,90,0];%底座 -> 抓手
Q_zero = [0,90,0,0,0,00];%底座 -> 抓手
% robot.jacob0(Q_zero)

Angle_Last = Q_zero + [0,90,0,0,0,0];
pose_start = Fkine_Final(Q_zero)%正解

a = Ikine_Step(pose_start,Angle_Last)
%平移
trans = [1 0 0 0.2;
0 1 0 0.2;
Expand Down
2 changes: 1 addition & 1 deletion 梁斌-空间机器人:建模、规划与控制/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
% daspect([1 1 1]);%控制沿每个轴的数据单位长度,要在所有方向上采用相同的数据单位长度,使用 [1 1 1]


Q_zero1 = [0,0,0,0,90,0];%底座 -> 抓手
Q_zero1 = [10,20,30,40,90,50];%底座 -> 抓手
Angle_Last = Q_zero1 + [0,90,0,0,0,0];
p1 = Fkine_Final(Q_zero1)%正解
%平移
Expand Down
7,167 changes: 7,167 additions & 0 deletions 空间圆弧/Pos.csv

Large diffs are not rendered by default.

7,166 changes: 7,166 additions & 0 deletions 空间圆弧/Pos.txt

Large diffs are not rendered by default.

Binary file modified 空间圆弧/example.avi
Binary file not shown.
Binary file added 空间圆弧/example.mp4
Binary file not shown.
31 changes: 28 additions & 3 deletions 空间圆弧/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

v = 0.1;%运动速度0.1m/s
a = 0.03;%加速度 0.01接近三角函数
t = 0.1;%插补周期10ms(plc周期)
t = 0.002;%插补周期10ms(plc周期)
L = sqrt(trans(1,4)^2 + trans(2,4)^2 + trans(3,4)^2);%distance
N = ceil(L/(v*t)) + 1;%插补数量

Expand Down Expand Up @@ -66,14 +66,38 @@
plot3(trajectory(1,:),trajectory(2,:),trajectory(3,:),'r'),xlabel('x'),ylabel('y'),zlabel('z'),hold on;
plot3(trajectory(1,:),trajectory(2,:),trajectory(3,:),'o','color','g'),grid on;

% 减速比
Ratio1 = 121;
Ratio2 = 160.68;
Ratio3 = 101.81;
Ratio4 = 99.69;
Ratio5 = 64.56;
Ratio6 = 49.99;

Ratio = [Ratio1, Ratio2, Ratio3, Ratio4, Ratio5, Ratio6];

for i = 1:length(trajectory)
pose_start(1,4) = trajectory(1,i);
pose_start(2,4) = trajectory(2,i);
pose_start(3,4) = trajectory(3,i);
q(i,:) = Ikine_Step(pose_start,Q_zero);%反解
qout(i,:) = q(i,:).*Ratio / 2;
qout(i,:) = qout(i,:) .* [1 1 1 1 -1 -1];
end

Sizefont = 30;
xlabel('X (m)','FontSize',Sizefont,'FontName','Times New Roman');
ylabel('Y (m)','FontSize',Sizefont,'FontName','Times New Roman');
zlabel('Z (m)','FontSize',Sizefont,'FontName','Times New Roman');
grid on
format short;
%输出文件
Pos = roundn(qout,-4);
T=table(Pos);
fid = fopen('Pos.txt','wt+');
fprintf(fid,'%-8.4f,%-8.4f,%-8.4f,%-8.4f,%-8.4f,%-8.4f,\n',Pos.');
writetable(T,'Pos.csv');

figure(2);
for i = 1:6
v = diff(q(:,i));
Expand Down Expand Up @@ -118,9 +142,8 @@
% end
end


aviobj=VideoWriter('example.avi');
aviobj.FrameRate=10;%set FrameRate before open it
aviobj.FrameRate=30;%set FrameRate before open it
open(aviobj);

for i = 1:length(trajectory)
Expand All @@ -139,3 +162,5 @@
writeVideo(aviobj,MOV);
end
close(aviobj)


Loading

0 comments on commit a0a7f60

Please sign in to comment.