## 3 Leg Control Based on Human Motion Prediction Using Motion Sensor  
Figure 4 shows the overview of the proposed controller using motion sensors for our powered exoskeleton. The powered exoskeleton recognizes the wearer's motion to assist him/her. It estimates in advance by a few hundred milliseconds the future joint angles of the powered exoskeleton according to the recognized motion to assist the wearer in real time. The motion estimation and the calculation of the desired joint angles of the powered exoskeleton are based on a motion database compiled in advance. This database is composed of sequential data of the wearer's motion, the label of the motion, and the corresponding leg motion of the powered exoskeleton. The joint angles of the legs of the powered exoskeleton are controlled to be estimated based on the database by PID controllers. Figure 3: The shoe for the wearer, the foot of the powered exoskeleton, and the force sensor attached to both. Figure 2: Motion sensors attached to the body of the wearer, and the definition of the axes. The database includes sequential data from motion sensor attached to the wearer as feature vectors, each with motion class label \"standing\", \"walking forward\", or \"walking backward\", and the joint angles of the powered exoskeleton as the wearer exhibited the relevant motion. The data of the motion sensors are angles \(\mathbf{\theta}=(\theta_{rt},\theta_{rt},\theta_{lt},\theta_{ll})\), angular velocities \(\dot{\mathbf{\theta}}=(\dot{\theta}_{rt},\dot{\theta}_{rl},\dot{\theta}_{lt},\dot {\theta}_{ll},\dot{\theta}_{ub})\), and acceleration rates \(\mathbf{a}=(a_{rt},a_{rl},a_{lt},a_{ll},a_{ub})\). Indices \(rt\), \(rl\), \(lt\), \(ll\), and \(ub\) indicate the upper-right leg, the lower-right leg, the upper-left leg, the lower-left leg, the lower-left leg, and the torso, respectively. The joint angle of the powered exoskeleton is defined as \(\mathbf{\phi}=(\phi_{rw},\phi_{rk},\phi_{lr},\phi_{lk})\). Indices \(rw\), \(rk\), \(lw\), and \(lk\) indicate the right hip, the right knee, the left hip, and the left knee of the powered exoskeleton, respectively. The wearer's motion dataset is defined by piecewise sequences of \(\mathbf{x}_{t}=(\mathbf{a}_{t},\dot{\mathbf{\theta}}_{t},\mathbf{\theta}_{t})\), where \(t\) is the time index. Sequential motion data \((\mathbf{x}_{1},\mathbf{x}_{2},\cdots)\) are segmented using a window of size \(m\) into sequence data \(\mathbf{X}_{t}=(\mathbf{x}_{t},\mathbf{x}_{t+1},\cdots,\mathbf{x}_{t+m})\). The sequence dataset is assigned one of the three motion category indices of \"standing\" \(c_{s}\), \"walking forward\" \(c_{w}\), and \"walking backward\" \(c_{b}\). It is also assigned the joint angles of the powered exoskeleton at time \(t+\Delta t\), \(\mathbf{\phi}_{t+\Delta t}\). A dataset in the motion database is composed of the wearer's motion dataset, the motion category, and the joint angles of the powered exoskeleton, \((\mathbf{X}_{t},c_{i},\mathbf{\phi}_{t+\Delta t})\), where \(c_{i}\) is one of \(c_{s}\), \(c_{w}\), and \(c_{b}\). The database \(D\) is composed of the set of datasets \(D=\{(\mathbf{X}_{t}^{0},c_{i}^{0},\mathbf{\phi}_{t+\Delta t}^{0}),(\mathbf{X}_{t}^{1},c_{i }^{1},\mathbf{\phi}_{t+\Delta t}^{1}),\cdots\}\). The powered exoskeleton recognizes the wearer's motion using the k-nearest neighbors method on the database \(D\). We choose the k-nearest neighbors algorithm because it is one of the non-parametric methods that do not make some specific assumption about the motion of the human or the powered exoskeleton and it is the simplest algorithm and works in real time for our application. Motion data of the wearer at time \(t\) are defined as \(\mathbf{x}_{t}=(\mathbf{a}_{t},\dot{\mathbf{\theta}}_{t},\mathbf{\theta}_{t})\). Query sequential data with window size \(m\) are defined as \({}^{q}\mathbf{X}=(\mathbf{x}_{t},\mathbf{x}_{t+1},\cdots,\mathbf{x}_{t+m-1})\).