# Finite-Horizon Kinetic Energy Optimization of a Redundant Space Manipulator
## 2 Materials and Methods
### Parameters Description
\begin{table}
\begin{tabular}{c l} \hline \hline
**Step nr.** & **Operation** \\ \hline
**1** & A horizon \(h\) is selected (\(h\) is a positive integer number). \\
**2** & A prediction step size \(\Delta T\) is selected. It is a multiple of the pseudoinverse algorithm step size \(\Delta t\) and it is generally much larger. \\
**3** & An update interval size \(I\) is selected. It is a multiple of the pseudoinverse step size \(\Delta t\), but it is generally smaller than \(\Delta T\). \\  & Expression (4) is optimized with sampling times \(t\ =\ t_{0},\ \ t_{0}+\ \Delta T,\ldots,t_{0}+h\Delta T\). Any deterministic optimisation algorithm can be used, and the Matlab _fmincon_ Sequential Quadratic Programming (SQP) function has been used in this work. This provides a prediction of the optimal joint variables for a future window that is defined here as prediction window \(T_{p}=\ h*\Delta T\). \\  & The optimization at point 4 outputs a set of \(h\) joint configurations, for the \(h+1\) sampling times \\
**5** & \(t\ =\ t_{0},\ t_{0}+\ \Delta T,\ldots,t_{0}+h\Delta T\). The set of these vectors is from now on referred as \(\left\{\boldsymbol{q_{prediction}}\right\}\). A specific vector in the set is referred with its sampling time as a subscript, with a notation such as \(\boldsymbol{q_{h\Delta T}}\) for the sampling time \(t_{0}+\ h\Delta T\) (\(\boldsymbol{q_{0}}\) for \(t_{0}\)). \\  & A 4 th order spline interpolation from \(\boldsymbol{q_{0}}\) to \(\boldsymbol{q_{h\Delta T}}\) is computed, which intersect all the points in the set \(\left\{\boldsymbol{q_{prediction}}\right\}\). \\
**6** & Endpoint conditions of the interpolation are set so that \(\hat{\boldsymbol{q}}\) and \(\tilde{\boldsymbol{q}}\) at \(\boldsymbol{q_{0}}\) are always set equal to the ones reached by the manipulator at time \(t_{0}\), and are set to zero at \(\boldsymbol{q_{h\Delta T}}\). This ensures that the resulting spline has not large derivatives in the interval of interest. The resulting spline is from now on referred as \(\boldsymbol{q_{prediction}}=f(t)\). \\  & For each step \(i\) in the update interval \(I\), the joint velocities are computed as per (2), using the error between the previous \\
**7** & joint variables \(\boldsymbol{q_{i-I}}\) and the computed value of \(\boldsymbol{q_{prediction}}\) divided per \(\Delta t\) as arbitrary vector: \\  & \(\tilde{\boldsymbol{q}}_{0}=\ \frac{\boldsymbol{q_{prediction}}-\boldsymbol{q_{i-1}}}{ \Delta T}\) \\
**8** & Once time \(I\) has passed, steps 4 to 7 are repeated for the new update interval, using the last time step of previous \\
**9** & Steps 4–8 are repeated until the amount of time before the end of the trajectory is \(T_{p}\). \\
**10** & The steps left at this point are computed with the last computed \(\boldsymbol{q_{prediction}}\). \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Steps of the Predictive Minimization of Kinetic Energy (PMKE) method. Update interval \(I\): the update interval is the variable that decides how often the optimization of the cost function is updated. It should be ideally set as big as the time step \(\Delta t\), but this would slow down the method. For the simulations presented in this paper, an update interval of 0.5 s is chosen to show that this is sufficient to obtain good results. However, much shorter \(I\) intervals are also possible if computational time is not a concern. The computational time required for the PMKE method is discussed in more detail in Section 3.2. The values of the main parameters of the PMKE method used in this work are summarized in Table 2.