Online Gait Detection with an Automatic Mobile Trainer Inspired by Neuro-Developmental Treatment

This paper demonstrates the development of an automatic mobile trainer employing inertial movement units (IMUs). The device is inspired by Neuro-Developmental Treatment (NDT), which is an effective rehabilitation method for stroke patients that promotes the relearning of motor skills by repeated training. However, traditional NDT training is very labor intensive and time consuming for therapists, thus, stroke patients usually cannot receive sufficient rehabilitation training. Therefore, we developed a mobile assisted device that can automatically repeat the therapists’ intervention and help increase patient training time. The proposed mobile trainer, which allows the users to move at their preferred speeds, consists of three systems: the gait detection system, the motor control system, and the movable mechanism. The gait detection system applies IMUs to detect the user’s gait events and triggers the motor control system accordingly. The motor control system receives the triggering signals and imitates the therapist’s intervention patterns by robust control. The movable mechanism integrates these first two systems to form a mobile gait-training device. Finally, we conducted preliminary tests and defined two performance indexes to evaluate the effectiveness of the proposed trainer. Based on the results, the mobile trainer is deemed successful at improving the testing subjects’ walking ability.


Introduction
Stroke is the second leading cause of death in the world [1], with a case occurring about every two seconds [2]. Stroke accounts for nearly 34 billion US dollars in medical costs each year in the USA [3]. The survivors usually suffer inconvenience in their daily lives and need lengthy rehabilitation to recover their abilities, such as walking by themselves. Several lower-limb rehabilitation devices have been proposed to help improve patients' walking ability. For example, Colombo et al. [4] designed a driven gait orthosis to guide a patient's legs on a moving treadmill. Similarly, Schmidt et al. [5] proposed the HapticWalker with programmable footplates for wheelchair-mobilized patients. Wang et al. [6] developed an active gait trainer that can actively guide the user's ankles by motors with six bar linkages. Patton et al. [7] designed the KineAssist for gait and balance training. Esquenazi et al. [8] proposed the powered ReWalk exoskeleton that allowed the user to walk without human assistance. Schmitt et al. [9] presented the MotionMaker that had two orthoses with motors and sensors to control leg movements according to the desired positions and speeds. Bradley et al. [10] developed the NeXOS for the lower limbs of supine patients. Belforte et al. [11] designed an active gait orthosis with electro-pneumatic ESP-01 for receiving gait information and an Arduino Mega2560 [22] to record the gait data and to trigger the motor control system. The motor control system is composed of an Arduino Mega2560 to imitate the therapists' intervention patterns, two MPK569-2.8A motors [23] to provide cuing forces through ropes, and two MLP-200 load cells [24] to measure the applied forces for feedback control. Note that we apply two Arduino Megas at the gait detection system and the motor control system so that these two systems can be operated at different sampling rates.
The movable mechanism integrates the gait detection system and the motor control system. It has four casters so that the subject can push the trainer forward when receiving training. It is also equipped with an adjustable handle and a belt for safety. The ropes connect the motors to the user's pelvis to guide the user based on the therapists' intervention patterns. The system specifications are illustrated in Table 1.

Gait Detection System
The gait detection system contains two measurement units and one data logging unit, as shown in Figure 2. The wearable measurement units are attached to the subject's shanks to obtain the user's kinematic data and to estimate the important gait events. The gait information is then transmitted to the data logging unit, which records the gait data and sends triggering signals to the motor control system to imitate the therapists' intervention.

Gait Event Estimation
Human gaits are regular and periodic. A complete gait cycle is defined as a period from the heel strike (HS) to the next HS of the same leg, as shown in Figure 3 [13]. A gait cycle normally consists of about 60% stance phase and 40% swing phase, with the following three important gait events: mid-swing (MS), HS, and toe-off (TO). The gait detection system measures the gait data and estimates these gait events in real time, in order to decide the intervention timing. We applied IMU to measure the angular velocity of the shank on the sagittal plane [30,31], i.e., the Y-axis in Figure 4a. The typical angular velocity responses during a complete gait phase is illustrated in Figure 4b, where the MS usually occurs with the maximum angular velocity during the gait cycle. Conversely, the HS usually happens when the angular velocity has the first negative trough after the MS, while the TO is usually associated with the negative trough before the next MS. Note that the placement of IMU sensors might affect the magnitudes of the signals because of vector projection. However, the characteristics of gait events remains the same. Therefore, we developed the following algorithms to estimate the three gait events. 1.
The MS event The MS usually accompanies the maximum angular velocity in the gait cycle. As shown in Figure 4b, we set a threshold TH ω MS = 60 • /s and mark the point as the MS if its angular velocity ω is locally maximum and greater than this threshold, as follows: The HS event The HS usually happens with the first negative trough after the MS, as shown in Figure 4b. Therefore, we set two thresholds, TH ω HS and TH t HS , to identify the HS event. The gait phase is estimated as HS if the following three conditions are satisfied: (1) The angular velocity ω reaches a local minimum.
(2) The angular velocity ω is less than TH ω HS , i.e., ω < TH ω HS . (3) The time interval between MS and HS, labelled as ∆t MS HS , is greater than TH ω HS , i.e., ∆t MS HS > TH t HS .
Referring to Figure 4b, we set TH ω MS = −5 • /s and TH t HS with an initial value of 0.042 s, which is the sampling time of the system; that is, the HS should be at least one sample after the MS. Note that TH t HS is adjustable because the patient's paretic leg might have abnormal trembles and vibration during walking. The HS event can be easily identified in healthy subjects, as shown in Figure 4b. However, a stroke patient might have an uneven gait, as shown in Figure 5a, which can cause difficulties in identifying the HS event. For example, the first HS was correctly labelled as HS1, but the second HS was wrongly labelled as HS2 because a positive peak occurred afterward (i.e., the actual HS should be HS2'). Similarly, the third HS was wrongly labelled at HS3, while the correct one should be HS3'. To correct these potential errors, the threshold TH t HS was adjusted as follows: where n represents the number of positive peaks after the labelled HS, while T is the sampling time (0.042 s). For instance, one positive peak (n=1) was evident between HS2 and the next TO, so that TH t HS should be modified to TH t HS = 0.042 + 1 × 0.042 = 0.084s. Similarly, one positive peak (n = 1) occurred between HS3 and the next TO, so that TH t HS should be adjusted to TH t HS = 0.084 + 1 × 0.042 = 0.126 sec. The online adjustment of TH t HS is shown Figure 5b. Using the adjustment algorithm, the HS events afterward were all correctly identified. Note that TH t HS was reduced by one sample if the HS was not successfully identified.

The TO event
The TO event happens after the HS and normally with the minimum angular velocity within one gait cycle. We defined two thresholds, TH ω TO and TH t TO , to estimate the TO events. The gait event is labelled as a TO if the following two conditions are satisfied: (1) The angular velocity ω is less than TH ω TO , i.e.,ω < TH ω TO . (2) The time interval between HS and TO, labelled as ∆t HS TO , is greater than TH t TO , i.e., ∆t HS TO > TH t TO .
Referring to Figure 4b, we set TH ω TO = −35 • /s and let TH t TO adjustable to improve the estimation accuracy. Because TO usually occurs with the last negative trough before the next MS, we adjust TH t TO as follows: where ∆t represents the time interval between the labelled TO and the last negative trough before the next MS. The initial value of TH t TO was set to TH t TO = 2 × T = 0.084 s, i.e., the quickest TO should be at least two samples after the HS. Figure 6a shows the identification of the TO events. First, TO1 was correctly identified, but TO2 was labelled incorrectly in real time because a smaller trough (TO2') appeared before MS3. The identification of MS3 made us realize that the correct TO should be TO2'. Because ∆t HS TO between HS2 and TO2 was measured as 0.126 s (three samples), while ∆t between TO2 and TO2' was measured as 0.504 s (12 samples), we adjusted TH t TO to TH t TO = 0.084 + (0.504 − 0.126)/2 = 0.273. The online adjustment of TH t TO is shown in Figure 6b. Using the adjustment algorithm, the TO events afterward were all correctly identified.
The system also calculated the average stride time of the previous three gait cycles and set it as an upper limit for TH t HS and TH t TO .

Implementation and Tests
The gait detection system applies these algorithms to detect the three gait events (MS, HS, and TO) sequentially, as shown in Figure 7. We invited two stroke patients to participate in experiments. Their information is shown in Table 2. Each patient walked about 600 steps in 12 min. The testing results are shown in Figure 8. First, the gait of the healthy legs, as shown in Figure 8a,c, were regular and easy to identify. By contrast, the gait of the paretic legs contained certain noises and vibration, as shown in Figure 8b,d. Second, using our detection algorithms, the detection system could correctly identify both subjects' gait events during walking. Third, the automatic adjustments of TH t HS and TH t TO are shown in Figure 9, where the parameters on the paretic side were adjusted more frequently than on the healthy side because the paretic legs tended to have abnormal tremble and vibration during walking.   We checked the effectiveness of the gait detection system by comparing its results with a VZ4000 motion capture system [18]. The successful rate of the gait detection system is defined as follows: where N step-total is the total steps obtained by the VZ4000 motion capture system, while N step-detected is the number of detected HS by the proposed detection system in real time. We emphasized the detection of the HS because the automatic trainer begins the intervention upon detecting HS, as described in [16]. The walking patterns and gait parameters varied significantly in individuals. The proposed algorithms can automatically adjust the parameters, as shown in Figure 9. We set the initial values of these parameters based on the experimental data (see Figure 4b), and applied the algorithms to make real-time adjustment of the parameters for individual users. Based on this automatic adjustment, the successful rates are shown in Table 3, where the gait detection system achieved a successful rate of more than 95%. That is, it can correctly identify the HS events for triggering the motor system to repeat the therapists' intervention, as introduced in Section 4.

Motor Control System
The trainer is designed to repeat the therapists' intervention using ropes. As observed in [16], the therapists applied forces on the anterior superior iliac spine (ASIS) when they perceived the patients' HS on the opposite sides. Therefore, the motor control system was designed to act as follows: pulling the right (left) ASIS when detecting the left (right) HS. In addition, the intervention force patterns were approximated as sinusoidal signals [30]. Therefore, we can control the motors to track the following force commands when detecting the HS: where F max and F min , respectively, represent the maximum and minimum applied forces and f is the intervention frequency. Table 4 illustrates the parameter settings for P2. Note that these parameters can be varied for different individuals. The block diagram of the motor control system is shown in Figure 10, where G(s) represents the motor system. The identification and control design for the motors are illustrated in Appendix A. We repeated the identification experiments ten times, while considering system variation and human disturbances during NDT training. We then applied the gap metric to select the following nominal plant for the control design: G(s) = −16.95s + 351.9 s 2 + 38.9s + 114.7 The robust loop-shaping techniques were applied to design the following controller, as illustrated in Appendix A, to control the motors for imitating the therapists' intervention patterns: We then designed the following pre-compensator C pre (s) to amend the phase lag: C pre (s) = 0.143s + 0.4 0.0709s + 1 (8) Figure 10. Block diagram of the motor control system.
Before conducting clinical experiments, we tested the motor control system by attaching the ropes to a subject. The detection system sent triggering signals to the motor control system when it detected the HS events. The motors, when receiving the triggering signals, began to track the sinusoidal commands then followed a minimum force of 1 lb to keep the ropes straight. Note that the motors would follow a force command of 1 lb if the system failed to detect the HS events. This small force would not harm the users. The testing results are shown in Figure 11, where the motors successfully followed the force commands with a RMSE of 0.6464 lb. That is, the designed robust control can effectively repeat the therapists' intervention patterns even when user disturbances were introduced during NDT training. Therefore, we invited five subjects to participate in experiments, as shown in the next section.
Sensors 2020, 20, x FOR PEER REVIEW 12 of 21 Before conducting clinical experiments, we tested the motor control system by attaching the ropes to a subject. The detection system sent triggering signals to the motor control system when it detected the HS events. The motors, when receiving the triggering signals, began to track the sinusoidal commands then followed a minimum force of 1 lb to keep the ropes straight. Note that the motors would follow a force command of 1 lb if the system failed to detect the HS events. This small force would not harm the users. The testing results are shown in Figure 11, where the motors successfully followed the force commands with a RMSE of 0.6464 lb. That is, the designed robust control can effectively repeat the therapists' intervention patterns even when user disturbances were introduced during NDT training. Therefore, we invited five subjects to participate in experiments, as shown in the next section.

Experimental Results
We invited five subjects, including three healthy subjects and two stroke patients, to test the mobile trainer. The information of these subjects is illustrated in Table 2 and Table 5. All subjects were informed of the purpose of the study and signed the informed consent document approved by Human Subject Research Ethics Committee of Institutional Review Board (IRB) [32] before participating. A rehab gaiter was applied to the healthy subjects to limit the joint movement of one knee, so that they would imitate the stroke gaits and receive training by the trainer. The stroke patients were selected based on the following criteria: (1) a Brunnstrom Stage (BS) [33]

Experimental Results
We invited five subjects, including three healthy subjects and two stroke patients, to test the mobile trainer. The information of these subjects is illustrated in Tables 2 and 5. All subjects were informed of the purpose of the study and signed the informed consent document approved by Human Subject Research Ethics Committee of Institutional Review Board (IRB) [32] before participating. A rehab gaiter was applied to the healthy subjects to limit the joint movement of one knee, so that they would imitate the stroke gaits and receive training by the trainer. The stroke patients were selected based on the following criteria: (1) a Brunnstrom Stage (BS) [33]   Each subject received the tests by the following A-B-A procedures, where A, B, and A represent before treatment, during treatment, and after treatment, respectively. The subjects first walked by themselves for about 3 min (A), then received NDT training by the trainer for about 6 min (B), and finally walked by themselves for about 3 min (A). We recorded their gait data to analyze the effects of the trainer intervention.
Because gait symmetry is critical for post-stroke walking rehabilitation, we defined the following two performance indexes to evaluate the effectiveness of rehabilitation: (1) Ratio of the swing time [36]: The ratio of the swing time is defined as follows [36]: where T SW (P) and T SW (NP) represent the swing time on the paretic and non-paretic side, respectively. The swing time is defined as a time interval from TO to the next HS on the same side. The swing time of two legs is usually symmetrical for healthy persons, but tends to be uneven for stroke patients because of hemiparalysis. Therefore, the rehabilitation training is said to be effective if the swing time is more symmetric, i.e., R SW is closer to one [37]. (2) Asymmetry of the swing phase [38]: The asymmetry of the swing phase is defined as follows: where P SP (P) and P SP (NP) represent the proportion of the swing phase on the paretic side and the non-paretic side, respectively. The proportion of the swing phase is defined as: (11) in which T gait is the duration of one complete gait cycle, while T SW is the swing time of that gait cycle. For healthy persons, their gaits are usually symmetric and the swing time takes about 40% of the complete gaits on both sides. By contrast, stroke patients tend to have a deviation on the paretic side because of hemiparalysis. Therefore, we can use Asym SP to evaluate the impacts of the training. The rehabilitation training is said to be effective if Asym SP approaches zero.
We used the two indexes to analyze the testing subjects' gaits at different stages. The experimental results are shown in Figure 12. First, R SW tended to be a value of one and Asym SP tended to be a value of zero at both the B and A stages. That is, the training has positive influences on these subjects and the effects could endure after the treatments. Second, the statistical data of Figure 12 are illustrated in Table 6, where the numbers in bold indicate improvements. Note that R SW almost exceeded a value of one for all subjects because the paretic/restricted side tended to be weak and shortened the swing time on the opposite side. Third, R SW was, in general, improved by the training, except for subject P2, who already had a good recovery in gait symmetry, as indicated by R SW = 0.9880 at stage A. Therefore, the treatment did not have significant effects on P2. Similarly, Asym SP was generally improved by the training, again except for subject P2, who had already achieved Asym SP = −3.1273% at stage A. Lastly, the results showed that the automatic trainer had a positive influence on almost all subjects, i.e., their gait symmetry was generally improved by the mobile trainer.

Conclusions
This paper has demonstrated a mobile trainer designed to help with rehabilitation training of stroke patients. The device consisted of a detection system, a motor control system, and a movable mechanism. First, the detection system was equipped with two measurement units and one data logging unit. The former detected the subjects' gait data, while the latter transmitted and recorded the data. Gait estimation algorithms were then developed to identify three important gait events: MS, HS, and TO. Second, we conducted clinical NDT training by therapists and recorded the data to describe the therapists' facilitation patterns. The motor control system was then designed to reconstruct these patterns. Lastly, the detection system and the motor control system were integrated on a movable mechanism, so that the users can move at their own preferred speeds during the training. We conducted experiments and defined two performance indexes to evaluate the effects of the proposed trainer. Based on the results, the automatic trainer was shown to improve the subjects' walking ability. In the current study, we set strict criteria in recruiting subjects who should be in stable states of stroke and have no other musculoskeletal problems in order to reduce the risk of injuries during the experiments. In the future, we plan to invite more stroke subjects with varieties of gait deficits to participate in more ambulation training to evaluate the long-term rehabilitation effects.  From Figure A1d, we can note the model variation, which might be caused by system nonlinearities and operation conditions. Because robust control can cope with system uncertainties, we applied robust control techniques to guarantee system stability and performance. Suppose a nominal plant G with the following left coprime factorization (LCF) [40]: where M, N ∈ RH ∞ and M M * + N N * = I. Assume a perturbed plant G ∆ can be represented as follows: where ∆ M , ∆ N ∈ RH ∞ . The gap between the nominal plant and the perturbed plant can be defined as: the smallest value of ∆ N ∆ M ∞ < ε which perturbs G into G ∆ , denoted by δ(G, G ∆ ). Therefore, we can select the nominal plant from the ten transfer functions by the following equation: which gave δ(G, G i ) ≤ 0.1140. The nominal plant was set to minimize the maximum gaps between plants. The gap can be regarded as the maximum model variation during operations.
The closed-loop system with the controller K and the perturbed plant G ∆ is shown in Figure A2a, which can be arranged as in Figure A2b. From the Small Gain Theorem [41,42], the closed loop system is internally stable for all perturbation with ∆ N ∆ M ∞ ≤ ε if and only if: Hence, we can define the stability margin b(G, K) as:  System performance can be considered by loop-shaping techniques [43,44] with suitable weighting functions, based on the following principles: (1) increasing system gains at the low frequency for disturbance rejection; (2) decreasing system gains at high frequency for noise attenuation; (3) limiting the slope of the magnitude plot less steep than -40 dB/decade around cross-over frequency for stability.
We finally selected the following weighting function by iteratively adjusting the weighting function and verifying the system performance: The Bode plot of the shaped plant is shown in Figure A3a. The corresponding robust controller was designed as follows: K ∞ (s) = −2.801s 3 − 201.5s 2 − 3991s − 14390 s 3 + 103.9s 2 + 7049s + 40320 (A8) with stability margin b(WG, K ∞ ) = 0.3362, which was greater than the system gap of 0.1140 and guaranteed system stability during operation. The Bode plots of the plants are shown in Figure A3. System performance can be considered by loop-shaping techniques [43,44] with suitable weighting functions, based on the following principles: (1) increasing system gains at the low frequency for disturbance rejection; (2) decreasing system gains at high frequency for noise attenuation; (3) limiting the slope of the magnitude plot less steep than -40 dB/decade around cross-over frequency for stability.
We finally selected the following weighting function by iteratively adjusting the weighting function and verifying the system performance: The Bode plot of the shaped plant is shown in Figure A3a. The corresponding robust controller was designed as follows:  The designed weighted robust controller K = WK ∞ was implemented to control the motor system. The Bode plot of the closed-loop system is shown in Figure A3b, where the phase-lag (e.g., 42 • at the frequency of 1 Hz) might cause unsynchronized responses during the training. Therefore, we designed the following phase-lead pre-compensator (see Figure 10) to compensate this phase lag: C pre (s) = 0.143s + 0.4 0.0709s + 1 (A9) which gave a phase lead of about 42 • at the frequency of 1 Hz, so that the closed-loop responses will not have phase delay.