Creating a realistic robot workspace using Peter Corke Toolbox (Matlab)?

0 down vote favorite
I am trying to make a workspace plot representation for a 7 DOF robot. The robot has limited ranges for each joint angle and I wish to incorporate these ranges to plot a workspace representation. As of now, the robot is at its datum orientation. The code below helps create that orientation. I am using the Peter Corke Robotics toolbox.
%Theta Inputs
T1= 0;
T2= 45;
T3= 0;
T4= -90; % or 270 degrees
T5= 0;
T6= 0;
T7= 0;
%Input Conversion
T1 = T1*pi/180;
T2 = T2*pi/180;
T3 = T3*pi/180;
T4 = T4*pi/180;
T5 = T5*pi/180;
T6 = T6*pi/180;
T7 = T7*pi/180;
T = [T1,T2,T3,T4,T5,T6,T7];
L1 = 0.270350;
L2 = 0.069;
L3 = 0.36435;
L4 = 0.069;
L5 = 0.37429;
L6 = 0.01;
L7 = 0.229525;
LL(1) = Link([0,L1,0,0]);
LL(2) = Link([0,0,L2,pi/2]);
LL(3) = Link([0,L3,0,-pi/2]);
LL(4) = Link([0,0,L4,pi/2]);
LL(5) = Link([0,L5,0,-pi/2]);
LL(6) = Link([0,0,L6,pi/2]);
LL(7) = Link([0,L7,0,-pi/2]);
%DH table
R7 = SerialLink(LL)
R7.name = 'BAXTER'
%Plot
R7.plot(T)
The ranges for each theta values are as followed (in degrees):
%T1 = from -97.494 to +97.494
%T2 = from -123 to +160
%T3 = from -174.987 to +174.987
%T4 = from -2.864 to +150
%T5 = from -175.25 to +175.25
%T6 = from -90 to +120
%T7 = from -175.25 to +175.25
I would like the plot be composed as dotted points if possible. Also if it can be shown to animate to create the workspace that would be nice. I apologize since I know this is a lot to ask for anybody who views this question. So I will be truly grateful to whoever answers this question. Much would be appreciated!

3 Comments

I am not sure if you still need it. Here is one of my attempts, I hope it will be useful.
%% Left Arm
% Theta d a alpha r/p theta offset
Ll(1) = Link ([0 0.27035 0.069 -pi/2 0 0], 'standard'); % start at joint s0 and move to joint s1
Ll(2) = Link ([0 0 0 pi/2 0 pi/2], 'standard'); % start at joint s1 and move to joint e0
Ll(3) = Link ([0 0.36435 0.0690 -pi/2 0 0], 'standard'); % start at joint e0 and move to joint e1
Ll(4) = Link ([0 0 0 pi/2 0 0], 'standard'); % start at joint e1 and move to joint w0
Ll(5) = Link ([0 0.37429 0.010 -pi/2 0 0], 'standard'); % start at joint w0 and move to joint w1
Ll(6) = Link ([0 0 0 pi/2 0 0], 'standard'); % start at joint w1 and move to joint w2
Ll(7) = Link ([0 0.229525 0 0 0 0], 'standard'); % start at joint w2 and move to end-effector
Baxter_Left = SerialLink(Ll, 'name', 'Baxter Left Arm', 'base' , ...
transl(0.024645, 0.219645, 0.118588) * trotz(pi/4)...
* transl(0.055695, 0, 0.011038));
%%
hold on;N=300000;
for n=1:1:300000
%
theta1=-141/180*pi+(141/180*pi+51/180*pi)*rand(N,1); %limit of joint1
theta2=-123/180*pi+(123/180*pi+60/180*pi)*rand(N,1); %limit of joint2
theta3=-173/180*pi+(173/180*pi+173/180*pi)*rand(N,1); %limit of joint3
theta4=-3/180*pi+(3/180*pi+150/180*pi)*rand(N,1); %limit of joint4
theta5=-175/180*pi+(175/180*pi+175/180*pi)*rand(N,1); %limit of joint5
theta6=-90/180*pi+(90/180*pi+120/180*pi)*rand(N,1); %limit of joint6
theta7=-175/180*pi+(175/180*pi+175/180*pi)*rand(N,1);%limit of joint7
qq=[theta1(n),theta2(n),theta3(n),theta4(n),theta5(n),theta6(n),theta7(n)];
Mricx=Baxter_Left.fkine(qq);
hold on;
drawnow;
plot3(Mricx.t(1),Mricx.t(2),Mricx.t(3),'b.','MarkerSize',0.5);
pause(0.001)
end
Yours,
-John
What does it mean by "Dot indexing is not supported for variables of this type."

Sign in to comment.

Answers (0)

Categories

Asked:

on 27 Apr 2018

Commented:

on 3 Jun 2020

Community Treasure Hunt

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

Start Hunting!