## 3 Optimal Design of Compliant Elements  
The adoption of the regenerative drives leads to a reduction of the energy consumption, as is evident from the comparison of Equations (7) and (8). It is possible to further reduce the energy consumption by providing the robot with compliant elements, i.e., springs. Compliant elements store elastic energy and release it as kinetic energy, which then in addition to actuation moves the system. Different ways exist to add compliant elements to a system as described in [19]. In this study, parallel springs are added to the actuated joints of the robot. The moment (torque) exerted by the springs is:  
\[\boldsymbol{\tau}_{e}(t)=\boldsymbol{K}(\mathbf{q}(t)-\boldsymbol{\theta}) \tag{9}\]  
where \(\boldsymbol{K}=\text{diag}(k_{1},\ldots,k_{n})\) is the elastic stiffness matrix of the added springs and \(\boldsymbol{\theta}\) is the vector of the spring mounting positions. The torque of the springs must be included in the equations of motion for the system (Equation (1)):  
\[\widetilde{\boldsymbol{\tau}}(t) = \underbrace{\boldsymbol{\mathrm{IK}}_{r}^{-1}\tilde{\mathbf{q}}+ \boldsymbol{\mathrm{K}}_{r}\left(\mathbf{M}(\mathbf{q})\tilde{\mathbf{q}}+ \boldsymbol{\mathrm{f}}_{c}(\mathbf{q},\dot{\mathbf{q}})+\boldsymbol{\mathrm{ F}}_{\vartheta}\dot{\mathbf{q}}+\boldsymbol{\mathrm{f}}_{s}(\mathbf{q},\dot{ \mathbf{q}})+\boldsymbol{\mathrm{f}}_{g}(\mathbf{q})+\boldsymbol{\mathrm{f}}_{ e}(\mathbf{q})\right)}_{\boldsymbol{\tau}(t)}+\boldsymbol{\mathrm{K}}_{r}\underbrace{ \boldsymbol{\mathrm{K}}(\mathbf{q}-\boldsymbol{\theta})}_{\boldsymbol{\tau}_{e}(t)} \tag{10}\] \[= \left\{ \begin{array}{l}\boldsymbol{\tau}_{1}\\ \vdots\\ \boldsymbol{\tau}_{j}\\ \vdots\\ \boldsymbol{\tau}_{n}\end{array} \right\}+\left\{ \begin{array}{l}\mathrm{K}_{ r,1}k_{1}(q_{1}-\boldsymbol{\theta}_{1})\\ \vdots\\ \mathrm{K}_{r,j}k_{j}(q_{j}-\boldsymbol{\theta}_{1})\\ \vdots\\ \mathrm{K}_{r,n}k_{n}(q_{n}-\boldsymbol{\theta}_{n})\end{array} \right\}\]  
where \(\widetilde{\boldsymbol{\tau}}\) is the torque that includes both the contributions from the actuators as well as the added springs. As the trajectory is given, all the terms in Equation (10) are known with the exception of the spring stiffnesses \(k_{j}\) and mounting positions \(\boldsymbol{\theta}_{j}\) (\(j=1,\ldots,n\)). These values are to be found by minimizing the energy consumption of the system \(E\). By substituting Equations (2), (3), and (8) into Equation (10), the following expression is obtained for the system energy consumption:  
\[ \begin{array}{rcl}E&=&\sum_{j=1}^{n}\int_{t_{0}}^{t_{f}}p_{j}(t)dt\\ &=&\sum_{j=1}^{n}\underbrace{\int_{t_{0}}^{t_{f}}\left(\frac{ \boldsymbol{\mathrm{R}}_{j}}{\boldsymbol{\mathrm{\eta}}\boldsymbol{\mathrm{K}} _{t,j}^{2}}(\boldsymbol{\tau}_{j}(t)+\boldsymbol{\mathrm{K}}_{r,j}k_{j}(q_{j}(t )-\boldsymbol{\theta}_{j}))^{2}+\frac{\boldsymbol{\mathrm{K}}_{e,j}}{ \boldsymbol{\mathrm{\eta}}\boldsymbol{\mathrm{K}}_{t,j}\boldsymbol{\mathrm{K}} _{r,j}}(\boldsymbol{\tau}_{j}(t)+\boldsymbol{\mathrm{K}}_{r,j}k_{j}(q_{j}(t )-\boldsymbol{\theta}_{j}))\boldsymbol{\mathrm{\eta}}_{j}(t)\right)dt}_{ \boldsymbol{\tilde{E}}_{j}}\end{array}  \tag{11}\]  
By analyzing Equation (11), it results that the energy consumption of each motor, \(E_{j}\), depends only on the parameters, i.e., spring stiffness and mounting position, of the compliant element added to it. Therefore, the spring parameters can be determined independently for each axis:  
\[\min\{E(\boldsymbol{\theta}_{j},k_{j})\}=\min\left\{\sum_{j=1}^{n}E_{j}( \boldsymbol{\theta}_{j},k_{j})\right\}=\sum_{j=1}^{n}\min\left\{E_{j}( \boldsymbol{\theta}_{j},k_{j})\right\} \tag{12}\]  
The optimal design of the springs is determined by solving \(n\) sub optimizations. For simplicity of representation we are discussing the case in which a spring is added in parallel with all the actuated system joints. However, a reduction of the energy consumption can be obtained also adopting a small number of springs \(n_{s}\), i.e., \(0<n_{s}\leq n\), as shown in Section 4.2.