By Edgar Charry, dorsaVi
Elite athletes want to return to match play as quickly as possible after injury. As a result, they often convince themselves and their physicians that they are fit to play before they have fully recovered. Advanced technologies such as optical tracking systems, which capture motion, and force plates, which measure ground reaction forces, enable athletes and trainers to determine when the athlete can safely return to full activity. These technologies provide metrics and insights that are impossible to obtain by simply observing the athlete, but they have several drawbacks. In addition to being costly, they typically depend on specially trained technicians and lengthy setup procedures. Further, because they often require the athlete to perform in a constrained environment, such as on a treadmill, they make it difficult to assess natural movement.
At dorsaVi, my colleagues and I have developed wearable, wireless motion analysis devices that precisely measure and track movement while the athlete moves freely in any environment (Figure 1).
ViPerform incorporates inertial measurement units (IMU) and magnetometers, as well as electromyography sensors for measuring muscle activity. Sensor data is transmitted to a recording and feedback device (RFD), which can be worn on the arm or carried in a pocket. The RFD sends the data to a PC, where it is processed and displayed by the dorsaVi software package.
At the heart of the dorsaVi technology are proprietary algorithms that filter and analyze raw sensor data, providing information that can be used to evaluate knee control, lower back range of motion, hamstring activity, hip and core control, and running performance. By developing and testing the algorithms in MATLAB® and developing portable C code with MATLAB Coder™, we cut development time by almost half compared to our previous approach, which involved hand-coding in C#.
Objective analysis is made possible by sophisticated algorithms that process raw sensor data and present results in a meaningful form. For example, an algorithm may identify large negative spikes in the accelerometer output that occur on each step when an athlete is running. From the timing and magnitude of these spikes, the algorithm can calculate the runner’s cadence and the ground reaction force of each step, respectively. This analysis may detect an asymmetrical cadence or unequal ground reaction forces for each leg, revealing an inability or unwillingness for the athlete to apply equal force through both legs. Similarly, analyzing knee deviation, flexion, and rotation as the athlete squats or hops can guide recovery from ACL and other knee injuries. Even healthy athletes can benefit from such analysis, using feedback from the algorithms to refine their technique or optimize the efficiency of key movements.
When we implemented our algorithms directly in C#, we had to develop our own low-level signal processing and graphing functions. By switching to MATLAB, we have sped up development by using built-in functions for data visualization and discrete Fourier transforms. Today, we use Signal Processing Toolbox™ and Wavelet Toolbox™ to further streamline development. For example, we use Signal Processing Toolbox to design and apply Butterworth and other infinite impulse response (IIR) filters to sensor data. We identify peaks and troughs in sensor signals by computing the continuous wavelet transform (CWT) coefficients of the signals using Wavelet Toolbox. Identifying these patterns in signals is essential to pinpointing gait events, such as heel strike and toe off, for our running analysis.
After developing an algorithm in MATLAB, we verify it by comparing its results with results produced by an independent measuring device, such as an optical motion tracking system or a force plate. For example, we compare the timing of gait events detected by our algorithm to the timing of the ground force reaction spikes generated by the force plates. In this phase, we inspect plots and graphs created in MATLAB to identify and then correct potential deficiencies in the algorithm (Figure 2).
Once we are satisfied that the algorithm is performing well on a limited set of test scenarios, we run more than 1000 tests in MATLAB using recorded data from athletes around the world. We continue to fine-tune and optimize the algorithm until it meets our requirements for accuracy and performance.
DorsaVi software, which serves as the primary interface for viewing sensor data and evaluating an athlete’s performance, is written primarily in C#. When we first began using MATLAB to develop signal processing algorithms, our workflow still relied on C++ and C# programmers to implement the production version of the algorithm that was incorporated into the dorsaVi software.. This approach was inefficient because it involved duplication of effort. It could take an additional month to reprogram and retest algorithms that had already been developed and tested in MATLAB.
To eliminate this inefficiency and shorten project delivery times, we decided to use MATLAB Coder to generate C++ code from our verified MATLAB algorithms. We prepare our algorithms for code generation by initializing all variables and looking for opportunities to optimize loops. We verify that our algorithm is ready for code generation by generating a MEX function that wraps the compiled code, and then invoking the MEX function in place of the original MATLAB algorithm. After generating the C++ code from our algorithm, we compile the algorithm into a DLL.The C# programmers load this DLL into the dorsaVi software.
Translating the MATLAB algorithm into production code previously took up to a month. With MATLAB Coder it now takes a day or two. As a final step, we perform full system testing of the algorithms of the dorsaVi software. To date, we have not found any defects introduced during code generation. The extensive testing we perform in MATLAB enables our C# programmers to spend their time developing new features for the dorsaVi software instead of recoding our algorithms in C# and then retesting them.
We have reused several algorithms initially developed for ViPerform in our ViMove and ViSafe products, designed for elite sports, clinical applications, and occupational health applications, respectively. My team is currently working on new algorithms to analyze data from sensors placed on different body parts, as well as algorithm development and enhancement requests from existing customers.
With MATLAB and MATLAB Coder, we can respond quickly to customer requests. In a recent release, we updated two algorithm modules, created two new ones, and delivered all four with a confidence that would have been impossible using our old workflow.
Published 2014 - 92251v00