Abstract
Training with use of mechatronic devices is an innovative rehabilitation method for patients with various locomotor dysfunction. High efficiency of training is noted in systems that combine a treadmill or orthosis with a body weight support system. Speed control is a limitation of such rehabilitation systems. In commercially available devices, the treadmill speed is constant or set by the therapist. Even better training results should be obtained for devices in which the speed of the treadmill will be automatically adjusted to the patient walking pace. This study presents a mechatronic device for locomotor training that uses an algorithm to adjust the speed of the treadmill. This speed is controlled with use of a sensor that measures the rope inclination. The end of rope is fastened to the orthopaedic harness. Speed control is realized in such a way that ensures the smallest possible swing angle of the rope. A fuzzy controller was applied to adjust the treadmill speed. The drive system of the treadmill is equipped in a servodrive with PMSM motor and energy recovery module, which allows smooth speed control, limiting acceleration and minimizing electricity consumption. The presented solution was implemented in a real object and subjected to experimental tests.
Introduction
The fact that treadmill workout is useful in the rehabilitation process has already been proven at numerous occasions. High repeatability of the exercises allows the patients to quickly recover the ability to move independently [1]. In recent years, walking re-education has used technologically advanced equipment, where the treadmill co-operates with body weight support systems (BWS) [12, 26]. These devices reduce the weight of the exercising person and facilitate the work of the therapist.
In numerous publications, researchers have confirmed the benefits in walking speed and number of steps after treadmill training and BWS [3, 35]. In patients with hemiparesis after stroke, progress in the gait rehabilitation process is more effectively with speed-dependent treadmill training compared with treadmill training without speed increases. It is closely related to increasing the repetition of exercises. During a single training session with treadmill, a patient can perform much more repetitions of a given exercises than in the traditional training with a physiotherapist. High repeatability translates into faster establishing of walk patterns [21].
Unfortunately, there is a concern that a too fast treadmill training gait speed may cause abnormal gait patterns and should not be conducted for patients whose fast gait speed results in a markedly unstable gait [39].
The review of currently used devices equipped with treadmill and body weight support systems demonstrates that the speed of the treadmill during training is determined by the physiotherapist. This can be uncomfortable for the patient and disadvantageous to some extent. Improved the functionality of such devices may be achieved by developing an algorithm that will automatically control the speed of the treadmill on which the patient is walking [22].
Treadmill speed adjustment is already used in some devices, although it is realized by various methods. The control systems used in treadmills with automated speed control may be classified according to the measured parameters of the exercising person [30]. The first (and most common) solution applied in commercially available sport treadmills is controlling the speed of the treadmill based on the position of the person doing the workout. Sensors used to identify the position of the person include ultrasound sensors [25], optical movement detection systems [20] and depth sensors [42]. Ultrasound sensors placed in front of the treadmill do not guarantee accurate and reproducible measurements due to the presence of interference and low measurement resolution. The stability of measurements of an ultrasound sensor may be improved, for example, by applying Kalman filters and sliding mode control 10,19]. As far as optical methods are concerned, there are certain solutions that employ advanced movement analysis systems based on video cameras, as well as simple solutions based on optical sensors that detect the position of the exercising person at several points [15]. The position of the person may also be measured with use of infrared sensors or rope sensors [32]. Another, slightly different solution that allows us to estimate the position of the patient is the application of pressure sensors located under the treadmill belt [5].
The second method used in automatic control of treadmill speed is based on measuring the force of inertia that occurs at the moment when the exercising person starts to accelerate or slow down [29, 43]. Literature also described methods of treadmill speed control that consist of real-time analysis of the kinematics of gait. This analysis refers e.g. to the duration of individual phases of gait or the trajectory of feet movement. However, the exercising person has to wear additional elements, such as markers or shoes with sensors [36].
Particularly interesting methods of controlling treadmill speed are biomechatronic solutions that measure physiological parameters. These solutions use a feedback loop between the equipment and the measured physiological parameters of the patient –usually the heart rate results [33, 37].
However, the presented strategies are available in running treadmills and cannot be applied in walking therapy supported by body weight support systems, because the patient’s range of movement is significantly limited by rope of BWS system. Also the large displacement and large inclination of rope are connected with the adverse impact of the weight-relief force on gait reeducation process.
This article presents a new method of controlling treadmill speed intended for gait reeducation devices with body weight support system. This method is based on measuring the angle of swing of the rope fastened to the BWS system, through which the weight load of the patient is reduced. The system autonomously adjusts the treadmill speed in order to synchronize it with the walking speed of a patient. Treadmill speed adaptation system allows the patient to train gait with as high as possible but at a comfortable pace. We can treat it as a kind of optimization of training speed for the patient’s abilities. This change of treadmill speed must be done in a smooth and safe way, without adverse overshoot and oscillations of the rope. Due to the relief of the patient by the BWS system (the tension of the rope is the external load of the patient), the rope should be kept in a vertical position with as little deflection as possible. In addition, the system should be easy to operate by personnel in the rehabilitation center. It should also allow for adjusting the dynamics to the individual preferences of the patient. Assuming difficulties with modeling the patient’s gait and its unpredictable behavior, developing an effective and stable system of treadmill speed adaptation was an interesting engineering challenge. In the proposed control system a fuzzy logic controller was used to adapt the speed of the treadmill.
Developed treadmill speed adaptation system has been tested by the authors on mechatronic device for gait reeducation. The construction of a mechatronic system for gait re-education was also presented, with particular emphasis on the modernization of the treadmill drive system. The implemented modifications were beneficial both in terms of treadmill dynamics control as well as pro-ecological aspect.
Mechatronic device for gait reeducation
The locomotor training device used in this study (Fig. 1) is a combination of two main components: the body weight support system and a treadmill. These components may operate independently, but the full functionality of the equipment is achieved by combining them. In order to do so, real time charts were used. As opposed to similar devices that have been commercially available so far, in the locomotor training equipment presented here, the trolley with the body weight support system may follow the lateral displacements of the patient. The device is equipped with measurement systems designed by the authors –weight-support force sensor and sensor of the swing angle of the rope. These sensors generate an analogue measurement signal 0±10 V, which is recorded by the signal conditioning interface. The mechatronic walking reeducation equipment operates in real time mode, at a calculation step of 0.01 s. The control system was developed in the MATLAB environment. The system consists of algorithms controlling:

Mechatronic treadmill for gait reeducation.
the body weight support system, the trolley tracking system following the patient’s movements in lateral axis, the treadmill speed.
Additionally, the device was equipped with safety systems, such as: limit switches, speed limiters and automatic fall detection. A more detailed description of the device was presented in the research [13].
The body weight support system, which aim is to reduce the weight of the patient at any predefined force, was equipped with two motors operating independently (Fig. 2). The first drive, marked as Z1, is responsible for winding the rope around the drum, while the other one (linear Z2 drive) is connected to the dynamic compensation system. The system works as a Series Elastic Actuator drive. The system controlling the body weight support system was described in the study [14]. What is important is the fact that the system ensures that the patient’s weight is reduced at a defined force, regardless of the position of the patient. For large displacements, the Z1 drive guarantees unwinding or winding the rope. As a result, the person may perform obstacle training (e.g. with stairs) and move even at very high swing angles of the rope.

Geometrical model of body weight support system.
The BWS system was equipped in an authored measuring system for measuring the angle of the rope inclination. The idea is based on measuring in the Cartesian coordinate system the point of intersection of rope in horizontal plane, positioned away by a known distance from the so called fixed point. The fixed point in this particular example is an opening of a set position, through which the rope is crossing (behind the last pulley). The fixed point is placed in an angle iron with strain gauges bonded, used for measuring the force.
By measuring the movement of the saddle allows indirectly to determine the angle of the rope inclination. The device was equipped in a planar system that allows measuring the movement in two perpendicular directions. The carriage has a ball joint installed, through which a rope crosses, making the whole arrangement move. Inductive transformer sensors with measurement range 30 mm were used to measure the linear movements. The arrangement was configured to attain the measurement up to 5°. Standard inclination of the measurements equals about 0.2°. The measuring system is presented in Fig. 3.

The device for measuring a rope inclination angle.
The first version of the equipment used a commercially available workout treadmill, which speed was controlled by pushing the buttons to reduce or increase the speed. To automate the control process, a digital controller was developed to operate the buttons located on the control panel of the treadmill. This solution was presented in [13]. However, the disadvantage of that equipment was limited dynamics of the treadmill. The speed change took place with a significantly limited acceleration and large delay. Due to the above, the drive system of the treadmill was modernized. The original motor was removed and replaced by an energy saving and high efficiency PMSM servo motor with a nominal rotational speed n = 2000 rpm. The belt drive responsible for the movement of the roller driving the treadmill belt was modified. Additionally, the 7:1 ratio APEX DYNAMIX PB115 planetary gear system was installed between the motor and the belt drive. After these modifications, the treadmill may reach a speed of approx. 3 km/h, which is sufficient for rehabilitation purposes. A geometrical model of the driving system after the modifications is presented in Fig. 4. The actual device is shown in Fig. 5.

The treadmill drive system- geometrical model of the modificated treadmill drive system.

Treadmill drive system after modernization.
The aim of the present study was to develop and optimize a system controlling the speed of a treadmill in a mechatronic walking reeducation device. Creating a numerical model of the whole walking reeducation device that would be useful in the optimisation process required developing two models: the model of the treadmill and a model describing the gait of the patient.
Treadmill numerical model
The driving system of the treadmill was equipped with a servomotor with a synchronic permanent magnet motor. The operation of the motor is controlled by a servo inverter. The construction of dynamic models of such drives was presented, among others, in the works [17, 38]. Developing such numerical model requires estimating numerous parameters of the motor. It also requires applying very small calculation steps, which significantly extends the duration of digital simulations.
For the purposes of the present study, it was assumed that the drive system of the treadmill may be treated as a system with a single degree of freedom with a defined kinematic input. This input is consistent with the rotational speed of the motor, which may be described by a transmittance. Moreover, in order to better reflect the operations of the servomotor with the possibility to control the acceleration of the motor shaft, limitations connected with the maximum acceleration and delay of the rotational speed were imposed on the controlling signal. In the numerical model, this limitation was realized with use of a module, in which the derivative of the input signal is calculated according to the presented formula Equation (1) for the Δu i-th iteration:
If the determined value falls into the defined range <Δumin, Δumax>, then the output signal equals the input signal. If Δu (i) > Δumax, then the value of the output signal is calculated from the Equation (2):
On the other hand, when Δu (i) < Δumin, then the output signal is calculated according to Equation (3):
The coefficients of the mathematical model were selected for such adopted convention of modelling the drive system of the treadmill. The acceleration limiting parameters valueas according to the Equation (4):
The equation of the transmittance describing the rotational speed of the engine as a response to the controlling signal was defined by the Equation (5).
The forces of resistance that occur while walking on a treadmill have a negligible influence on the dynamics of the servomotor. As a result, adopting the simplifications presented above allowed us to obtain a numerical model of very good correlation and low load of the computing unit.
Developing a precise model describing the dynamics of human gait is a difficult task, especially if it involves describing the gait of disabled persons [6, 27]. Due to that, input describing the kinematics of the patient’s gait along the sagittal axis was applied for optimization calculations. The function describing the speed of the movement of the centre of mass of a disabled person was formulated based on measurement data recorded during tests at the rehabilitation centre. During the tests, the gait of ten people suffering from left and right hemiparesis after a stroke was analyzed. The measurements were conducted with use of an optoelectronic movement analysis system [16]. Each passage of the patient was recorded with two digital cameras manufactured by Basler. The movement was recorded at a frequency of 100 Hz. The patients had reflective markers attached to their spine in the area of the fifth lumbar vertebra and the first sacral vertebra. One may assume that the trajectory of movement of this point is very similar to that of the centre of mass of the subject [8]. The developed input function consisted of three phases that reflected the kinematics of gait of three different persons (the fastest gait, the slowest gait and walking with medium speed). The obtained measurement data were filtered with use of low pass filter. The course of the input signal is presented in the Fig. 6.

The gait speed input signal as a function of time.
The numerical model containing the feedback loop between the treadmill and the patient was implemented in the MATLAB Simulink environment (Fig. 7).

Numerical model of mechatronic treadmill implemented in Simulink environment.
The value of the swing angle of the rope φ was calculated with use of the arc tangent function of patient displacement divided by the height of the BWS system above the trainee, as presented in Equation (6). Considering that both models generate an output signal describing the speed in m/s, the signals were integrated first. Then the calculated virtual displacement of the patient x
p
reduced by the calculated displacement of the treadmill belt xt was used for calculations. In the actual object the swing angle of the rope depends also on the height of the patient h
p
, and first of all on the height on which the body weight support system is mounted h
B
WS.
In the optimized device, the height of the patient has a slight influence on the value of the swing angle, so this parameter was adopted as a constant value. However, the distance between the treadmill and the body weight support system is a more important parameter. This dimension significantly affects the possible range of displacement of the patient along the sagittal axis (assuming that the rope may swing only by a certain angle). Thus, the treadmill belt should be the longer if the body weight-support system is placed higher. In the presented device, the weight-support system is located approx. 2.8 m above the treadmill. Assuming that the swing angle of the rope will not exceed 5°, the centre of mass of the patient may move on a distance of approx. 0.5 m. Considering also the length of step, the minimum length of the treadmill belt should be 1 m.
In the discussed walking re-education equipment, the treadmill speed is controlled by a feedback loop with use of a sensor that measures the swing angle of the rope. The control system should ensure that the treadmill operates in such a way that will guarantee the smallest possible swing angle. However, the speed should be changed in a manner that will not expose the persons doing the workout to any danger. Thus, excessive acceleration of the treadmill belt is undesirable. Several solutions were tested at the stage of designing the control system. The tests with use of a PID regulator operating in a feedback loop led to the assumption that the controls should take into account a deadband –i.e. a neutral range, in which the patient may move without causing the treadmill to change its speed. Due to that, the authors proposed a control system that regulates the acceleration of the treadmill, where the reference set treadmill speed value in actual iteration vtref is the sum of the output signal from the fuzzy acceleration regulator (which is function of rope inclination angle) fl (φ) and the set treadmill speed value at the previous calculation step, like show in Equation (7).
The regulator considering a “deadband” may be defined in several ways. For the purposes of this study, we decided to use a fuzzy controller. Fuzzy logic enables us to easily define membership functions that correspond to subsequent ranges of the rope swing. The output signal, which is a resultant of the input signals and the developed base of control rules, may be optimized without difficulties [2].
Another matter in the training treadmill speed adaptation system is factoring the patient’s individual features (e.g. height and level of advancement of the rehabilitation process). The development of a system shaped to every person individual needs is impossible. Therefore, it is important to let the physiotherapist, after consulting with the patient, easily change the device dynamics. To allow that, the fuzzy logic systems are a beneficial solution because they enable counting in patient’s subjective notes as well as easy definition of the range, which patient considers well adjust, too little or too big. Unfortunately the regulators PID or PD settings are not easily adjusted. What is more, wrong settings of PID regulator may cause a dangerous situation for the trainee.
The optimization process of the fuzzy controller was conducted with use of a hybrid optimization method that combined a genetic algorithm with the interior point method [28, 31]. In the presented issue, the input function of the fuzzy controller (swing angle of the rope) was divided into 7 ranges. Membership functions described small, medium and large swing. Positive rope swing angles were assigned the symbols “+”, “++” and “+++”.Similarly, negative angles were assigned the symbols “-”, “–” and “—”. The “dead zone” was marked as “0”. The adopted convention of modelling the membership function is presented in Fig. 8.

Visualization of the developed method of describing the input membership function for rope inclination angle.
The coordinates of the P
n
points were calculated from the Eqiations (8) –(12). Swing in both positive and negative directions was defined analogically. It was assumed that the distribution of the membership function would be symmetrical. It should be noted that the device is equipped with additional safeguards that stop it in case of emergency. If the patient moves too far backwards, the whole device will be stopped. Thus, the authors assumed that the changes increasing and reducing the speed may be comparable, as there is no risk that the patient will move too far to the back.
The adopted membership functions connected with the given acceleration were constant value ranges. However, the input signal was multiplied by the “k” parameter, which value was optimized as the variable x(6). A diagram of the developed control system is presented in Fig. 9.

Block scheme of developed treadmill speed control system.
In the optimization process of the treadmill speed control system, the target function was formulated in such a way as to minimize the adverse effects of the horizontal component of the weight-reducing force on the patient [4]. Unfortunately, considering only the swing angle of the rope in the target function was insufficient. It resulted in a situation, where the rope was oscillating around the vertical position, which involves a change in the direction of the horizontal force applied to the patient. Although the values of the swing angle were low, such frequent changes in the treadmill speed and in the direction of the weight-reducing force made it more difficult for patients to maintain balance. Due to that, two criteria were taken into account during optimization: the swing angle of the rope and angular acceleration resulting from the swing of the rope [7, 34]. The weighted sum method was used to formulate the front of the megacriterion ΨY show in the Equation 13.
The w1 and w2 coefficients are weight values referring to the i-th, modified target functions
In the analyzed issue, the objective function Ψ
Yi
was adopted in form of the function presented in Equations (15) and (16).
Optimization calculations were conducted for 11 cases. The value of the weight coefficients changed from 0 to 1, at 0.1 intervals. The case considered the most beneficial from the set of the obtained Pareto optimal solutions was the one, where the weight of the w1 coefficient was 0.3. Figure 10 shows the calculated course of the output function of the fuzzy controller as a function of the swing angle of the rope.

Fuzzy controller output signal as a function of rope swing angle.
The developed and optimized treadmill speed control system was then implemented in a mechatronic treadmill for gait reeducation. The operation of the equipment was verified with the participation of a healthy people. Because of legal reasons the device was tested with 7 people of different height - from 1.58 to 1.82 m. Initially, the people moved at three different speeds, and then tried to imitate the gait of a person with lower limb paresis. The attempt consisted in stiffening the knee joint, which resulted in significant changes in the kinematics of the gait. The presented diagrams obtained in the experiments conducted with one of the trainee illustrate the changes in the swing angle of the rope (Fig. 11), values of set speed changes (Fig. 12) and the speed of the treadmill belt (Fig. 13) as a functions of time.

Measured rope inclination angle as a function of time.

Measured treadmill speed as a function of time.

Measured output function of the fuzzy controller multiplied by k parameter as a function of time.
The obtained results demonstrate that the swing angle of the rope while walking at a constant speed did not exceed 2 degrees. Higher values were recorded at the moments when the walking speed increased or decreased. However, these values occurred only momentarily. It should be noted that the tester changed the walking speed very fast. These changes will likely be much less dynamic in persons undergoing rehabilitation. The accelerations that occurred during the changes in treadmill speed did not cause any danger.
Comparing the acquired values of rope inclination angle with e.g. results published for ZeroG device [18] we can state the following conclusions: maximum rope inclination angle in proposed system and in the solution used in ZeroG device is comparable (about 2.5 deg), in the proposed treadmill speed adaptation system the maximum rope inclination angle value occurs only temporarily at the moment of speed change by the trainee; while walking with constant speed the rope inclination does not exceed 1 deg, while the patient is walking with constant speed the rope inclination angle was maintained independent from the walking speed within 1 deg range (this angle was also maintained at the walking speed of about 1 km/h, 2 km/h and 3 km/h). Meanwhile in ZeroG system the line inclination system is changing proportionally to the walking speed.
In the subjective opinion of the testers, the equipment offered a possibility to walk comfortably during the tests. However, as the notion of comfort is difficult to describe in numerical terms, the proper functioning of the treadmill should be verified unambiguously by tests conducted with a group of persons undergoing rehabilitation.
The empirical tests proved that the control system fulfilled the adopted assumptions. First of all, it enables practising walking at a constant pace, at small swing of the rope –the treadmill speed changes only after the swing angle of the rope is exceeded by a value of approx. 1 degrees. The developed control system is fully automated. As opposed to the existing solutions, the speed of the treadmill is not pre-defined in any way, but it adjusts to the walking pace of the patient. This approach significantly reduces the workload of physiotherapists, allowing them to focus only on monitoring the walking technique of the exercising persons.
The developed numerical model of the device was used to select the optimum settings of the fuzzy controller. The numerical model of the treadmill recorded with use of transmittance and acceleration regulator may also be used to optimize the settings of the servo inverter which enables to limit the angular accelerations of the rotor.
The possibility to apply the presented control of adjusting the treadmill speed in cooperation with a rehabilitation robot offers new opportunities for therapists who work on gait improvement. The influence of the patient’s walking pace on the treadmill speed may be another control parameter that will allow to monitor the progress of the patient in the walking re-education process.
In the presented algorithm for controlling the treadmill speed a fuzzy system was applied, presumed that it will allow the physiotherapist in charge of the rehabilitation to adjust the dynamics of the device easily to the trainee’s capabilities. During experimental research changes of the membership function and gain parameter “k” were tested. It was concluded that such modifications are possible and they might be realized in a way that ensures the patient’s safety.
A limit for the presented results was caused by too little number of people testing the device and another limitation was caused by testing only with healthy people. However the subjects were of different height and the device functioned properly with everyone.
Another limitation of the presented results is the fact that the system parameters have been optimized for a specific device with known parameters. This may limit the possibility of duplicating the developed system directly to another device. Differences in the length of the treadmill belt, in the angle measurement range and especially in the dynamics of the drive system of the treadmill may be particularly important. Therefore, the universality of the algorithm should be verified. This problem can be eliminated by using an adaptive fault-tolerant controller [40, 41].
Further work on developing the presented control system should be directed to justify the presented assumptions of employing the fuzzy logic, for which it will be necessary to prepare objective indicators defining the relation between setups of the treadmill speed control system and device influence on a patient. Within these indicators should also be factored in patient’s height, the altitude of the BWS system mount and inflicted value of the support force.
Considering that minimizing the rope inclination angle in BWS system impacts heavily consolidation of the correct gait pattern, the idea of using the treadmill speed adaptation system seems to be a promising alternative to standard solutions based on feedback loop with regulators functioning proportionally to the value of the rope inclination angle.
