I need help developing a 3DOF mechanism that has 6 joints and completes a 360 degree rotation. The mechanisim is a R_R_R_R_T_R.
조회 수: 5 (최근 30일)
이전 댓글 표시
Here is my mechanism and my data. I am having real touble with a function in my code. "solD = solve(eqD1, eqD2, 'xDsol, yDsol');"
It keeps giving me an error.
Help would be much apprecitaed!
The code I am working with can be found below.
Notice I included my data.
I also had to figure out how to represent 320 degrees as phi. I think it can be pi/10? I am not sure. Maybe this can help better. I am essentially using this code format to edit it for my project.
Some of the code I am sure does not make sense, since I am still working on it and trying to figure out how to manipulate things to reprsent my problem. I have already solved this via the classical method. I am just trying to put it in matlab for the first time.
clear all; clc; close all
OA = 0.0400;
AB = 0.100; % m
BC = 0.070; % m
OC = 0.120; % m
CE = 0.060; % m
DE = 0.065; % m
La = 0.30 ; % m
Lb = 0.40 ; % m
Lc = OC ; % m
phi = pi/10; % rad
omega = pi; % rad/s
alpha = 0.; % rad/s^2
% position of joint A:
xA = 0; yA = 0;
% at the initial moment phi=0 => increment = 0
increment = 0 ;
% the step has to be small for this method
step=pi/18;
for phi=pi/10:step:pi/10+2*pi,
fprintf('phi = %g deegres \n\n', phi*360/pi)
% call function driver
jointB = driver(xA,yA,AB,phi,omega,alpha);
% position of joint B
xB = jointB(1);
yB = jointB(2);
rB = [xB yB 0];
fprintf('rB = [%6.3g, %6.3g, %g] (m)\n', rB)
xD = La; yD = Lb;
rD = [xD yD 0];
% position of joint C
% call function pRRR
posC = pRRR(xB,yB,xD,yD,BC,CD);
xC1 = posC(1); yC1 = posC(2);
xC2 = posC(3); yC2 = posC(4);
if increment == 0
if yC1 > yB xC = xC1; yC = yC1;
else xC = xC2; yC = yC2; end
else
dist1 = Dist(xC1,yC1,xCold,yCold);
dist2 = Dist(xC2,yC2,xCold,yCold);
if dist1<dist2 xC=xC1; yC=yC1;
else xC=xC2; yC=yC2; end
end
xCold=xC;
yCold=yC;
increment=increment+1;
rC = [xC yC 0]; % position vector of C
fprintf('rC = [%6.3g, %6.3g, %g] (m)\n', rC)
% angle of the link 2 with the horizontal
phi2 = atan((yB-yC)/(xB-xC));
% angle of the link 3 with the horizontal
phi3 = atan((yC-yD)/(xC-xD))+pi ;
xE = xD+(CD+CE)*cos(phi3);
yE = yD+(CD+CE)*sin(phi3);
% % call function p3P (D, C, E on line)
% posE = p3P(xD,yD,xC,yC,CD+CE);
% xE1 = posE(1); yE1 = posE(2);
% xE2 = posE(3); yE2 = posE(3);
%
% fprintf('xE1 = %6.3g \n', xE1)
% fprintf('yE1 = %6.3g \n', yE1)
% fprintf('xE2 = %6.3g \n', xE2)
% fprintf('yE2 = %6.3g \n', yE2)
%
% if yE1 > yC xE = xE1; yE = yE1;
% else xE = xE2; yE = yE2; end
rE = [xE yE 0]; % position vector of E
fprintf('rE = [%6.3g, %6.3g, %g] (m)\n', rE)
xF = - Lc;
phi5 = pi/2;
% position of joint F
% call function pRRT
posF = pRRT(xE,yE,-Lc,0,EF,phi5);
yF1 = posF(2); yF2 = posF(4);
if yF1 < yE yF = yF1; else yF = yF2; end
rF = [xF yF 0]; % position vector of F
fprintf('rF = [%6.3g, %6.3g, %g] (m)\n', rF)
% angle of the link 4 with the horizontal
phi4 = atan((yE-yF)/(xE-xF));
fprintf('phi2 = %g (degrees) \n', phi2*360/pi);
fprintf('phi3 = %g (degrees) \n', phi3*360/pi);
fprintf('phi4 = %g (degrees) \n\n', phi4*360/pi);
x_C2(increment)=(xB+xC)/2;
y_C2(increment)=(yB+yC)/2;
% graphic of the mechanism
axis manual
axis equal
hold on
grid on
% axis([-0.7 0.7 -0.7 0.7])
axis([-0.4 0.4 -0.2 0.7])
xlabel('x (m)'),ylabel('y (m)')
pM=plot(...
[xA,xB],[yA,yB],'r-o',...
[xB,xC],[yB,yC],'b-o',...
[xD,xE],[yD,yE],'k-o',...
[xE,xF],[yE,yF],'r-o');
plot(x_C2, y_C2, 'k.','Color', 'red')
pause(1);
delete(pM);
end
text(xA,yA,' A'), text(xB,yB,' B')
text(xC,yC,' C'), text(xD,yD,' D')
text(xE,yE,' E'), text(xF,yF,' F')
grid on
plot(...
[xA,xB],[yA,yB],'r-o',...
[xB,xC],[yB,yC],'b-o',...
[xD,xE],[yD,yE],'k-o',...
[xE,xF],[yE,yF],'r-o')
title('Path described by C_2')
% end of program
댓글 수: 3
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!