Velocity at the center of coupler

I simulated a four-bar linkage coupler position and velocity. The position simulation result shows a coupler has position and orientation change at the center. But the velocity simulation shows it has only an angular velocity about a direction perpendcular to the plane. I attached a picture of simulation but unfortunately, I am not able to attach the simulation video.
How did that happen?
Any explanation is appreciated

Could you share with us the exact function calls that you’re using to get the values for each of these plots?

1 Like

set(0,‘defaulttextinterpreter’,‘latex’)
set(0,‘DefaultAxesFontName’, ‘Times New Roman’)
set(0,‘DefaultAxesFontSize’, 12)
set(0,‘DefaultTextFontSize’, 12)
set(0,‘defaultLegendInterpreter’,‘latex’);
clear all; clc;
close all
d1=15;
d2=16;
d3=7;
d4=10;
x1=0;
x1=0;
y1=0;
x4=d4;
y4=0;
l5=15;
l6=15;
omega=4pi;
j=1;
%%%%%%%%
figure(1)
hFig = figure(1);
set(hFig, ‘Position’, [0.1 0.7 900 700]);
m=moviein(400);
for t=0:0.01:1
th(j)=omega
t;
t_vect(j)=t;
k1=sin(th(j));
k2=(d4/d3)+cos(th(j));
k3=(d4/d1)cos(th(j))+(d4^2+d3^2+d1^2-d2^2)/(2d3d1);
psi(j)=2
atan((k1+sqrt(k1^2+k2^2-k3^2))/(k2+k3));
psi_2(j)=2atan((k1-sqrt(k1^2+k2^2-k3^2))/(k2+k3));
theta1_d=psi.180/pi;
theta3_d=th.180/pi;
Gc=k1^2+k2^2-k3^2;
if Gc<0
continue
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x2(j)=d1
cos((psi(j)));
y2(j)=d1
sin((psi(j)));
x3(j)=x4+d3
cos(th(j));
y3(j)=y4+d3sin(th(j));
x5(j)=x1-l5;
y5(j)=y1;
x6(j)=x3(j)+l6
cos(th(j));
y6(j)=y3(j)+l6sin(th(j));
P0=[x4;y4;0]
P2=[x2(j);y2(j);0];
P3=[x3(j);y3(j);0];
P=1/2
(P2+P3)
PP(:,j)=1/2*(P2+P3)
Orient_angle(j)=atan2d(P(1),P(2))
%% Jacobian
s11=[0;0;1];
so11=[0;0;0];
s12=[0;0;1];
so12=cross(s11,P2);
s21=[0;0;1];
so21=cross(s21,P0);
s22=[0;0;1];
so22=cross(s22,P3);
J_leg1=[[s11;so11],[s12;so12]]
J_leg2=[[s21;so21],[s22;so22]];
Restrictions screw Restr_1= null(J_leg1'); J_extend=[J_leg1,Restr_1] Active_wrench=null(transpose(J_extend(:,2:6))) Lock_second_joint=[[J_extend(1:6,1),J_extend(1:6,3:6)]] Second_joint_wrench=null(transpose(Lock_second_joint)) Reciprocity test
E=[zeros(3),eye(3);eye(3),zeros(3)]
Active_Wrench_Test=transpose(J_extend)Active_wrench; gives zero except the first one Passive_Wrench_Test=transpose(J_extend)*Restr_1; gives non-zero diagonal to all restricion
G=[E
Active_wrench,ESecond_joint_wrench, ERestr_1]
Gc=[ESecond_joint_wrench, ERestr_1]
Projector=eye(6)-Gcpinv(Gc)
St=[2
cos(2pit); 2sin(2pit);2sin(2pit);cos(2pit);sin(2pit);cos(2pit)]
Stm=Projector*St
vx(j)=Stm(1,:slight_smile:
vy(j)=Stm(2,:slight_smile:
vz(j)=Stm(3,:slight_smile:
wx(j)=Stm(4,:slight_smile:
wy(j)=Stm(5,:slight_smile:
wz(j)=Stm(6,:slight_smile:
% Identfy linear dependent ones
dth=G’*Stm
dth1(j)=dth(1)
dth2(j)=dth(2)
dth3(j)=dth(3)
dth4(j)=dth(4)
dth5(j)=dth(5)
dth6(j)=dth(6)

%% Simulation    
subplot(2,3,1);          
x12=[x1,x2(j)];
y12=[y1,y2(j)];
x23=[x2(j),x3(j)];
y23=[y2(j),y3(j)];
x34=[x3(j),x4];
y34=[y3(j),y4];
x41=[x4,x1];
y41=[y4,y1];
x15=[x1,x5(j)];
y15=[y1,y5(j)];
x36=[x3(j),x6(j)];
y36=[y3(j),y6(j)];
line(x12, y12,'linewidth',4,'color','k')  
line(x23, y23,'linewidth',4,'color','k')
line(x34, y34,'linewidth',4,'color','k')
line(x41, y41,'linewidth',4,'color','k')

line(x15,y15,'linewidth',4,'color','b') line(x36,y36,‘linewidth’,4,‘color’,‘b’)
axis([-20 20 -20 20]);
title(‘Simulation’);
grid off;
hold on;
xlabel(‘mm’)
ylabel(‘mm’)
plot(x1,y1,‘o’,‘linewidth’,5);
plot(x2(j),y2(j),‘o’,‘linewidth’,5);
plot(x3(j),y3(j),‘o’,‘linewidth’,5);
plot(x4,y4,‘o’,‘linewidth’,5);
plot(P(1),P(2),‘o’,‘linewidth’,5), hold on
plot(PP(1,:),PP(2,:),’–’,‘linewidth’,2’,‘color’,‘r’), hold on
text(x3(j),y3(j),[' (',num2str(x3(j),3),',',num2str(y3(j),3),')']) text(x2(j),y2(j),[’ (’,num2str(x2(j),3),’,’,num2str(y2(j),3),’)’])
j=j+1;
pause(0.001)
clf;

subplot(2,3,2);
plot(t_vect,psi.*180/pi,'linewidth',2,'color','r'), hold on % plot theta 1 VS theta        plot(t_vect,th.*180/pi,'linewidth',2,'color','g'), hold on
title('$$ \theta $')
xlabel('time')
ylabel('$$\theta$$')

axis([0 400 0 200]) grid on;
subplot(2,3,3);
plot(t_vect,vx,‘linewidth’,2,‘color’,‘r’), hold on
plot(t_vect,vy,‘linewidth’,2,‘color’,‘g’), hold on
plot(t_vect,vz,‘linewidth’,2,‘color’,‘b’), hold on
hold on;
title(’$$\textbf{v}$$’)
xlabel(‘time’,‘linewidth’,3)
ylabel(‘Linear velocity’)
axis([ 0 1 0 200]); grid on;
subplot(2,3,4);
plot(t_vect,wx,‘linewidth’,2,‘color’,‘r’), hold on
plot(t_vect,wy,‘linewidth’,2,‘color’,‘g’), hold on
plot(t_vect,wz,‘linewidth’,2,‘color’,‘b’), hold on
hLeg=legend({’$$ \omega_x$$’,’$$ \omega_y $$’,’$$\omega_z $$’},‘FontSize’,12);
set(hLeg,‘Interpreter’,‘latex’);
title(’$$\omega$$’)
xlabel(‘time’)
ylabel(’$$\omega$$’)
axis([0 1 -1 1])
grid on;

subplot(2,3,5);
plot(t_vect,PP(1,:),'linewidth',2,'color','r'), hold on
plot(t_vect,PP(2,:),'linewidth',2,'color','g'), hold on 
plot(t_vect,PP(3,:),'linewidth',2,'color','b'), hold on 
hLeg=legend({'$$ p_x$$','$$ p_y $$','$$ p_z $$'},'FontSize',12);
set(hLeg,'Interpreter','latex');
title('Position')
xlabel('time')
ylabel('Position')

subplot(2,3,6);
plot(t_vect,Orient_angle,'linewidth',2,'color','r'), hold on
hLeg=legend({'$$ \phi $$'},'FontSize',12);
set(hLeg,'Interpreter','latex');
title('Coupler orientaiton')
xlabel('time')
ylabel('$$\phi$')  

end
movie(m) movie2avi(m,‘fourbar.avi’);

Sorry I was vague before. I meant what DART API function calls are you using to calculate the positions and velocities?

Maybe the data channel you’re pulling from DART is a generalized joint velocity, and not an absolute velocity relative to the world origin?

That’s highly possible