MATLAB: Keeping the distance between objects

circlesdifferential equationsfree particleintersectiontrajectory

Hello world,
Think of two linear trajectories. Hooks will be moving along those trajectories with "rope" tied between them – hook1 from traj1 with hook1 from traj2 with hook2 from traj1 with hook2 from traj2 and so forth. The two trajectories are in one plane with the center line, symmetrically at an angle around the center line and the hooks need to decelerate to 0 along the trajectory. To simplify, there'll be no queue forming at one end.
I know the timing of hooks because I know the speed of new rope coming in and the length of the rope between hooks. I have found equations for the trajectories, created 1x* matrizes for time and position according to the resolution I will be able to control the hooks at and decided the deceleration along the centerline should be linear for simplicity. What I'm now trying to do is output a lookup table of position (and speed) along either trajectory and the time for that position. As there's nothing dynamic this table will be looped through for each new hook.
I have thought of few ways to go about this, each looks equally beyond my ability right now so I'm hoping for your support.
1. Try to program "free particles" that will be bound by the boundary conditions a) the trajectory b) the distance to the one coming after. It seems to me this would incur great performance tribute.
2. Try to program a circle with the diameter of the distance between two hooks and let that decelerate linearly along the centerline. I don't know how to check the intersections with the trajectories and how to properly adapt the speed of either of the hooks along their trajectories.
3. Perhaps someone could do this with higher-than-I-could-come-up-with differential maths?
4. Perhaps I'm not seeing some easy relationship between the centerline and trajectoral deceleration that would save me all of the above work?
I do hope somebody can give me very easy to understand advice / instructions on which idea would be best and how to actually do it.
Thank you very much! Philipp

Best Answer

I assume:
1. The rope is fixed at Gx3 but free to move through all the other hooks.
2. Also you know the distance of each hook from the point A.
Since alpha and d(alpha)/dt determine the location and speed of all hooks, all you need is to compute d(alpha)/dt given vf - no?
So say (writing in "code" mode for clarity - not actually code):
dist(Gy1, A) = hy1
dist(Gy2, A) = hy2
dist(Gx2, A) = hx2
dist(Gx3, A) = hx3
The above are all known and constant.
Also say:
dist(Gy1, Gx1) = s11
dist(Gy1, Gx2) = s12
dist(Gx2, Gy2) = s22
dist(Gy2, Gx3) = s23
Then
d(s11)/dt + d(s12)/dt + d(s22)/dt + d(s23)/dt = vf % eq (1)
but:
s11 = hy1 = constant
s23 = hx3^2 + hy2^2 - 2*hx3*hy2*cos(2*alpha) % using cosine rule


s22 = hy2^2 + hx2^2 - 2*hy2*hx2*cos(2*aplha) % using cosine rule
s12 = hx2^2 + hy1^2 - 2*hx2*hy1*cos(2*alpha) % using cosine rule
Plug these into eq (1) and perform the differentiation. You get vf in terms of alpha and d(alpha)/dt. It is a first order differential equation:
4*C*sin(2*alpha)*d(alpha)/dt = vf
where:
C = (hx3*hy2 + hy2*hx2 + hx2*hy1).
You could use an ode solver to find the solution starting from some initial alpha0 and vf0 for time {0, h, 2h, 3h, .....}. Once you get the set of alpha angles, the locations of the hooks follow.
[Edited to make corrections]