2.4 Learning-based Model Predictive Control
4.1.2 MPC Configuration
first and second derivatives. The expression is defined as follows:
π(π ) = π₯β²π(π )π¦πβ²β²(π )βπ¦β²π(π )π₯β²β²π(π )
(π₯β²π(π )2+π¦πβ²(π )2)32 . (4.4) The original path following kinematics, as formulated in [34], utilized an ideal unicycle robot model. This model was later expanded in [15, 16] to incorporate the kinematics of the SSMR by substituting (4.1) into (4.3). The resultant state-space model for path following of the SSMR is presented below, as derived in [16]:
Λ
π₯π =π£π₯cosππ+π₯πΌπΆπ πsinππβπ (1Λ βπ(π )π¦π),
Λ
π¦π =π£π₯cosππβπ₯πΌπΆπ πsinππβπ(π ) Λπ π₯π, πΛπ =πβπ(π ) Λπ .
(4.5)
As stated in [25], the longitudinal and angular velocities (π£π₯ and π) of the SSMR can be translated to the velocities of its left and right wheels (π£π and π£π), while taking into consideration correction factors πΌπ and πΌπ to account for the conditions of the wheels and/or the terrain surface characteristics:
π£π₯ = πΌππ¦πΌπΆπ ππ£πβπΌππ¦πΌπΆπ ππ£π
π¦πΌπΆπ π βπ¦πΌπΆπ π , π= πΌππ£πβπΌππ£π
π¦πΌπΆπ π βπ¦πΌπΆπ π. (4.6)
Path Following State-Space Model
The state-space model used by MPC involves a system state represented by a vector π₯, which includes variables such as π₯π, π¦π, ππ, π£π, π£π, and π , and a control input represented by a vector π’containing variables ππ and ππ. This model is based on the spatial SSMR kinematic model described previously and is defined as follows:
Λ
π₯π =π£π₯cosππ+π₯πΌπΆπ πsinππβπ (1Λ βπ(π )π¦π),
Λ
π¦π =π£π₯cosππβπ₯πΌπΆπ πsinππβπ(π ) Λπ π₯π, πΛπ=πβπ(π ) Λπ ,
Λ π£π=ππ,
Λ π£π =ππ,
Λ
π =π£π₯cosππ+π₯πΌπΆπ πsinππ.
(4.7)
The movement of the moving reference frame along the path is determined by the path state variable, π . The velocity of this frame is estimated by approximating the SSMR velocity along its π₯π axis.
A compact representation of the systemβs state-space model is given by:
Λ
π₯=π(π₯, π’), (4.8)
where π :R6ΓR2 βR6 is derived from the equation (4.7).
Optimal Control Problem (OCP)
Formulation the optimal control problem (OCP) that will be solved at each sampling time is facilitated by introduction of the following variables:
β’ π£π represents the speed of the moving reference frame along the path, which is equal to the SSMR speed along the π₯π axis:
π£π =π£π₯cosππ+π₯πππsinπππ (4.9)
β’ ππ,πππ΅, and πππ΅ represent obstacle avoidance terms and are defined as:
ππ=πβ((π¦πβπ¦ππππ )2+(π₯πβπ₯ππππ )2β(ππππ +ππππ)2), (4.10) πππ΅=πβ((π¦π+π‘ππππ_π€πππ‘β/2)2βπ2πππ ), (4.11) πππ΅ =πβ((π¦πβπ‘ππππ_π€πππ‘β/2)2βπ2πππ ), (4.12)
β’ β is the state vector that includes the system state and the obstacle avoidance terms, i.e., β= (π₯π, π¦π, ππ, π£π, π£π, π£π , ππ, πππ΅, πππ΅).
β’ βπππ is the reference state vector, i.e., βπππ = (0,0,0,0,0, π£π πππ,0,0,0). The OCP is then formulated as follows:
β=(π₯π, π¦π, ππ, π£π, π£π, π£π , ππ, πππ΅, πππ΅), βπππ = (0,0,0,0,0, π£π πππ,0,0,0).
min 1 2
β«οΈ π‘π
π‘0
||β(π)ββπππ(π))||2π
s.t.π₯Λ =π(π₯, π’),
π£πππ β€π£π β€π£πππ₯, π£πππ β€π£πβ€π£πππ₯, ππππ β€ππβ€ππππ₯, ππππ β€ππ β€ππππ₯,
(4.13)
where π is a symmetrical positive-definite matrix that defines the weights of the cost function. The constraints are imposed point-wise in time for π β [π‘0, π‘π]. The OCP is solved at each sampling instant in a receding-horizon fashion. The state vector β includes the system state and the obstacle avoidance terms (ππ, πππ΅, πππ΅), while the reference state vectorβπππ is defined as(0,0,0,0,0, π£π πππ,0,0,0). The speed of the moving reference frame along the path (π£π ) is calculated asπ£π =π£π₯cosππ+π₯πππsinπππ. The variablesππ,πππ΅, andπππ΅are defined as repulsive artificial potential fields, where ππrepresents the obstacle avoidance term,πππ΅ represents the inner border avoidance term, and πππ΅ represents the outer border avoidance term.
MPC Cost, Reference and Constraints
The objective of the MPC controller is to minimize the error between the current state of the robot and the desired reference state, while also taking into account the obstacle avoidance terms. The error coordinates are defined as the deviation of the robotβs position, orientation, and velocity from the desired trajectory. By minimizing these error coordinates, the controller can effectively steer the robot back onto the desired trajectory.
To ensure that the robot moves forward along the path, the path velocity term π£π is included in the OCP with a non-zero reference value. This term represents the speed of the moving reference frame along the path, which is approximated as the SSMR velocity along its π₯π axis.
In terms of constraints, the velocities and accelerations of the left and right wheels are constrained not to exceed the SSMR motorsβ limits. This prevents the robot from making sudden, jerky movements that could destabilize it or cause it to lose traction.
Additionally, the left and right wheel velocities are penalized in the cost function to prevent excessive wheel speeds during maneuvering.
Real-Time Feedback Procedure
Cubic splines are a common method used to interpolate data points in a smooth man- ner. They can be used to approximate functions π₯π(π ) and π¦π(π ), which are usually the π₯ and π¦ coordinates of a path in the global frame. Cubic splines are piecewise functions that consist of cubic polynomials connected at the waypoints, which are the data points provided. The polynomial coefficients are determined by imposing continuity constraints on the polynomial and its derivatives at each waypoint.
Given the cubic spline approximation of π₯π(π ) and π¦π(π ), the curvature π(π ) can be computed at each point π along the path using equation (4.4). The first and second derivatives of π₯π(π ) and π¦π(π ) can also be computed using the cubic spline approximation with respect to π resulting in values of π₯β²π(π ), π₯β²β²π(π ) and π¦πβ²(π ), π¦πβ²β²(π ). These derivatives are needed to compute the terms in the equation for curvature.
The value of π for each time step is computed using the SSMRβs odometry and the MPCβs prediction of the SSMRβs future motion. This allows the MPC to deter- mine the curvature of the path for each point along the prediction horizon, which is necessary for the SSMR to follow the desired path.
The MPC solver necessitates the initial time-stepβs system state to be defined, which it uses to compute subsequent time-step states via its system model. According to equation (4.7), the necessary states are π₯π, π¦π, ππ, π£π, π£π, and π . However, this projectβs robot control system lacks a localization module, rendering it incapable of determining its spatial position (π₯π, π¦π) and orientation (ππ). Therefore, as the Webots simulation environment keeps track of all objectsβ positions and orientations, the SSMRβs location and orientation were obtained directly from Webots simulator data.
The simulator provides information on the robotβs position and orientation relative to the world frame, as well as the velocity of each wheel: π₯, π¦, π, π£π, and π£π. The velocities of the left and right wheels can be utilized directly, whereas the other states necessitate computation using the accessible data.
Initially, it is imperative to assess the path coordinateπ of the robot by employing the π₯ and π¦ coordinates alongside the functions π₯π(π ) and π¦π(π ). The process for determining π involves seeking the value of π that minimizes the Euclidean distance between the robotβs location(π₯, π¦)in the world frame and the reference point defined by splines(π₯π(π ), π¦π(π )); the golden section search technique was implemented as the search method in this instance.
Once π has been determined, the error terms π₯π, π¦π, and ππ can be calculated.
The expressions for π₯π and π¦π are derived from (4.2). As the feedback value of π from the Webots simulator may abruptly shift from π to βπ when π approaches either of these values, ππ cannot be obtained directly from the simulator data and corresponding expression in (4.2), otherwise it will cause chaotic rotation of SSMR when moving in direction π/βπ. Therefore, it was necessary to introduce the vector that represents the robotβs orientation as ππ = (cosπ,sinπ), and the vector that represents the orientation of the moving frame as ππ = ( Λπ₯π(π ),π¦Λπ(π )). Subsequently,
ππ could be determined by cross and dot products as follows:
ππ = arctan
(οΈ||ππΓππ||
ππΒ·ππ )οΈ
. (4.14)