Hi Hakan,
The specific helper is derived from the following diagram, which presents the form of an N-body truck-trailer system locked into a steady-state configuration. To maintain the angles between each pair of bodies as a velocity is applied along the longitudinal axis of a body, the perpendicular line extending from each axle needs to intersect at a single point. For a 3-body system, you end up with the following figure:
To simplify the diagram above, we'll ignore the last body and use the following simplified notations:
- alpha,e -> A
- beta2,e -> B
- M1 -> M
- L1 -> L1
- L2 -> L2
You ultimately want to solve for A, which means working backwards through your knowns:
(1) A = atan(L1 / R1)
(2) let R1' = R1 + (M/cos(B))*sin(B) = R1 + M*tan(B)
(3) also, R1' = R2/cos(B)
Set (2)/(3) equal and solve for R1:
(4) R1 = R2/cos(B) - M*tan(B)
(5) R2 = (L2 + M/cos(B)) / sin(B) * cos(B) = (L2*cos(B) + M)/sin(B)
Sub (5) into (4), and the result into (1):
R1 = (L2*cos(B) + M) / sin(B) / cos(B) - M*tan(B) = L2/sin(B) + M/(sin(B)*cos(B)) - M*tan(B)
(6) A = atan(L1 / (L2/sin(B) + M/(sin(B)*cos(B)) - M*tan(B)))
This can also be done using the pythagorean theorem rather than trig-math, which the Symbolic Toolbox may have opted to use for efficiency (hard to say), but hopefully this provides some intuition into the geometric relationship. Just for good measure we can validate our trig-derived version against the example helper:
Note that this function only serves to derive the steering angle (A) needed to keep a constant interior angle (B) that has been given to it. You can envision this as each axle continuing to point towards O as the rear axle of each body moves along the concentric circles defined by R1, R2, R3, etc...
This helper does not account for transient dynamics, drift, boundary constraints, etc - it serves only as a way to convert the desired interior angle (obtained via a pure-pursuit scheme which aims to guide the rear-axle of the second body along a reference-path) to the steering angle capable of maintaining a steady-state motion (i.e. moving each axle along those concentric circles).
I believe the reference paper might offer additional details related to the proof/requirements of steady-state motion for these kind of systems, but hopefully the above is sufficient.
Hope this helps,
Cameron