Unrecognized method, property, or field 'vertices' for class 'triangulation'.
Show older comments
I am trying to create a virtual robot and can not get this code to run without getting a error.
clc
clear all
dtr = pi/180;
base =stlread('base.stl');
arm=stlread('arm.stl');
head=stlread('head.stl');
finger=stlread('finger.stl');
patch(base, 'EdgeColor', 'None','FaceColor','r');
patch(arm, 'EdgeColor', 'None','FaceColor', 'b');
patch(head, 'EdgeColor', 'None','FaceColor', 'g');
patch(finger, 'EdgeColor', 'None','FaceColor', 'y');
xlabel('x');
ylabel('y');
zlabel('z');
%Make base larger
for ind=1:length(base.vertices(:,1))
base.vertices(ind,:)=(1150*eye(3)*base.vertices(ind,:)')';
end
%Move the base in the y direction
R=[1 0 0;0 1 0;0 0 1]';d=[0;75;0];
for ind =1:length(base.vertices(:,1))
base.vertices(ind,:) = (R*base.vertices(ind,:)'+d)';
end
%move arm in x and z direction
R=[1 0 0; 0 1 0 ; 0 0 1]';d=[-75;0;0.03];
for ind =1:length(arm.vertices(:,1))
arm.vertices(ind,:) = (R*arm.vertices(ind,:)'+d)';
end
%change head x direction and move 100.03 on z and 300 on x
R=[1 0 0; 0 1 0; 0 0 -1]';d=[250;0;265];
for ind = 1:length(head.vertices(:,1))
head.vertices(ind,:) = (R*head.vertices(ind,:)'+d)';
end
%moving finger
R=[1 0 0; 0 1 0; 0 0 -1]'; d=[520;-171;400];
for ind = 1:length(finger.vertices(:,1))
finger.vertices(ind,:) = (R*finger.vertices(ind,:)'+d)';
end
baseo=base; armo=arm; heado=head; fingero=finger;
patch(baseo, 'EdgeColor', 'None','FaceColor','r');
patch(armo, 'EdgeColor', 'None','FaceColor', 'b');
patch(heado, 'EdgeColor', 'None','FaceColor', 'g');
patch(fingero, 'EdgeColor', 'None','FaceColor', 'y');
axis equal
view(3)
xlabel('x');
ylabel('y');
zlabel('z');
pause
When trying to run this code I keep receiving the error
Unrecognized method, property, or field 'vertices'
for class 'triangulation'.
Error in robot (line 26)
for ind =1:length(base.vertices(:,1))
Accepted Answer
More Answers (0)
Categories
Find more on Robotics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!