In order to determine the final path, MATLAB was used to solve for the motion of both the current and the new mechanisms. For the slider crank mechanism the angle calculation formulas are:
psi = acos((e^2 + f^2 - g^2)/(2*e*f))
phi = acos((g^2 + f^2 - e^2)/(2*g*f))
chi = acos((e^2 + g^2 - f^2)/(2*e*g))
With these angles the positions of point O2 and point O4 can be calculated, which correspond to link d. The calculation of the input angle θ2 and the local to global transformation angle can also be done. Then the angles of the four bar mechanism are calculated by:
k1=d/a
k2=d/c
k3=(a^2-b^2+c^2+d^2)/(2*a*c)
k4= d/b
k5 = (c^2-d^2-a^2-b^2)/(2*a*b)
A=cos(theta2)-k1-k2*cos(theta2)+k3
B=-2*sin(theta2)
C=k1-(k2+1)*cos(theta2)+k3
D=cos(theta2)-k1+k4*cos(theta2)+k5
E=-2*sin(theta2)
F=k1+(k4-1)*cos(theta2)+k5
theta4 = 2*atan(( -B + sqrt(B.^2-4*A.*C))./(2*A))
theta3 = 2*atan(( -E + sqrt(E.^2-4*D.*F))./(2*D))
With these angles the position of all links are known. Based on the geometry of the mechanism, the vector AP and the angle δ are:
AP= sqrt(PB_y^2+(b+PB_x^2))
δ=atan(PB_y/(b+PB_x))
where PB_x is the parallel distance from point B and PB_y the perpendicular distance from B.
So the position of the sensor is calculated by adding the input vector O2A from link a and vector AP.
px=a*cos(theta2)+AP*cos(theta3+(δ))
py=a*sin(theta2)+AP*sin(theta3+(δ))
Lastly all of the link points and the point of interest P need to be transform from local position to global position with the transformation angle:
pGX=px*cos(α)-py*sin(α)
pGY=px*sin(α)+py*cos(α)