Efficient_Optimization-Based_Trajectory_Planning_f
Efficient_Optimization-Based_Trajectory_Planning_f
sciences
Article
Efficient Optimization-Based Trajectory Planning for
Truck–Trailer Systems
Stepan Ozana , Filip Krupa and Zdenek Slanina *
Abstract: This paper tackles the complex problem of trajectory planning for trucks with multiple
trailers, with a specific focus on autonomous parking assistance applications. These systems aim
to autonomously guide vehicles from a starting position to a target location while effectively navi-
gating real-world obstacles. We propose a novel six-phase approach that combines global and local
optimization techniques, enabling the efficient and accurate generation of reference trajectories. Our
method is validated in a case study involving a truck with two trailers, illustrating its capability to
handle intricate parking scenarios requiring precise obstacle avoidance and high maneuverability.
Results demonstrate that the proposed strategy significantly improves trajectory planning efficiency
and robustness in challenging environments.
Keywords: assisted parking; autonomous vehicles; trajectory planning; path planning; truck-trailer
systems; articulated vehicles
1. Introduction
Nowadays, we have been experiencing significant development in the field of au-
tonomous driving. From the point of view of the general public, this is a hot topic that has
only started to come to the forefront of the automotive industry.
From the point of view of the scientific community, however, it is a well-established
Citation: Ozana, S.; Krupa, F.; issue that has been addressed by scientific teams around the world for more than a decade.
Slanina, Z. Efficient Optimization-
This article focuses on assisted parking for a system consisting of a main vehicle (truck)
Based Trajectory Planning for
and articulated links (trailers).
Truck–Trailer Systems. Appl. Sci. 2024,
In particular, finding collision-free trajectories is a key element for such types of
14, 11675. https://doi.org/10.3390/
problems. The most commonly used methods and procedures for setting up the problem
app142411675
of path planning and trajectory planning are briefly summarized.
Academic Editor: Suchao Xie The model of the system plays a crucial role here, which is referred to as model-
based design. In case of truck–trailer modeling, models can be divided into kinematic
Received: 14 November 2024
Revised: 10 December 2024
and dynamic models. Kinematic models are especially useful for slow movements where
Accepted: 11 December 2024
the dynamic forces can be neglected. Such models are suitable for maneuvering between
Published: 13 December 2024 obstacles at low speeds.
Dynamic force-based models are only applicable when it is necessary to model a
fast-moving car, where movement outside the direction of rotation of the wheels may
occur, especially when taking curves. The higher complexity of these models is their
Copyright: © 2024 by the authors. main disadvantage, leading kinematic models to be preferred in most cases, including in
Licensee MDPI, Basel, Switzerland. this paper.
This article is an open access article
distributed under the terms and 1.1. Problem of Path Planning
conditions of the Creative Commons
Path planning is the process of finding a sequence of points between a start and
Attribution (CC BY) license (https://
a destination in a coordinate system. These points then represent the path the vehicle
creativecommons.org/licenses/by/
4.0/).
must follow. Finding such a path usually falls into the problem of finding a global min-
imum. The usual requirement for the found path is its minimum length, but this can be
customized accordingly.
The first possible approach to path planning is to search for the shortest path in the
graph. This approach is often used when the user requires fast path planning and is trying
to ensure that the resulting vehicle control can be implemented in real time. The most
commonly used algorithm is A∗ , along with its modified variants such as [1] which focus on
improving smoothness and shortening the found path; for examples of this algorithm’s use,
see [2–4]. A very similar principle has been used by some authors for their own specialized
path-finding algorithms; for example, in [5] the authors split the path planning for the
vehicle exiting the parking space into four parts.
The other option for path planning is to use the Rapidly-Exploring Random Trees (RRT)
algorithm. This algorithm uses a random tree to explore an unknown environment and find
a path from a starting point to an ending point. The disadvantage of this algorithm, among
other things, is that the resulting path may not be optimal. In the case of path planning
for vehicles, authors have often resorted to various modifications of this algorithm, for
example [6]. Perhaps the most well-known modification of the RRT is the variant called
Closed-Loop RRT. This algorithm was developed as part of the DARPA Urban Challenge;
its main contribution is its use of an internal stabilizing controller. In this approach, the
RRT algorithm looks for a path that produces a stable system, even though the vehicle
system itself is often unstable. This makes it possible to reduce the number of states of the
whole system and extend the distances between each point of the tree, allowing the whole
computation to be accelerated [7].
Another possibility is to make the path planning problem into an NLP (nonlinear
programming) problem. By finding the minimum of a suitably specified problem, a path
between two points can be found [8]. The disadvantage of this approach is the need to use
a global solver for the optimization problem; otherwise, it is very likely to find only a local
minimum. Thus, in the case of path planning, we may find a link between two points, but
not necessarily the shortest one. Another problem is the time-consuming nature of such
procedures, which is why this approach has not been used recently.
A very common way to find a path is to use a ready-made software package that
contains one or a combination of the above-described procedures. This approach has the
advantage of allowing the author to concentrate on other aspects of vehicle control. The
most widely used such software appears to be the Robot Operating System (ROS). This
operating system includes a global path-finding package, which primarily uses the A∗
algorithm to find the path, but also relies on others. This approach was used in [9–11].
solver. Using a local solver provides faster solution-finding than a global solver. In the
case of trajectories, additional requirements arise: the usual goal of moving a vehicle from
location A to location B is complemented by the requirement of admissible trajectories
for the system; furthermore, the vehicle following the found trajectories must avoid all
obstacles. In the case of a truck with trailers, it is necessary to avoid the problem of the
vehicle hitting its own trailer (jackknife effect).
Existing papers have presented a large variety of solutions, with each team of authors
approaching the problem individually; thus, it is not possible to clearly identify any one
solution as the best. For example, in [2,3] the authors decided to split the solution into
several smaller optimization problems and link them together such that the trajectories
found in the previous problem could be used as the initial estimate of the next problem.
This approach allows for finding initial trajectories that do not respect collisions with
obstacles, which can then be recomputed in the next optimization problem, which takes
collisions with obstacles into account. If optimal trajectories still cannot be found, the next
step is to change the size of the obstacles and run the optimization problem in a cycle until
the desired collision-free trajectories are found.
In our proposed approach, we select the f mincon solver due to its efficiency and
robust performance. Additionally, we tested the SOLNP solver [25], which is gradient-free
and supports multiple interfaces, including MATLAB, Python, and C++. The SOLNP
solver demonstrated excellent performance and robustness on our benchmarks, which
included nonlinear optimization tasks such as trajectory planning. Real-time operation
was successfully tested on a Raspberry Pi 4. However, all tests of the SOLNP solver were
conducted as part of preparations for future work, and are beyond the scope of this paper.
2. Methods
2.1. Problem Formulation
The problem involved in this paper is considered and demonstrated as a case study
focused on trajectory planning for a system of a truck and two trailers that moves forward
between a given initial position of the system and given target rectangular area while
respecting additional constraints. Such a problem can be referred to as an assisted parking
problem, as the movement starts and ends with zero velocity.
There are ten static obstacles within the area where the system is supposed to move.
The situation is depicted in Figure 1, showing the given 2D region, where the black cross
on the left determines the given initial position of the system (represented by reference
point R0 of the truck) and the red rectangle determines the target area to fit the truck-trailer
system at the end of the parking process.
In addition to presenting our solution to this problem, we also compare our solution
to the case study presented in [20], where the authors made use of a global stochastic
optimizer (SFS, Stochastic Fractal Search) to find optimal trajectories. Comparison with this
previous work is possible thanks to the fact that the authors provided their source code,
including comments and a detailed description of the functionality of their entire solution.
x1 X0
x2 Y0
x3 ϕ0
x4 ≡ θ0
⃗x = (1)
x5 ϕ1
x6 ϕ2
where:
• X0 , Y0 refer to the x- and y-coordinates of the truck’s reference point R0 [m].
Appl. Sci. 2024, 14, 11675 5 of 23
• ϕ0 . . . is the angle of rotation of the wheels relative to the axis of the truck [rad].
• ϕ1 . . . is the angle between the axis of the truck and the axis of the first trailer [rad].
• ϕ2 . . . is the angle between the axis of the first trailer and the axis of the second
trailer [rad].
• θ0 . . . is the angle of rotation of the truck relative to the x-axis [rad].
Then, the mathematical model of such a system can be represented by a nonlinear
state model according to the set of differential equations provided below in Equation (2):
ẋ1 = u1 · cos( x4 )
ẋ2 = u1 · sin( x4 )
1 1
ẋ3 = − · x3 + · u2
τ τ
u
ẋ4 = 1 · tan( x3 )
d
0 (2)
u u a
ẋ5 = 1 · tan( x3 ) − 1 · sin( x5 ) − · cos( x5 ) · tan( x3 )
d0 d1 d0
u1 a
ẋ6 = · sin( x5 ) − · cos( x5 ) · tan( x3 )
d1 d0
u1 a
− · sin( x6 ) · cos( x5 ) + · sin( x5 ) · tan( x3 )
d2 d0
where:
• u1 is the first system’s input, i.e., the velocity of the truck v0 [m · s−1 ].
• u2 is the second system’s input, i.e., the setpoint for the front wheel steering angle
ϕ0 [rad].
• d0 determines the distance of points | R0 S|, representing the distance between the axles
of the truck [m].
• a determines the distance between the points | R0 Q| of the rotary joint Q and the
reference point of the truck R0 [m].
• d1 determines the distance of the points | QR1 | representing the first trailer’s reference
point R1 and the rotary joint of the truck Q [m].
• d2 determines the distance of points | R1 R2 | representing the distance of reference
points of two consecutive trailers [m].
• τ is the front wheel steering servo time constant, which approximates the dynamics of
a first-order system between the steering setpoint and the actual steering [s].
Z tF
J = Φ[t0 , t F , x(t0 ), x(t F )] + L[ x(t), u(t), t]dt. (3)
t0
The optimization task includes the nonlinear equality constraints in Equation (5), the
nonlinear inequality constraints in Equation (6), and the simple lower and upper bounds in
Equation (7):
ceq (z) = 0 (5)
c(z) ≤ 0 (6)
zl ≤ z ≤ zu . (7)
The set of equality constraints ceq corresponding to Equation (5) is composed of
equality boundary constraints ψ and equality differential defect constraints ξ, as follows:
ψ
ceq = . (8)
ξ
Converting the OCP into an NLP is achieved through a direct transcription discretiza-
tion scheme using the fourth-order Runge–Kutta numerical method (RK4) in the form
of Equation (9). To remain consistent with notation in Equations (5) and (8), we express
Equation (9) as the set of differential defect constraints provided in Equation (10), where
k ∈ [0, N − 2] ∈ N0 stands for the current step of the computation, N is the number of nodes,
k1 , k2 , k3 , and k4 are determined by Equation (11), and h represents the sampling period.
1
x k +1 = x k + · h ( k1 + 2 · k2 + 2 · k3 + k4 ) (9)
6
1
ξ k = x k +1 − x k − · h · ( k1 + 2 · k2 + 2 · k3 + k4 ) (10)
6
k1 = f ( x k , u k )
h u + uk
k2 = f ( x k + · k 1 , k +1 )
2 2 (11)
h u + uk
k 3 = f ( x k + · k 2 , k +1 )
2 2
k 4 = f ( x k + h · k 3 , u k +1 )
Altogether, the solution of both path planning and trajectory planning that we propose
in this paper consists of the six phases introduced in Table 1, which are each described in
detail in separate subsections.
total time needed to realize the desired trajectory. We first select an appropriate constant
velocity profile u1 for use in Phase 2. This selection adheres to widely accepted kinematic
assumptions. Linear velocities below 1–2 m/s (approximately 3.6–7.2 km/h) are generally
considered suitable for ensuring minimal dynamic forces such as centripetal acceleration.
For urban-like scenarios or controlled environments (e.g., robotics or autonomous systems),
a maximum linear velocity of 0.5–1.5 m/s is often applied. In tighter spaces such as parking
or obstacle avoidance, the lower end of this range (0.5–1 m/s) is preferred. Based on these
considerations, we set u1 = 1. The total time x T is determined through an optimization
process representing the time required to travel from the initial to the target position. The
total travel distance depends on the path determined in Phase 1 while respecting the
vehicle’s dynamics. Using the constant velocity profile, the travel distance can be expressed
as u1 · x T .
The total time x T is subsequently utilized in Phase 3, where the velocity profile is
refined under the constraints of zero initial and target velocities.
To find the total time x T , the simulation step size h corresponding to the sampling
period Ts is supposed to be unitary and to be scaled by the state x T , which is part of
decision vector of variables in this phase. The resulting dynamics equations are written in
Equation (12).
ẋ1 = x T · u1 · cos( x4 )
ẋ2 = x T · u1 · sin( x4 )
1 1
ẋ3 = x T · (− · x3 + · u2 ) (12)
τ τ
u1
ẋ4 = x T · · tan( x3 )
d0
ẋ T = 0
Fulfillment of the initial state can be ensured by a simple equality boundary condition,
where the corresponding elements of the decision vector ar be equal to the given initial
state −
→
x0 .
x 11 x 01
x2 x0
x3 − x0
ψ= 1 2 (13)
1 3
x 41 x 04
Satisfying the desired final state can also be ensured by similar equality constraints;
however, much less restrictive inequality constraints are used here due to the need to fit the
system into a predefined target area. This allows for a certain level of relaxation, and signif-
icantly increases the chance of finding an admissible solution to the optimization problem.
The target area has a rectangular shape containing the truck’s target reference point
R0 , with dimensions denoted by xtgt and ytgt . These dimensions are appropriately chosen
such that the entire system can be placed inside without colliding with obstacles. Therefore,
this approach leads to the introduction of the two inequality conditions expressed by
Equation (14). These constraints represent the positional limitation of the truck’s reference
point in the last time step of the searched trajectories with respect to the desired outcome.
Here, the vector − x→
t f is a vector of state variables indicating the desired value at the end of
the procedure.
xtgt xtgt
xt f 1 − ≤z3N ≤ xt f 1 +
2 2 (14)
ytgt ytgt
xt f 2 − ≤z4N ≤ xt f 2 +
2 2
The cost function used here is defined by Equation (15). This function penalizes the
distance between truck’s reference point R0 and the corresponding path point, and also
minimizes the total time. Numerical time integration is computed using the trapezoidal
Appl. Sci. 2024, 14, 11675 9 of 23
−
→
method. The variables Cxn and Cyn correspond to the coordinates of the found path Cx and
−
→
Cy , respectively, as described in Section 2.3.1.
!
N q N −1
1 1 2 1 2
J = 50 · ∑ ( x1n − Cxn ) + x2n − Cyn +
2 T1 n∑
2 2 2
· x + x Tn + x TN (15)
n =1
N =2 2
−3 ≤ u1 ≤ 3
π π
− ≤ u2 ≤
3 3
−1 ≤ x1 ≡ X0 ≤ 50
−1 ≤ x2 ≡ Y0 ≤ 40
π π
− ≤ x3 ≡ ϕ0 ≤ (17)
3 3
−2π ≤ x4 ≡ θ0 ≤ 2π
20 ≤ x T ≤ 60
π π
− ≤ x5 ≡ ϕ1 ≤
3 3
π π
− ≤ x6 ≡ ϕ2 ≤
3 3
ẋ1 = u1 · cos( x4 )
ẋ2 = u1 · sin( x4 )
1 1 (18)
ẋ3 = − · x3 + · u2
τ τ
u
ẋ4 = 1 · tan( x3 )
d0
The differential defect constraints corresponding to Equation (10) are now related to
the dynamics in Equation (18).
The equality boundary constraints needed for this phase can be formed fro those from
Phase 2 according to Equation (13) and extended by constraints related to zero initial and
zero final velocity according to Equation (19).
u11 0
= (19)
u1 N 0
Therefore, the overall equality boundary constraints for Phase 3 are provided by Equation (20).
x 11 x 01
x 21 x 02
x3 x0
ψ=
1 − 3 (20)
x 41 x 04
u1 0
1
u1 N 0
The inequality constraints stay unchanged compared to Phase 2, and are provided by
Equation (14).
The cost function must now also consider the input u1 , which represents the truck’s
velocity. The cost function mainly aims to minimize the rate of control inputs in time for
both control inputs. It also penalizes the distance between the truck and the corresponding
path point, leading to the cost function provided by Equation (21).
!
N −2
1 1 1
J =100 · · ( u − u 12 ) 2 + ∑ ( u 1 n − u 1 n + 1 ) 2 + ( u 1 N − 1 − u 1 N ) 2 +
N 2 11 n =2
2
!
N −2
1 1 1
+10 · · ( u 21 − u 22 ) + ∑ ( u 2 n − u 2 n + 1 ) + ( u 2 N − 1 − u 2 N ) +
2 2 2 (21)
N 2 n =2
2
N q
+ ∑ ( x1n − Cxn )2 + x2n − Cyn
2
n =1
vehicles are frequently rectangular. Integrating potential collisions into the cost function is
a very important part of the solution, and represents one of the main benefits of this paper.
The procedure for detecting the collision of two quadrilaterals described by Equation (22)
and Algorithms 1 and 2 is taken from [20]. The remaining parts of the collision detection
(Algorithms 3 and 4) are our own contribution.
Two quadrilaterals collide only if one or more vertices of one of the quadrilaterals
is inside the other quadrilateral. We can reduce the collision problem to the question of
whether the point K representing any vertex of one of the quadrilaterals is inside the other
quadrilateral. If a collision occurs, Equation (22) must apply. We repeat this procedure for
all four points of the quadrilateral.
−→ −→ −→ −→ −→ −→ −→ −→
0 < AK · AB < AB · AB ∩ 0 < AK · AD < AD · AD (22)
Multiple tests showed that detecting two quadrilaterals may be insufficient in terms of
convergence; thus, we added assessment of the proximity between two quadrilaterals. This
uses a logarithmic barrier function that penalizes situations when any part of the system
Appl. Sci. 2024, 14, 11675 12 of 23
is approaching obstacles. This procedure uses similar input information as the previous
collision detection, and is captured in Algorithm 3.
Here, the parameter qin f represents either an infinitely large value, the maximum
value feasible within a given software environment, or a user-defined value. Regarding
parameters W1 and W2 , we chose W1 = 0.001 and W2 = 10. These values represent
weighting factors used for scaling the optimization task. Real-world optimization problems
often comprise parameters of vastly different orders of magnitudes. In many applications,
parameters with very large start values will vary over a wide range, and a change in that
parameter will only lead to a relatively small change in the criterion function. If this is the
case, the scaling of the optimization problem can be improved by some measures, usually
based on heuristics. There are several approaches, such as simply dividing all parameter
vectors by the start parameters or re-mapping all parameters such that the bounds are
[0, 1] for all parameters. For the case study presented here, we used expert choice of these
values. Additional tuning or applying a more sophisticated mechanism to determine these
parameters might be needed in future modifications of the presented case study.
The system model and constraints stay the same as in Phase 3. Because the truck is
no longer treated as a point in this phase, but rather as a quadrilateral in space, it makes
sense to penalize the vehicle’s initial and target angular positions. Furthermore, the target
Appl. Sci. 2024, 14, 11675 13 of 23
position of the truck’s reference point is no longer penalized; instead, all truck vertices are
required to match within the target area.
The rotation angle at the initial point is an extension of the equality constraints for the
initial state provided by Equation (23). Adding them allows us to find feasible trajectories
even if the truck is not aligned precisely with the x-axis at the beginning of movement.
This assumption, which was used in the previous phases, is replaced here by specifying the
desired initial rotation of the truck with respect to the x-axis.
x 11 x 01
x2 x0
1 2
x 31 − x 03
ψ= (23)
x4 x0
1 4
x 51 x 05
The final rotation and position of the truck is written in the form of an inequality
constraint, which is less strict, introduces some relaxation for the optimization task, and im-
proves the existence and convergence likelihood of the solution. The inequality constraints
defined in Equation (24) represent a 2D region in which X ∈ [−6; 6] and Y ∈ [−1.5; 1.5] [m].
In the first eight constraints, all vertices of the truck (modeled as a rectangle with vertices
K, L, M, N) need to be located within the desired target region. The last constraint concerns
the angle of rotation of the truck. Because the endpoints of the truck are not included in
the vector of state variables of the dynamics, we need to compute their coordinates at the
final time point (Kxt f , Kyt f , L xt f , Lyt f , Mxt f , Myt f , Nxt f , Nyt f ) in the same way as in the case
of collision detection with obstacles. Compared to the previous phase, the target area is
slightly enlarged, meaning that its dimensions are larger than the dimensions of the system.
xt f 1 − 6 ≤ K xt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ L xt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ Mxt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ Nxt f ≤ xt f 1 + 6
xt f 2 − 1.5 ≤Kyt f ≤ xt f 2 + 1.5 (24)
xt f 2 − 1.5 ≤ Lyt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ Myt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ Nyt f ≤ xt f 2 + 1.5
pi pi
xt f 4 − ≤ x4 N ≤ x t f 4 +
2 2
The cost function can already fulfill the original requirement expressed by Equation (25) of
minimizing the distance traveled and energy spent on the control action; furthermore, we
retain the variable q, ensuring that collision between the truck–trailer system and obstacles
are penalized.
!
N −2
1 1 1
J =10 · · ( u − u 12 ) + ∑ ( u 1 n − u 1 n + 1 ) + ( u 1 N − 1 − u 1 N ) +
2 2 2
N 2 11 n =2
2
!
N −2
1 1 1
+10 · · (u21 − u22 ) + ∑ (u2n − u2n+1 ) + (u2N −1 − u2N ) +
2 2 2 (25)
N 2 n =2
2
N −1 q
+ ∑
2 2
x 1n − x 1n +1 + x 2n − x 2n +1 + q
n =1
Appl. Sci. 2024, 14, 11675 14 of 23
xt f 1 − 6 ≤ K xt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ L xt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ Mxt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ Nxt f ≤ xt f 1 + 6
(28)
xt f 2 − 1.5 ≤Kyt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ Lyt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ Myt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ Nyt f ≤ xt f 2 + 1.5
The endpoints are referred to as K1, L1, M1, N1 for the first trailer and K2, L2, M2, N2
for the second trailer. Due to the mutual connection of all the vehicles in the truck–trailer
system, it is possible to omit the constraints on the endpoints of the first trailer. This reduces
the number of constraints and speeds up the computation.
xt f 1 − 6 ≤K2xt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ L2xt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ M2xt f ≤ xt f 1 + 6
xt f 1 − 6 ≤ N2xt f ≤ xt f 1 + 6
(29)
xt f 2 − 1.5 ≤K2yt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ L2yt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ M2yt f ≤ xt f 2 + 1.5
xt f 2 − 1.5 ≤ N2yt f ≤ xt f 2 + 1.5
Appl. Sci. 2024, 14, 11675 15 of 23
The cost function used in this phase does not change in this regards, and stays as
described in Equation (25). However, a fundamental change is applied in the case of
collision detection, which is now extended to detect both collisions between obstacles with
the truck and collisions between obstacles and individual trailers.
The system’s model remains the same as in the previous phase, and is again described
by Equation (2). The constraints on the initial state provided by Equation (26) and the
differential defect constraints for fulfilling the dynamics according to Equation (10) also
remain unchanged.
The form of the cost function is based on the previous step, but is extended by sup-
pressing the difference between the original and newly searched trajectories (between Phase
5 and Phase 6). The implementation of this penalty is complicated by the different lengths of
the decision vector ⃗z, where the original one is always shorter than the current one. In order
to compute the difference, a newly defined initial estimate z⃗0 is used which has the same
length as the searched vector. In order to prevent some values from being unintentionally
penalized against the values found by the spline function, a newly introduced weighting
vector z⃗w is introduced to indicate the positions for difference computation. It contains
values of 1 at positions where the difference is to be computed and zeros at positions
where the difference is not required. Both vectors are multiplied by this vector before the
Appl. Sci. 2024, 14, 11675 16 of 23
actual difference is computed, ensuring that only the values found in the previous step are
penalized. The resulting form of the cost function is provided by Equation (32).
!
N −2
1 1 1
J =10 · · ( u − u 12 ) 2 + ∑ ( u 1 n − u 1 n + 1 ) 2 + ( u 1 N − 1 − u 1 N ) 2 +
N 2 11 n =2
2
!
N −2
1 1 1
+10 · · (u21 − u22 ) + ∑ (u2n − u2n+1 ) + (u2N −1 − u2N ) +
2 2 2
N 2 n =2
2
(32)
N
+ ∑ (zwn · z0n − zwn · zn )+
n =1
N −1 q
∑
2 2
+ x 1n − x 1n +1 + x 2n − x 2n +1 +q
n =1
The optimal path can also be visualized, as seen in Figure 4. It consists of piece-wise
linear lines connecting grid points that refer to the reference point R0 of the truck over time.
Figure 4. Phase 1 optimal found path (left: starting point, right: target point).
3.2. Resulting Optimal Trajectories (Phase 6) and Comparison with the Reference Solution
This subsection presents the final results selected from Phase 6 related to trajectory
planning, namely, the control input u1 representing the truck’s velocity and the state
Appl. Sci. 2024, 14, 11675 17 of 23
variable x3 ≡ ϕ0 representing steering angle of the truck’s front wheels. This also implicitly
represents partial results from Phase 2–5, as they are consecutive throughout the workflow
of the trajectory planning solution. The found trajectories are compared to the reference
solution presented in [20].
Figure 5 shows a comparison of the driving progress for both solutions in a 2D space
over time, with a trailing path illustrating movement up to the selected time points.
Figure 6 illustrates the truck’s movement in detail, with a trailing path provided for
enhanced visibility.
15
10
Y [m]
0
Trajectory of Truck
Trajectory of Trailer 1
Trajectory of Trailer 2
0 10
X [m]
Figure 5. Comparison of the trajectories: proposed solution (left) and reference solution (right).
For clarity, the color legends of the truck and individual trailers are the same for both
solutions. Figure 7 presents a comparison of the resulting optimal control inputs. In the
upper sections, the truck’s speed exhibits distinct signal characteristics; one graph displays
a more oscillatory pattern, with peaks resembling sinusoidal waves, while the other shows
a smoother parabolic-like curve. A similar though less pronounced effect can be observed
in the lower section, which represents the steering angle of the truck’s front wheels.
Appl. Sci. 2024, 14, 11675 18 of 23
1.5
u 1 [m s-1]
u 1 [m s-1]
1
1
0.5
0 0
0 10 20 30 40 0 10 20 30
t [s] t [s]
0.2
0.1
0
x 3 [rad]
x 3 [rad]
0
0 10 20 30 40 0 10 20 30
t [s] t [s]
Figure 7. Comparison of control inputs: proposed solution (left) and reference solution (right).
Proposed Reference
Comparison Indicator
Solution Solution
Computational time for solution [s] 363.8 409.9 a
The value of the cost function 42.31 44.26
Total driving time [s] 42.35 31.58
Number of points in the trajectory 42 33
Total distance traveled [m] 44.42 44.26
Cumulative sum angle diff of front wheels 2.89 20.09
a time required to find a solution with a supplied initial estimate.
Proposing multiple optimization phases proved beneficial for the problem addressed
in this paper. To support this, we also tested the solution without Phase 4 in order to
examine its importance. Although constraints related to the truck and its possible collision
with obstacles as a part of Phase 4 are also included in Phase 5, incorporating Phase 4
makes the computation much faster. Omitting this led to an almost tenfold increase in
computational time, as documented in Table 3. The times are shown in two columns, with
and without Phase 4, indicated by a dash symbol.
Table 3. Computation times for the proposed solution with Phase 4 included (left column) and
omitted (right column)
All computations and timing measurements were performed using the same hardware
and software setup for consistency: Matlab R2021b on a laptop with an Intel Core i7-11390H
processor and 16 GB of RAM. To ensure repeatability and validate results, additional tests
were also conducted with different hardware and software configurations.
The goal of testing on different hardware and software configurations was to analyze
the following issues:
• Repeatability and Validation: Here, the objective is to ensure reliability by making
sure that the proposed solution consistently produces similar results across different
configurations.
• Hardware Limitations: The effect of RAM size on computation speed was tested, with
no observed improvement for this specific task. However, a limitation of the proposed
solution lies in its high RAM requirements as the number of nodes in Dijkstra’s
algorithm increases. In the presented case study, a single node per meter (k g = 1) was
used. If this number was increased to k g = 5, then 64 GB of RAM would be required,
with RAM demand growing exponentially as more nodes are added. This issue can be
effectively addressed by implementing an adaptive grid, which reduces complexity by
using a finer grid near obstacles and a coarser grid elsewhere, significantly lowering
the computational load. This mainly relates to Phase 1. The computational load for
the rest of phases significantly depends on CPU performance when considering our
PC, Windows OS, and Matlab environment.
To demonstrate behavior on different hardware and software configurations, we
added a table showing some basic relations between CPU benchmarking score (obtained
via the GeekBench utility) and total computational times on three other PC platforms. We
added benchmarking for Raspberry Pi4 and Raspberry Pi5 for consistency in cases where
algorithms should be supposed to work on these platforms. Here, the computational times
remain unknown, as the implementation is currently conducted in the Matlab environment.
To reach a relevant conclusion on performance on Rpi4, Rpi5, and other Linux targets,
the solution would have to be ported there. The most crucial phase would be using an
appropriate NLP solver. We carried out basic tests on simple benchmarking optimal control
problems using the pysolnp NLP solver in a Python environment and COBYLA solver
using FORTRAN language. These tests revealed that good overall efficiency and very
favorable computational times can be achieved in these environments, despite lower CPU
performance as indicated by GeekBench CPU benchmarking.
Table 4 summarizes the tests we carried out on different platforms. Regarding the
RPi4 and RPi5, “U” stands for unknown, as the entire proposed algorithm is currently
Appl. Sci. 2024, 14, 11675 20 of 23
only available in the Matlab environment. The table shows both single-core and multi-core
values obtained with the GeekBench CPU benchmarking utility.
4. Conclusions
The presented results depicted in Figure 5 document our solution to the problem
formulated in Section 2.1. The findings presented in this study illustrate a robust solution
to the truck–trailer maneuverability challenge as defined in the problem formulation. The
primary focus has been on achieving forward movement control of a two-trailer truck
system, with additional experiments involving a three-trailer configuration conducted
to test the flexibility and robustness of the proposed solution. These additional tests,
Appl. Sci. 2024, 14, 11675 21 of 23
including scenarios with reverse movement, validate the adaptability and effectiveness of
our approach across a broader spectrum of real-world applications.
Our approach contributes to the domain by addressing the complexity inherent in
multi-trailer systems, where maintaining precise control of each segment is critical for
stability and operational efficiency. The algorithms and control strategies developed
herein demonstrate significant promise for applications in industries where automated and
semi-automated trailer maneuvering is essential, such as logistics, freight transport, and
yard operations.
While the focus of this work has primarily been on achieving a solution under for-
ward driving conditions, our extended experiments with multiple trailers and reversing
maneuvers suggest that the proposed control system could potentially be generalized to
even more complex scenarios. Testing both forward and reverse movements of a truck
with three trailers in a real-world environment using the educational physical description
in [27] further supports the validity of the proposed concept. Future work could build
upon these foundations to explore refinements in control algorithms that can accommo-
date varying load distributions and trailer lengths, allowing for real-time adaptability in
dynamic environments.
As future work, more sophisticated mechanism related to increasing number of nodes
could be applied when refining the trajectories in Phase 6, which would apply more
increasing steps in iterations and evaluate progress between steps. By treating evaluation
as a relative progress under a certain relative tolerance, the algorithm could end after
reaching some very high chance of finding a non-collision trajectory. Such mechanism
could also be combined with other measures, such as considering obstacles as somewhat
larger then they really are, thereby introducing a certain relaxation and safety margin.
In addition to what is mentioned in this paper regarding evaluation of the results, ad-
ditional metrics such as trajectory length, control input smoothness, and error from desired
endpoints could be used to evaluate the algorithm’s capabilities and limitations more com-
prehensively. In the future, we may test the algorithm’s sensitivity to parameter variations
in order to provide a holistic evaluation. For example, it would be possible to explore a
truck with multiple trailers of varying lengths navigating a given course to test how the
algorithm handles varying parameters and the robustness of the solution. After the trajec-
tory planning problem is solved, the next step is trajectory tracking. While this paper does
not address trajectory tracking in detail, standard methods such as using Linear Quadratic
Regulator (LQR) over a finite horizon can be employed. Alternatively, more advanced
algorithms such as the approach proposed in [28] can be utilized, which focuses on path
tracking control for autonomous vehicles while accounting for network-induced delays
and incorporating roll dynamics to enhance both driving safety and passenger comfort.
In summary, this paper contributes a foundational approach to enhancing the maneu-
verability of multi-trailer systems, presenting both theoretical and practical insights that
can pave the way for further research and industrial applications.
Author Contributions: S.O. (Stepan Ozana): methodology, writing—original draft; F.K. (Filip Krupa):
methodology, visualization, data curation; Z.S. (Zdenek Slanina): editing, supervision; All authors
have read and agreed to the published version of the manuscript.
Funding: This work was supported by the project SP2024/021, “Development of algorithms and
systems for control, measurement, and safety applications X” under the Student Grant System,
VSB-TU Ostrava. This article was produced with the financial support of the European Union
under the REFRESH – Research Excellence for Region Sustainability and High-tech Industries project
number CZ.10.03.01/00/22_003/0000048 through the Operational Programme Just Transition. This
work was also supported by the European Regional Development Fund for the Research Centre of
Advanced Mechatronic Systems project, project number CZ.02.1.01/0.0/0.0/16_019/0000867 under
the Operational Programme Research, Development and Education.
Data Availability Statement: Dataset available on request from the authors.
Conflicts of Interest: The authors declare no conflicts of interest.
Appl. Sci. 2024, 14, 11675 22 of 23
References
1. Chang, T.; Tian, G. Hybrid A-Star Path Planning Method Based on Hierarchical Clustering and Trichotomy. Appl. Sci. 2024,
14, 5582. [CrossRef]
2. Li, B.; Acarman, T.; Zhang, Y.; Zhang, L.; Yaman, C.; Kong, Q. Tractor-trailer vehicle trajectory planning in narrow environments
with a progressively constrained optimal control approach. IEEE Trans. Intell. Veh. 2019, 5, 414–425. [CrossRef]
3. Li, B.; Zhang, Y.; Ouyang, Y.; Liu, Y.; Zhong, X.; Cen, H.; Kong, Q. Real-time trajectory planning for agv in the presence of moving
obstacles: A first-search-then-optimization approach. arXiv 2019, arXiv:1902.06201. [CrossRef]
4. Erraji, O. Model Predictive Control System Design of a Passenger Car for Valet Parking Scenario. Ph.D. Thesis, University of
Windsor, Windsor, ON, Canada, 2018.
5. Lin, L.; Jim Zhu, J. Path planning for autonomous car parking. In Proceedings of the ASME 2018 Dynamic Systems and Control
Conference, DSCC 2018, Atlanta, GA, USA, 30 September–3 October 2018; Volume 3. [CrossRef]
6. Lee, B.; Wei, Y.; Guo, I.Y. Automatic parking of self-driving car based on lidar. Int. Arch. Photogramm. Remote. Sens. Spat. Inf. Sci.
2017, 42, 241–246. [CrossRef]
7. Kuwata, Y.; Teo, J.; Fiore, G.; Karaman, S.; Frazzoli, E.; How, J.P. Real-time motion planning with applications to autonomous
urban driving. IEEE Trans. Control. Syst. Technol. 2009, 17, 1105–1118. [CrossRef]
8. Divelbiss, A.W.; Wen, J.T. Trajectory tracking control of a car-trailer system. IEEE Trans. Control. Syst. Technol. 1997, 5, 269–278.
[CrossRef]
9. Xu, H.; Yu, Z.; Lu, X.; Wang, S.; Li, S.; Wang, S. Model predictive control-based path tracking control for automatic guided
vehicles. In Proceedings of the 4th CAA International Conference on Vehicular Control and Intelligence (CVCI), Hangzhou,
China, 18–20 December 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 627–632. [CrossRef]
10. Qian, X. Model Predictive Control for Autonomous and Cooperative Driving. Ph.D. Thesis, PSL Research University, Paris,
France, 2017.
11. Salmon, J. Guidance of an off-road tractor-trailer system using model predictive control. Ph.D. Thesis, Auburn University,
Auburn, AL, USA, 2013.
12. Hery, E.; Masi, S.; Xu, P.; Bonnifait, P. Map-based curvilinear coordinates for autonomous vehicles. In Proceedings of the 2017
IEEE 20th International Conference on Intelligent Transportation Systems (ITSC), Yokohama, Japan, 16–19 October 2017; IEEE:
Piscataway, NJ, USA, 2017; pp. 1–7. [CrossRef]
13. Ghilardelli, F.; Lini, G.; Piazzi, A. Path Generation Using η 4 -Splines for a Truck and Trailer Vehicle. IEEE Trans. Autom. Sci. Eng.
2013, 11, 187–203. [CrossRef]
14. Szynkiewicz, W.; Błaszczyk, J. Optimization-based approach to path planning for closed chain robot systems. Int. J. Appl. Math.
Comput. Sci. 2011, 21, 659–670. [CrossRef]
15. Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey wolf optimizer. Adv. Eng. Softw. 2014, 69, 46–61. [CrossRef]
16. Mirjalili, S.; Lewis, A. The whale optimization algorithm. Adv. Eng. Softw. 2016, 95, 51–67. [CrossRef]
17. Meraihi, Y.; Ramdane-Cherif, A.; Acheli, D.; Mahseur, M. Dragonfly algorithm: A comprehensive review and applications. Neural
Comput. Appl. 2020, 32, 16625–16646. [CrossRef]
18. Salimi, H. Stochastic fractal search: A powerful metaheuristic algorithm. Knowl.-Based Syst. 2015, 75, 1–18. [CrossRef]
19. Rocha, A.M.A.; Fernandes, E.M. A Stochastic Augmented Lagrangian Equality Constrained-Based Algorithm for Global
Optimization. In Proceedings of the AIP Conference Proceedings, Rhodes, Greece, 19–25 September 2010; American Institute of
Physics: College Park, MD, USA, 2010; Volume 1281, pp. 967–970. [CrossRef]
20. Li, B.; Shao, Z. Precise trajectory optimization for articulated wheeled vehicles in cluttered environments. Adv. Eng. Softw. 2016,
92, 40–47. [CrossRef]
21. Ye, H.; Jiang, H.; Ma, S.; Tang, B.; Wahab, L. Linear model predictive control of automatic parking path tracking with soft
constraints. Int. J. Adv. Robot. Syst. 2019, 16, 1729881419852201. [CrossRef]
22. Mathworks. Fmincon. 2021. Available online: https://www.mathworks.com/help/optim/ug/fmincon.html (accessed on 13
December 2024 ).
23. Zadachyn, V.; Dorokhov, O. Calculation of optimal path for parallel car parking. Transp. Telecommun. 2012, 13, 303. [CrossRef]
24. Lin, L.; Zhu, J.J. Trajectory Generation From Paths for Autonomous Ground Vehicles. In Proceedings of the Dynamic Systems
and Control Conference, Virtual, Online, 5–7 October 2020; ASME: New York, NY, USA, 2020; Volume 84287, p. V002T31A004.
[CrossRef]
25. Ge, D.; Liu, T.; Liu, J.; Tan, J.; Ye, Y. SOLNP+: A Derivative-Free Solver for Constrained Nonlinear Optimization. arXiv 2022,
arXiv:2210.07160. .
26. Arumugam, V.; Algumalai, V. Topological Navigation of Path Planning Using a Hybrid Architecture in Wheeled Mobile Robot. In
Proceedings of the Communications in Computer and Information Science, 2023, Chennai, India ; Volume 2202 CCIS, pp. 32–44.
[CrossRef]
Appl. Sci. 2024, 14, 11675 23 of 23
27. REX Controls. Autonomous Reversing T3T. 2020. Available online: https://www.rexcontrols.com/autonomous-reversing
(accessed on 13 December 2024).
28. Viadero-Monasterio, F.; Nguyen, A.T.; Lauber, J.; Boada, M.J.L.; Boada, B.L. Event-Triggered Robust Path Tracking Control
Considering Roll Stability Under Network-Induced Delays for Autonomous Vehicles. IEEE Trans. Intell. Transp. Syst. 2023,
24, 14743–14756. [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual
author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to
people or property resulting from any ideas, methods, instructions or products referred to in the content.