# Influence of the Road Model on the Optimal Maneuver of a Racing Motorcycle
## 2 Road Modeling
### Track Identification OCP  
The three-dimensional road is typically modeled as a ribbon generated by a spine curve, and this approach has already been described in detail in [13]. The road can be described by three coordinates of the spine curve \([x(s),y(s),z(s)]^{T}\), width \(t_{w}(s)\), and three curvatures: relative torsion \(\Omega_{x}(s)\), normal curvature \(\Omega_{y}(s)\), and geodesic curvature \(\Omega_{z}(s)\), which are expressed in the ribbon (road) frame and describe its angular velocity. The road frame, called Darboux frame, is a moving trihedron located on the track spine curve in such a way that the \(x\)-\(y\) plane represents the road plane and the \(x\)-axis points along the tangent to the spine curve. The above quantities are functions of the curvilinear abscissa \(s\), which represents the arc length along the spine curve. The curvilinear abscissa \(s\) varies between \(s=0\) at the start of the road and \(s=L\) at the road endpoint. The road curvatures \(\Omega_{B}=\left[\Omega_{X},\Omega_{y},\Omega_{z}\right]^{T}\) can be expressed in terms of Euler angles employed in the \(zyx\) convention: \(\theta(s)\), \(\phi(s)\), and \(\mu(s)\), called yaw (track heading), roll (road camber), and pitch (road inclination), respectively. The road curvatures \(\Omega_{B}\) can be obtained using the following relationship:  
\[\Omega_{B}= \begin{bmatrix}\Omega_{x}\\ \Omega_{y}\\ \Omega_{z}\end{bmatrix} = \begin{bmatrix}1&0&-\sin\mu\\ 0&\cos\phi&\cos\mu\sin\phi\\ 0&-\sin\phi&\cos\mu\cos\phi\end{bmatrix}\begin{bmatrix}\phi^{\prime}\\ \mu^{\prime}\\ \theta^{\prime}\end{bmatrix} . \tag{1}\]  
The three successive rotations using the Euler angles \(\theta\), \(\phi\), and \(\mu\) describe the orientation of the ribbon frame relative to the inertial frame by the following rotation matrix  
\[\mathbf{R}=\mathbf{R}_{z}(\theta)\mathbf{R}_{y}(\mu)\mathbf{R}_{x}(\phi)= \begin{bmatrix}\mathrm{c}_{\phi}\mathrm{c}_{\mu}&\mathrm{c}_{\phi}\mathrm{s}_ {\phi}-\mathrm{s}_{\phi}\mathrm{c}_{\phi}&\mathrm{c}_{\phi}\mathrm{s}_{\mu} \mathrm{c}_{\phi}+\mathrm{s}_{\theta}\mathrm{s}_{\phi}\\ \mathrm{s}_{\theta}\mathrm{c}_{\mu}&\mathrm{s}_{\theta}\mathrm{s}_{\phi}+ \mathrm{c}_{\phi}\mathrm{c}_{\phi}&\mathrm{s}_{\theta}\mathrm{s}_{\mu} \mathrm{c}_{\phi}-\mathrm{c}_{\theta}\mathrm{s}_{\phi}\\ -\mathrm{s}_{\mu}&\mathrm{c}_{\mu}\mathrm{s}_{\phi}&\mathrm{c}_{\mu}\mathrm{c} _{\phi}\end{bmatrix} , \tag{2}\]  
where \"s\" and \"c\" symbolize the sine and cosine, respectively, and \(\mathbf{R}_{x}(\phi)\), \(\mathbf{R}_{y}(\mu)\), and \(\mathbf{R}_{z}(\theta)\) are elementary rotations about body-fixed axes given by  
\[ \begin{split}\mathbf{R}_{x}(\phi)=\begin{bmatrix}1&0&0\\ 0&\cos\phi&-\sin\phi\end{bmatrix},\ \ \mathbf{R}_{y}(\mu)=\begin{bmatrix} \cos\mu&0&\sin\mu\\ 0&1&0\\ -\sin\mu&0&\cos\mu\end{bmatrix},\\ \mathbf{R}_{z}(\theta)=\begin{bmatrix}\cos\theta&-\sin\theta&0\\ \sin\theta&\cos\theta&0\\ 0&0&1\end{bmatrix}.\end{split}  \tag{3}\]  
The road geometry can be identified from three-dimensional coordinates of points located on the road edges. The position of these points can be determined by various methods, each of which will be characterized by a certain level of noise. The noisy road model in the related optimal maneuver problem would negatively affect the accuracy of the solution and would entail the need to reduce the integration step lengths, thus increasing the computation time. To achieve smooth road characteristics, the track identification problem can be formulated as an optimal control problem, allowing for noise filtering. The cost function in OCP is given by  
\[\min_{\mathbf{u}\in\mathbf{U}}\mathcal{I}=\int_{s_{0}}^{s_{f}}F_{1}(s,\mathbf{ X}(s))+F_{2}(s,\mathbf{v}(s))\mathrm{d}s, \tag{4}\]  
where \(s_{0}\) and \(s_{f}\) are the track lengths. The state vector \(\mathbf{X}\) consists of ten variables: the spine curve coordinates \((x,y,z)\), the Euler angles and their first derivatives, and the track width  
\[\mathbf{X}= \begin{bmatrix}x&y&z&\theta&\mu&\phi&\theta^{\prime}&\mu^{ \prime}&\phi^{\prime}&t_{w}\end{bmatrix}