# Real-Time FPGA-Based Balance Control Method for a Humanoid Robot Pushed by External Forces
## 3 FPGA-Based Balance Control Method
### Trajectory Planning  
The trajectory planning module is proposed and implemented to determine the stepping trajectories \(P=(P_{RA},P_{LA})\) based on the obtained capture point \(x_{Sup}\) by the push recovery balance control module. When a humanoid robot is subjected to a sufficiently strong external force to make it impossible to balance in a standing posture, like a human, the robot will take a step to maintain its balance and prevent it from falling. As shown in Figure 8a, when the robot receives an external force from its back in the standing posture, the forward balance strategy is executed. The robot's right foot is on the floor but its left foot lifts and swings forward one step, as shown in Figure 8b. Similarly, as shown in Figure 9a, when the robot receives an external force from its front in the standing posture, the backward balance strategy is executed. The robot's right foot is on the floor but its left foot lifts and swings backward one step, as shown in Figure 9b. The central pattern generators (CPGs) based on a simplified coupled linear oscillator model are adopted for producing the stepping gait to design the desired stepping trajectories \(P=(P_{RA},P_{LA})\) through the simplified sinusoidal function. All sets of coordinates represent the relative positions of different oscillators to the position of the waist \(P_{W}\), which is denoted as the origin. \(P_{RA}\) and \(P_{LA}\) are respectively the positions of the right foot and the left foot in the space and described by  
\[P_{RA} =osc_{RA}+p_{RA}^{0} \tag{11}\] \[=(osc_{RA}^{x},osc_{RA}^{y},osc_{RA}^{z})+(0,-d_{y},-d_{z})\]  
and  
\[P_{LA} =osc_{LA}+p_{LA}^{0} \tag{12}\] \[=(osc_{LA}^{x},osc_{LA}^{y},osc_{LA}^{z})+(0,d_{y},-d_{z})\]  
where \(osc_{RA}\) and \(osc_{LA}\) are the trajectory oscillators on the right and left ankle, respectively. \(p_{RA}^{0}\) and \(p_{LA}^{0}\) are the starting points of the right and left ankle, respectively. \(d_{y}\) is the distance between the position of the waist \(P_{W}\) and the hip joint. \(d_{z}\) is the distance between the hip joint and the ankle joint. Moreover, these two trajectory oscillators \(osc_{RA}=(osc_{RA}^{x},osc_{RA}^{y},osc_{RA}^{z})\) and \(osc_{LA}=(osc_{LA}^{x},osc_{LA}^{y},osc_{LA}^{z})\), are represented by  
\[osc_{RA}^{x}=\left\{\begin{array}{cl}0,&\quad\quad\quad\quad\quad\quad\quad \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad  
and  
\[osc^{y}_{RA}=\left\{ \begin{array}{cl}0,&if\ t\in[0,\gamma\frac{T}{2})\\ \rho^{y}_{RA}\sin(\omega^{y}_{RA}(t-\frac{T}{2}\gamma)+\varphi^{y}_{RA}),&if\ t \in[\gamma\frac{T}{2},T-\gamma\frac{T}{2})\\ 0,&if\ t\in[T-\gamma\frac{T}{2},T)\end{array} \right. \tag{14}\]  
\[osc^{z}_{RA}=\left\{ \begin{array}{cl}0,&if\ t\in[0,\gamma\frac{T}{2})\\ \rho^{z}_{RA}\sin(\omega^{z}_{RA}(t-\frac{T}{2}\gamma)+\varphi^{z}_{RA}),&if\ t \in[\gamma\frac{T}{2},T-\gamma\frac{T}{2})\\ 0,&if\ t\in[T-\gamma\frac{T}{2},T)\end{array} \right. \tag{15}\]  
\[osc^{x}_{LA}=\left\{ \begin{array}{cl}0,&if\ t\in[0,\gamma\frac{T}{2})\\ \rho^{x}_{LA}\sin(\omega^{x}_{LA}(t-\frac{T}{2}\gamma)+\varphi^{x}_{LA}),&if\ t \in[\gamma\frac{T}{2},T-\gamma\frac{T}{2})\\ \rho^{x}_{LA},&if\ t\in[T-\gamma\frac{T}{2},T)\end{array} \right. \tag{16}\]  
\[osc^{y}_{LA}=\left\{ \begin{array}{cl}0,&if\ t\in[0,\gamma\frac{T}{2})\\ \rho^{y}_{LA}\sin(\omega^{y}_{LA}(t-\frac{T}{2}\gamma)+\varphi^{y}_{LA}),&if\ t \in[\gamma\frac{T}{2},T-\gamma\frac{T}{2})\\ 0,&if\ t\in[T-\gamma\frac{T}{2},T)\end{array} \right. \tag{17}\]  
\[osc^{z}_{LA}=\left\{ \begin{array}{cl}0,&if\ t\in[0,\gamma\frac{T}{2})\\ \rho^{z}_{LA}\sin(\omega^{z}_{LA}(t-\frac{T}{2}\gamma)+\varphi^{z}_{LA}),&if\ t \in[\gamma\frac{T}{2},T-\gamma\frac{T}{2})\\ 0,&if\ t\in[T-\gamma\frac{T}{2},T)\end{array} \right. \tag{18}\]  
where \(t\) is the time and \(T\) is a period of time. \(\gamma\), \(\rho\), \(\omega\), and \(\varphi\) are the double support phase ratio, the amplitude, the frequency, and the starting phase of oscillator parameters, respectively.