Robotics Toolbox & GUI

조회 수: 4 (최근 30일)
Ahmed Nabil
Ahmed Nabil 2016년 7월 14일
Hi, im using peter corke toolbox to create simple example of forward kinematics
here is the code which is work fine
function test
global X Y Z Ss J1 J2 J3 J4
J1=80;
J2=20;
J3=60;
J4=90;
Ss = ( [ J1 J2 J3 J4 ] * pi / 180 );
X = F_x(Ss);
disp(X)
Y = F_y(Ss);
disp(Y)
Z = F_z(Ss);
disp(Z)
end
function X = F_x(Ss)
L1 = Link([ 0 19.49 13.9 -pi/2 0 ]);
L2 = Link([ 0 0 84 0 0 ]);
L3 = Link([ 0 0 93.54 0 0 ]);
L4 = Link([ 0 0 75.27 0 0 ]);
R = SerialLink([L1 L2 L3 L4], 'name', 'Lab Robot');
T = R.fkine(Ss);
X= T(1,4);
end
function Y = F_y(Ss)
L1 = Link([ 0 19.49 13.9 -pi/2 0 ]);
L2 = Link([ 0 0 84 0 0 ]);
L3 = Link([ 0 0 93.54 0 0 ]);
L4 = Link([ 0 0 75.27 0 0 ]);
R = SerialLink([L1 L2 L3 L4], 'name', 'Lab Robot');
T = R.fkine(Ss);
Y= T(2,4);
end
function Z = F_z(Ss)
L1 = Link([ 0 19.49 13.9 -pi/2 0 ]);
L2 = Link([ 0 0 84 0 0 ]);
L3 = Link([ 0 0 93.54 0 0 ]);
L4 = Link([ 0 0 75.27 0 0 ]);
R = SerialLink([L1 L2 L3 L4], 'name', 'Lab Robot');
T = R.fkine(Ss);
Z= T(3,4);
end
but when i try to get input from GUI for the same example i got error say
Error using SerialLink/fkine (line 85) q must have 4 columns
here is the code..
function start_butt_Callback(hObject, eventdata, handles)
global X Y Z D J1 J2 J3 J4
% hObject handle to start_butt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
J1=get(handles.theta1,'string');
J2=get(handles.theta2,'string');
J3=get(handles.theta3,'string');
J4=get(handles.theta4,'string');
D = ( [ J1 J2 J3 J4 ] * pi / 180 );
X = F_x(D);
set(handles.co_x,'string',num2str(X))
Y = F_y(D);
set(handles.co_y,'string',num2str(Y))
Z = F_z(D);
set(handles.co_z,'string',num2str(Z))
%open_system('LabRobot3')
%set_param('LabRobot3/J1','value', get(handles.theta1,'string'))
%set_param('LabRobot3/J2','value', get(handles.theta2,'string'))
%set_param('LabRobot3/J3','value', get(handles.theta3,'string'))
%set_param('LabRobot3/J4','value', get(handles.theta4,'string'))
%set_param('LabRobot3/J5','value', get(handles.theta5,'string'))
%set_param('LabRobot3','SimulationCommand','start')
function X = F_x(D)
L1 = Link([ 0 19.49 13.9 -pi/2 0 ]);
L2 = Link([ 0 0 84 0 0 ]);
L3 = Link([ 0 0 93.54 0 0 ]);
L4 = Link([ 0 0 75.27 0 0 ]);
R = SerialLink([L1 L2 L3 L4], 'name', 'Lab Robot');
T = R.fkine(D);
X= T(1,4);
function Y = F_y(D)
L1 = Link([ 0 19.49 13.9 -pi/2 0 ]);
L2 = Link([ 0 0 84 0 0 ]);
L3 = Link([ 0 0 93.54 0 0 ]);
L4 = Link([ 0 0 75.27 0 0 ]);
R = SerialLink([L1 L2 L3 L4], 'name', 'Lab Robot');
T = R.fkine(D);
Y= T(2,4);
function Z = F_z(D)
L1 = Link([ 0 19.49 13.9 -pi/2 0 ]);
L2 = Link([ 0 0 84 0 0 ]);
L3 = Link([ 0 0 93.54 0 0 ]);
L4 = Link([ 0 0 75.27 0 0 ]);
R = SerialLink([L1 L2 L3 L4], 'name', 'Lab Robot');
T = R.fkine(D);
Z= T(3,4);
any help ?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Robotics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by