# Discontinuity in mechanism simulation: is the mechanism jammed or is my analysis wrong?

I'm designing a compact mechanism for the deployment of a mast. The idea is that the linear actuator for the deployment is on the other side of the pivot, and a slider increases the lever arm to enable the actuator to deploy the mast.

I ran through the maths (shown in details below), and wrote the code for the simulation. I want to know how the actuator force and the lever length relate, and how the force varies with the angle. However, when I run the code I get huge spikes in the force (see below, I capped the force to 10^6 to better see the pattern), but for example I don't see why the mechanism would jam between 40 and 80°. For some reason the cross product of HP with OP (what I call the signed lever arm of F) goes through zero but I see no reason why it would given the current dimensions and angle range set. How can I fix it?

Original: With the force capped at 200N: And the denominator of F: ## Annex

Code:

close all
clear all

%See diagram for description of variables, units are metres
a = (2+10)*10^-3;
b = a;
c = 165*10^-3;
d = 70*10^-3;
h = 180*10^-3;

m = 8; %Mass of the mast in kg
g = 9.81; %Acceleration of gravity in m/s²

%Range of the input variables
thetaMin = 0*pi/180;
thetaMax = 100*pi/180;
tMin = 10*10^-3;
tMax = 100*10^-3;

%Vectors
theta = thetaMin:(thetaMax-thetaMin)/100:thetaMax;
t = tMin:(tMax-tMin)/100:tMax;

%Solve for F
F = zeros(length(t), length(theta)); %Actuator force
L = F; %Length of linear actuator
denominator = F; %Denominator of F, or "signed lever arm"
for i = 1:length(t)
for j = 1:length(theta)
M = [cos(theta(j)) sin(theta(j)) 0;
-sin(theta(j)) cos(theta(j)) 0;
0 0 1];

HP = M*[-t(i);
a;
0];

OP = [-b;
h;
0]+HP;

L(j,i) = norm(OP);

HG = M*[c;
-d;
0];

W = [0;
-m*g;
0];

weightMoment = HG(1)*W(2)-HG(2)*W(1); %cross(HG,W)
forceLever = 1/norm(OP)*(HP(1)*OP(2)-HP(2)*OP(1)); %1/norm(OP)*cross(HP,OP)

denominator(j,i) = forceLever;

F(j,i) = -weightMoment/forceLever;
end
end

%Plot results
[T,THETA] = meshgrid(t,theta);

figure(1)
surface(T*1000,THETA*180/pi,F)
ylabel('Angle (deg)')
xlabel('Slide length (mm)')
zlabel('Force (N)')
title('Actuator force')

figure(2)
surface(T*1000,THETA*180/pi,L*1000)
ylabel('Angle (deg)')
xlabel('Slide length (mm)')
zlabel('Actuator length (mm)')

figure(3)
surface(T*1000,THETA*180/pi,denominator*1000)
ylabel('Angle (deg)')
xlabel('Slide length (mm)')
zlabel('Signed lever arm')


Maths: solve $$\vec{moment}(H)=\vec{HP}\times \vec{F}+\vec{HG} \times \vec {W}=\vec{0}$$ With $$\vec{F}=\frac{\vec{OP}}{OP}F$$ $$\vec{HP}= \left[ {\begin{array}{cc} cos(\theta) & sin(\theta) \\ -sin(\theta) & cos(\theta) \end{array} } \right] \left( {\begin{array}{cc} -t \\ a \end{array} } \right)$$ $$\vec{HG}= \left[ {\begin{array}{cc} cos(\theta) & sin(\theta) \\ -sin(\theta) & cos(\theta) \end{array} } \right] \left( {\begin{array}{cc} c \\ -d \end{array} } \right)$$ $$\vec{OP}=\vec{OH}+\vec{HP}$$ $$\vec{W}=\left( {\begin{array}{cc} 0 \\ -mg \end{array} } \right)$$ $$\vec{OH}=\left( {\begin{array}{cc} -b \\ h \end{array} } \right)$$

• How should the mast be positioned with respect to the chassis when fully deployed? I.e., are they collinear, is the mast inserted into the chassis, does it rest on the chassis, will it connect to any surface not pictured here? – Air Jul 29 '15 at 16:00
• Thanks - sorry I forgot to specify the ranges. Theta should go from 0 to just before whichever value makes the linear actuator aligned with the pivot - that's the limit of stability. Say, 100°. The slider length from say 10mm to 100mm. Oh, actually, it can be seen on the plot I've posted. – Mister Mystère Jul 29 '15 at 16:03
• I haven't looked too closely but I would guess this is the point where in the line where you calculate F you divide by zero. At least I can't see any other way you could easily get an infinity in your code. – nivag Jul 29 '15 at 16:25
• I saw it too, but the denominator should never be zero at these locations... – Mister Mystère Jul 29 '15 at 16:35
• Well, it looks like you've certainly got some numeric weirdness. Have you isolated some test data points where you get huge spikes, and single stepped through the code there to see if you're getting variable values that are appropriate? – rfdave Jul 30 '15 at 2:36

## 1 Answer

If you plot the x values of OP and HP, they cross zero, which seems unphysical.

Looking more closely, you are doing your rotations backwards, i.e. you are doing our rotations in +theta whereas you want to go in -theta.

This is something I often do too. To fix, just replace theta with -theta in M.

Here's a figure of F when you do this which looks much more reasonable. • Thanks a lot, I finally have sensible F plots! I had carefully used -theta in my rotation matrix because the rotation matrix is given from the reference frame 1 to the reference frame 2 when rotating from 1 to 2... This is very strange, but the results speak for themselves; I'll look into this later. – Mister Mystère Jul 30 '15 at 14:12