## 3 Determining Collision Time Instants in Package Rocking Process
 \tag{26}\]  
In Equation (26), if \(\mathrm{sgn}(\theta(t))=-1,f=\dot{\theta}\), and if \(\mathrm{sgn}(\theta(t))=1,f=\dot{\theta}\). From the definition of function \(f\) in Equation (25), \(f^{\mathbf{\pi}}\) and \(\dot{\theta}^{\beta}\) are smooth functions. The initial state of \(\mathbf{x}\) is \(\mathbf{x}(0)=\mathbf{x}_{0}\). From Equation (26), it can be observed that the rocking package constitutes a piecewise-smooth dynamical system [22]. For the package rocking problem, \(\psi(\mathbf{x})\) can be written as:  
\[\psi(\mathbf{x})=\left[1,0,0\right]\cdot\left[\theta,\dot{\theta},t\right]^{ \mathrm{T}}=\theta \tag{27}\]  
where the dot \(\cdot\) indicates the vector product. Assuming the function of initial state \(\psi(\mathbf{x}(0))=-H<0\), we reduce Equation (26):  
\[\left\{ \begin{array}{ll}\frac{d\mathbf{x}(t)}{dt}=f^{\mathbf{n}}(\mathbf{x}(t))&\psi(\bm {x})<0\\ \mathbf{x}(0)=\mathbf{x}_{0}&\end{array} \right. \tag{28}\]  
Beyond the package rocking problem, determining boundary time instants \(t_{f}\) that satisfy the condition \(\psi(\mathbf{x}(t_{f}))=0\) is crucial in many engineering applications. [PERSON] et al. [23] proposed a numerical procedure based on the Adams-Bashforth method, which determines \(t_{f}\) unidirectionally in finite steps for Equation (28). In [24], potential conditions of midpoint distribution were considered, and a subdiagonal explicit Runge-Kutta method was employed to determine \(t_{f}\) unidirectionally. In this study, we adopt the time transformation method combined with the Runge-Kutta method to propose a numerical approach for determining the time instants \(t_{f}\) at which the rocking package collides with the vehicle. Once \(t_{f}\) is determined, the rocking response of the package can be efficiently simulated, as the motion within each time interval defined by \(t_{f}\) is smooth. From Equation (27), function \(\psi\) can be considered as a hyperplane in \(\mathbf{x}\) space:  
\[\psi(\mathbf{x})=\mathbf{dx}+\mathbf{e} \tag{29}\]  
where \(\mathbf{d}=\) [1,0,0] and \(\mathbf{e}=\) [0,0,0]. Since the package rocks smoothly between impact time instants \(t_{f}\), therefore, function \(\psi\) defined in Equation (29) is monotonic and differentiable when \(t\in\{t_{f_{f}},t_{f_{f}+1}\}\), \(t_{f}\) is the \(i\)th impact time instant, \(i=0\), \(1\), \(2\), \(\ldots\), and \(t_{0}=0\). The following time transformation is formulated  
\[s=\psi(\mathbf{x}(t))\quad t=\alpha(s) \tag{30}\]  
Here, we analyze the time instants \(t_{f}\) at which the function \(f^{\mathbf{n}}\) reaches the boundary defined by \(\psi(\mathbf{x})=0\). Instead of using the variable \(t\), we introduce the variable \(s\). For \(t\in[0,t_{f}],s\in[-H,0]\). Based on the transformation in Equation (30), Equation (28) can be rewritten as:  
\[\left\{ \begin{array}{ll}\frac{dx}{ds}=g(x)=\frac{f^{n}(x)}{\psi_{x}(x)f^{n}(x)} &-H\leq s\leq 0\\ \textbf{x}(-H)=\textbf{x}_{0}&\end{array} \right. \tag{31}\]  
Here, \(\psi_{x}(x)=\partial\psi(x)/\partial x\). In this study, based on the time transformation in Equation (30), we utilize Equation (31) to analyze \(t_{f}\) instead of Equation (28). Equivalently, the trajectory \(\textbf{x}(s,\textbf{x}_{0})\) in the \(s\)-domain, where \(s\in[-H,0]\), is used to simulate the package rocking motion, replacing the trajectory \(\textbf{x}(t,\textbf{x}_{0})\) in the time domain, where \(t\in[0,\,t_{f}]\). By employing this time transformation, \(t_{f}\) can be determined efficiently. Let \(s(-H)=s_{0}\) and \(\textbf{x}_{gen}=[\textbf{x}\,s]^{\mathrm{T}}\); Equation (31) can be rewritten as:  
\[\left\{ \begin{array}{ll}\frac{dx_{gen}}{ds}=\left[\begin{array}{c}\textbf {x}^{\prime}\\ s^{\prime}\end{array}\right]=\left[\begin{array}{c}g(\textbf{x})\\ 1\end{array}\right]&-H\leq s\leq 0\\ \textbf{x}_{gen}(-H)=\left[\begin{array}{c}\textbf{x}_{0}\\ s_{0}\end{array}\right]&\end{array} \right. \tag{32}\]  
The solution to Equation (31) can be obtained numerically using the Runge-Kutta method:  
\[