MAE501 Independent Study


Published on

Independent study : A Matlab AnyBody interface to compute torque requirements for Assisting and Resisting modes for a leg exoskeleton helping perform a leg curl.

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

MAE501 Independent Study

  1. 1. Exoskeleton analysis<br />for Knee Joint<br />Submitted for<br />MAE501 KRO<br />Under guidance of Dr. V. Krovi<br />By<br />Hrishi Shah &<br />Anirudh Shiwaswamy<br /> DATE @ " M/d/yyyy" 5/8/2009<br />Acknowledgement<br />We would like to express our sincerest gratitude to our advisor Dr. Venkat Krovi for giving us an opportunity to work on this topic. The project would not have been possible without his continuing guidance and his wealth of knowledge. We would also like to acknowledge Srikanth Kannan and Madusudan S Narayanan for providing us with a good background for this independent study. We would also like to thank all the ARMLAB members for giving feedbacks during the presentations. Finally we would like to thank our friends and parents for their constant and encouraging motivation.<br />Table of Contents<br /> TOC o " 1-3" h z u Acknowledgement PAGEREF _Toc229483654 h 2<br />Table of Equations PAGEREF _Toc229483655 h 4<br />1.Introduction PAGEREF _Toc229483656 h 5<br />1.1.Motivation PAGEREF _Toc229483657 h 5<br />2.Background PAGEREF _Toc229483658 h 7<br />2.1.Curve Fitting PAGEREF _Toc229483659 h 7<br />2.1.1.Approximation Method PAGEREF _Toc229483660 h 7<br />2.1.2.Interpolation Method PAGEREF _Toc229483661 h 8<br />3.Computational Tools PAGEREF _Toc229483662 h 10<br />3.1 AnyBody modeling software PAGEREF _Toc229483663 h 10<br />3.1.1 Leg Model Creation PAGEREF _Toc229483664 h 12<br />3.1.2 Exoskeleton Model Creation PAGEREF _Toc229483665 h 13<br />3.2 MATLAB PAGEREF _Toc229483666 h 16<br />3.2.1 Torque profile evaluation and virtual validation using MATLAB PAGEREF _Toc229483667 h 16<br />3.2.2 GUI Implementation in MATLAB PAGEREF _Toc229483668 h 17<br />4.Sensitivity Analyses PAGEREF _Toc229483669 h 27<br />a.Foot Load PAGEREF _Toc229483670 h 28<br />b.Body Mass PAGEREF _Toc229483671 h 28<br />c.Start Angle PAGEREF _Toc229483672 h 29<br />d.Simulation Time PAGEREF _Toc229483673 h 30<br />5.Conclusion PAGEREF _Toc229483674 h 31<br />5.Future Scope PAGEREF _Toc229483679 h 31<br />References PAGEREF _Toc229483680 h 33<br /> TOC h z c " Figure" <br />Figure 1 - AnyBody Software Main Interface PAGEREF _Toc229483681 h 10<br />Figure 2 – Leg Model in AnyBody PAGEREF _Toc229483682 h 12<br />Figure 3 – Exo-skeleton Model in AnyBody PAGEREF _Toc229483683 h 13<br />Figure 4 - Forces and Torques in Models PAGEREF _Toc229483684 h 15<br />Figure 5 – Main MATLAB-AnBody Interface PAGEREF _Toc229483685 h 18<br />Figure 6 – On First Calibration PAGEREF _Toc229483686 h 19<br />Figure 7 – Viewing Force Difference PAGEREF _Toc229483687 h 21<br />Figure 8 – On change to Exo-skeleton Mode PAGEREF _Toc229483688 h 22<br />Figure 9- On Animation of Exo-skeleton PAGEREF _Toc229483689 h 23<br />Figure 10 - On Animation of Leg PAGEREF _Toc229483690 h 24<br />Figure 11 – Final Muscle Force Profile during Calibration PAGEREF _Toc229483691 h 25<br />Figure 12 - Viewing important muscle forces on Interface PAGEREF _Toc229483692 h 26<br />Figure 13 - Iteration and max-error history after calibration with approximate profile PAGEREF _Toc229483693 h 27<br />Figure 14 - Iteration and max-error history after calibration with exact profile PAGEREF _Toc229483694 h 27<br />Figure 15 - Foot Load Sensitivity PAGEREF _Toc229483695 h 28<br />Figure 16 - Body Mass Sensitivity PAGEREF _Toc229483696 h 29<br />Figure 17 - Start Angle Sensitivity PAGEREF _Toc229483697 h 30<br />Figure 18 - Simulation Time Sensitivity PAGEREF _Toc229483698 h 31<br />Table of Equations<br /> TOC h z c " Equation" Equation 1 PAGEREF _Toc229483699 h 7<br />Equation 2 PAGEREF _Toc229483700 h 7<br />Equation 3 PAGEREF _Toc229483701 h 7<br />Equation 4 PAGEREF _Toc229483702 h 8<br />Equation 5 PAGEREF _Toc229483703 h 8<br />Equation 6 PAGEREF _Toc229483704 h 8<br />Equation 7 PAGEREF _Toc229483705 h 9<br />Equation 8 PAGEREF _Toc229483706 h 11<br />Equation 9 PAGEREF _Toc229483707 h 11<br />Equation 10 PAGEREF _Toc229483708 h 17<br />Equation 11 – Typical Parameters for sensitivity analyses PAGEREF _Toc229483709 h 28<br />Introduction<br />In broad, the objective of the project is to “prove that an exoskeleton can reduce load on the human”. One practical application would be to replace exercising equipment for the rehabilitation of a physically disabled patient trying to regain lost functionality. We investigate in this study, a small subset of the whole exoskeleton design problem, namely the knee joint of the exoskeleton. The purpose would be to develop a theoretical hypothesis that an exoskeleton at the knee would be able to replace the actual exercise done by the patient and prove it using simulation.<br />The simulation was done by developing a leg model in AnyBody, a bio-modeling software. The muscle forces experienced while undergoing a normal weight lifting exercise using the leg were calculated and plotted for the main load carrying muscles of the leg for various values of exercise loads. For simplicity, the thigh was grounded at horizontal position and the knee was the only joint that was allowed motion. Then, an iterative analysis was carried out (using MATLAB/AnyBody interface) to find out a torque profile for the exoskeleton motor positioned at the knee joint in order to obtain muscle forces similar to those achieved without the exoskeleton. Each iteration involved the sampling of certain uniformly spaced points and interpolation between these points to obtain a continuous torque profile for the exoskeleton motor. This would then be used to drive the motor to get the inputs for the next iteration. To make the simulation realistic, an exoskeleton was developed in Pro-E and imported to the Leg model in AnyBody as a Stereo Lithography (STL) file, which then replaced the actual segments for easy viewing.<br />To run iterative analysis, AnyBody was coupled with MATLAB and the whole process was simplified for future use by creating a simple GUI in MATLAB. As AnyBody and MATLAB were the key tools in the development of this project, a part of the study was dedicated to developing a fair understanding of both these software. <br />Motivation<br />In recent times, there has been an increased need for development of automated systems for tasks that are either too mundane, or for those to be done in dangerous environments (like battlefields), or even those wherein a high level of accuracy is required (like in a microsurgery). Due to this, there has been increasing interest in the research of exoskeletons for applications in most of the above mentioned areas. An exoskeleton defined as a powered mobile machine consisting primarily of a skeleton-like framework worn by a person and a power supply that supplies at least part of the activation-energy for limb movement. Uses of an exoskeleton are manifold, ranging from assisting a soldier in carrying heavy loads and serving as armor in the battle field to supporting and helping rehabilitate temporarily or permanently physically disabled patients to helping in rescue operations in dangerous situations such as building crumble sites or chemically hazardous situations.<br />The augmentation of human effort is achieved in two ways. The first method is augmentation of a known human movement, a typical application of which would be to help regain functionality for a disabled limb. For this, the exoskeleton moves in a preprogrammed motion. The second method involves finding the intended movement by the human in real-time using force sensors and simulating that movement in the exoskeleton using right amounts of forces and torques in the actuators and motors respectively. This is not very easy since the exoskeleton is generally capable of exerting enough force to cause severe damage to the subject if the forces/moments are wrongly applied. Other factors like the exoskeleton’s self weight, inertia etc. make the entire process much more complicated.<br />Background<br />Curve Fitting<br />Given a set of data points (xi,yi), we need to find a curve that best fits the data. This can be achieved either by Least squares approximation method or by interpolation method. The main difference between the two methods is, in approximation method the curve doesn’t necessarily need to pass through all of the given data points but in interpolation method, it is necessary for the curve to pass through the given points. In the following pages, the above two methods are discussed in some detail and the corresponding MATLAB functions are also listed.<br />Approximation Method<br />Least squares approximation method or regression analysis, finds the polynomial of degree m that best fits the given set of data by minimizing the sum of squared distance of the data points to the approximating curve [3].<br />Suppose the data points are (x1, y1), (x2, y2)... (xn, yn) where x is the independent variable and y is the dependent variable. The fitting curve P(x) has the deviation (error) d from each data point, given by, d1=y1‐P(x1,) d2=y2‐P(x2),…..,dn=yn‐P(xn) . According to the method of least squares, the best fitting curve should satisfy the following condition<br />π=d12+d22+…+dn2=t=1ndt2=t=1n[yt-fxt]2<br />Equation 1<br />And the least squares polynomial of degree m of the form<br />Pm=c1+c2x+c3x2+…+cmxm-1+cm+1xm<br />Equation 2<br />that fits the n data points is obtained by solving the following set of linear equations for the (m+1) coefficients {c1,c2,…….,cm,cm+1} <br />ni=1nxii=1nxi2⋯i=1nximi=1nxii=1nxi2i=1nxi3⋯i=1nxim+1i=1nxi2i=1nxi3i=1nxi4⋯i=1nxim+2⋮⋮⋮⋱⋮i=1nximi=1nxim+1i=1nxim+2⋯i=1nxi2mc1c2c3⋮cm+1=i=1n1yii=1nxiyii=1nxi2yi⋮i=1nximyi<br />Equation 3<br />If we have more than n + 1 constraints (n being the degree of the polynomial), we can still run the polynomial curve through those constraints but an exact fit to all the constraints is not certain.<br />In MATLAB the polyfit (x,y,n) finds the coefficients of a polynomial p(x) of degree n that fits the data, in a least squares sense by solving Vandermonde Matrix.<br />Interpolation Method<br />It is the method of finding new data points between two existing data points [4]. In mathematical terms, given a sequence of n distinct data points (x ,yk) , we are looking for a function f so that<br />f(xk)=yk , k=1,….,n<br />Equation 4<br />where f is known as the interpolant for the given set of data points. Piecewise constant interpolation, linear interpolation, polynomial interpolation and spline interpolation are some of the common interpolation methods. Due to relatively high interpolation errors piecewise constant interpolation and linear interpolation method are not preferred.<br />Piecewise Approximation<br />The piecewise interpolation is an approximation by different polynomials of lower degree(linear or quadratic interpolation) in different parts of intervals [a,b]; Linear interpolation is only appropriate when the mapping between screen space x,y and the attribute is affine.<br />Given y=f(x) with y(x0)=y0 and y(x1)=y1, the Lagrange polynomial becomes<br />P1x= y0x-x1x0-x1+y1x-x0x1-x0=y0+y1-y0x1-x0(x-x0)<br />Equation 5<br />For quadratic interpolation, given y=f(x) and values y1,y2,y3 at x1,x2,x3; the interpolating Lagrange polynomial is<br />P1x= y0x-x1(x-x2)x0-x1(x0-x2)+y1x-x0(x-x2)(x1-x0)(x1-x2)+y2x-x0(x-x1)x2-x0(x2-x1)<br />Equation 6<br />Polynomial Interpolation<br />In Polynomial interpolation, given n data points, we can find exactly one polynomial of degree at most n-1 going through all data points. Also the interpolation error is proportional to the distance between the data points to the power n. Some of the disadvantages of polynomial interpolation are its computationally expensive and the interpolation function tends to oscillate towards the end points for higher degree polynomials, which is known as Runge phenomena.<br />For a polynomial function, increasing the higher order makes the curve more accurate to the real curve during interpolation. But as shown in the figure, there will be oscillations. Therefore, we use piece wise approximation to minimize the oscillations.<br />Spline Interpolation<br />All the above problems can be overcome using spline interpolation. A spline is a piece wise polynomial function. For a given set of k data points (t0, t1, t2 …. tk-1) piece wise polynomial functions Si are formed between consecutive knots [titi+1].<br />Sk=Pk-1(t), tk-2<t<tk-1<br />Equation SEQ Equation * ARABIC 7<br />The given k points ti are called knots. If the knots are equidistantly distributed in the interval [tk tk-1], the spline is uniform, otherwise it is non-uniform. The degree of spline St is the maximum degree of its polynomials P(t) and for its cubic spline the degree of the polynomial will be 3. Connection between the knots is defined as by smoothness properties and for cubic splines the function, its derivative and its second derivative are continuous at the interpolation nodes. Natural cubic spline is smoothest of all the possible interpolating curves since it minimizes the integral of the square of second derivative.<br />In MATLAB, a cubic spline can be created by using any of the following commands:<br />yi=spline(x,Y,xi) – this gives the values at xl for the given set of data points x and Y.<br />yi=interp1(x,Y,xi,’spline’) – this interpolation command also gives the same output.<br />In AnyBody Software, a spline can be obtained by using an AnyFunInterpol function.<br />AnyFunInterpol moment = { <br />Type=Bspline; <br />BsplineOrder = 3; <br /> FileName = " Moment.txt" ; //Name of file containing knot values.<br /> };<br />An advantage of using splines is that it utilizes lower order polynomials to produce globally smooth interpolant, simultaneously avoiding the computational disadvantages of higher degree polynomials.<br />However, this sort of interpolation is unsuitable for computer graphics since computer graphics requires that a change in one part of the spline should have little or no change in the rest of the curve.<br />Computational Tools<br />3.1 AnyBody modeling software<br />This musculoskeletal modeling software [23] was developed as part of the “The AnyBody Project” at Aalborg University in Denmark. The software was developed to parametrically analyze detailed musculoskeletal systems of both humans and animals. <br />Figure 2-20 shows a picture of a musculoskeletal simulation performed within AnyBody. AnyBody is a script based analysis program such that writing code is necessary to develop the musculoskeletal system models. It uses its own scripting language, AnyScript, which is an object-oriented language similar to C++ or Java Script. This software also has the capability to perform analyses on complex musculoskeletal models. This complexity encompasses the model geometry, the number of muscles, dynamic changes in muscles position, and of degrees of freedom of the system. Within the program musculoskeletal and physiological properties such as muscle forces, joint reactions, metabolism, mechanical work, and efficiency can be examined for a given system. Several musculoskeletal system simulations have been performed using this software and example simulations can be seen on the AnyBody website ( <br />Inverse dynamics analysis (IDA) can be thought as the main process of calculating muscles forces within AnyBody Modeling Software system. Given the motion to the musculoskeletal model, muscle and reaction forces are calculated by setting up the equations of motion. Problems pertaining to static indeterminacy, limitations on the maximum muscle forces need to be resolved before the analysis. Since there are more muscles than the degree of freedom, redundancy posed by the system indicates that there is no unique solution to the inverse dynamics problem.<br />Figure 1 - AnyBody Software Main Interface<br />While performing a body motion the muscles collaborate according to some rational criteria. These criteria when combined with the fact that muscles can only pull and not push results in a unique recruitment pattern. This suggested that the central nervous system applies some sort of optimality criteria to determine the muscle activation order. If such an optimal criterion is combined with the equilibrium equations, we can have unique solution for the problem. The basic optimality assumption is that “the body attempts to use its muscles in such a way that fatigue is postponed as far as possible”. Hence, in our optimization problem we would minimize the maximum muscle activity subject to equilibrium constraints and positive muscle force constraint. Hence, the optimization problem for calculating the muscle forces can be mathematically written as:<br />Minimize :V= i=1nFM,iNip<br />Subject to:<br />Cf=d<br />FM,I ≥ 0 : i=1,…,n<br />Equation 8<br />Various forms of this optimization problem may be created raising the power of the individual muscle activity to a polynomial power, ‘p’. With increasing value of ‘p’, the criteria tend to distribute the relative load evenly between the muscles.<br />The min/max-objective function is non-differentiable and therefore appears to complicate the practical solution of the optimization problem. However, by using bound formulation, which is widely used and well tested in the field of optimum engineering design, we can easily solve the min/max problems. By introducing a new artificial variable β and an artificial criterion function B(β) and the new criterion can be a monotonic function of β. By choosing the B(β) = β we can reformulate the above problem as:<br />Minimize :β,<br />Subject to: Cf=d<br />FM,I ≥ 0 : i=1,…,n<br />FM,iNi≤β;iϵ{1,…n}<br />Equation 9<br />In the min/max optimization problem, we are looking at the muscle recruitment that balances the exterior loads and minimizes the largest relative load on any muscle in the system, hereby positioning fatigue of the muscle as far as possible. This is the approach used within the AnyBody software.<br />In addition to the main software, AnyBody has a command prompt executable named AnyBodyCon that allows one to load models and perform actions such as inverse dynamic analysis. This utility can run the required analysis without actually opening the software and going through the GUI. Hence, it is used to interface AnyBody software with other software such as MATLAB.<br />3.1.1 Leg Model Creation<br />The first step was to create a model that would emulate the functioning of a normal leg while doing various exercises. The Leg model from AnyBody repository was taken as the starting point for this model. Since only the knee joint was of sequence in the study, the model was reduced to one with only two segments by doing the following:<br /><ul><li>All nodes were transferred from the Pelvis segment to the Thigh segment (named UpperLeg in the model) and from the Foot segment to the Shank segment(named LowerLeg in the model).
  2. 2. The grounding was removed from the Pelvis segment and provided at the Hip joint. The whole UpperLeg was grounded effectively by providing a revolute joint at the hip and providing it zero velocity.
  3. 3. The muscle definitions were changed so as to now connect through nodes on the UpperLeg and LowerLeg instead of the Pelvis and the Foot respectively. The extra muscles that do not participate in the knee motion were deleted.
  4. 4. The Pelvis and Foot segments were completely eliminated from the model.</li></ul>The model thus developed is shown in Fig. 2.<br />Figure 2 – Leg Model in AnyBody<br />Now the model was provided with a vertical load at the Foot-Shank joint and ran with a constant velocity from a Starting Angle to and Ending Angle to get a muscle force profile.<br />This muscle force profile was then written to an external .txt file to allow for access to these profiles outside AnyBody software.<br />3.1.2 Exoskeleton Model Creation<br />To create the exoskeleton model, the Leg model discussed above was taken as the starting point. The next part involved adding two segments named UpperExo and LowerExo to represent the upper and lower parts of the leg part of the exoskeleton and place appropriate joints and drivers so that the exoskeleton could drive the leg. <br />Figure 3 – Exo-skeleton Model in AnyBody<br />The resulting model is as shown in REF _Ref222947051 h Figure 3. It was done by the following steps:<br /><ul><li>Two segments identical to the Leg segments were added and displaced a distance of 0.06m from the Leg segments.
  5. 5. Two nodes were added to each of the original Leg segments at their extremeties and 0.06m away along the axis of rotation of the knee.
  6. 6. The exoskeleton segments were “frozen” with respect to the leg segments at the Hip joint and Foot-Shank joint by providing zero velocity revolute joints.
  7. 7. The Exo-Knee joint was created between the Lower-Exo and Upper-Exo and the Knee joint in the actual Leg was removed to prevent the model from having more degrees of freedom than the constraints in the system.
  8. 8. The Exo-Knee joint was driven by a cubic spline interpolation using a function AnyFunInterPol that took the knot points data from a file ‘moment.txt’.
  9. 9. The segments were drawn in an easy to see way using the AnyDrawSTL command in AnyBody to replace the segments. The STL (Stereo Lithography) files themselves were made using Pro-E software.
  10. 10. The application of the force at the Shank-Foot joint is now decided based on the application to be emulated by the Exo-skeleton.
  11. 11. Exoskeleton Application: The exoskeleton is required to provide assistance to the human leg for lifting of a heavy weight and hence the vertical force at the ankle joint is included in the Exo-skeleton model.
  12. 12. Rehabilitation/Exercise Application: The exoskeleton in required to emulate the effect of a mass attached to the ankle joint by providing an equivalent moment Hence, the actual force is not required.
  13. 13. LEG MODELEXO MODELEXERCISE MODEEXO-SKELETON MODELEGEXO-SKELETONLEGEND FORCES BALANCED BY MUSCLES FORCES BALANCED BY TORQUE FORCES BALANCED BY REACTION REACTION FORCES EXO-MOTOR TORQUESIMILAR NODES INDICATING FIXED JOINTSMLegMLegMExoMExoMMLegMM</li></ul>Figure 4 - Forces and Torques in Models<br />3.2 MATLAB<br />MATLAB is a numerical computing environment and programming language. MATLAB allows easy matrix manipulation, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs in other languages. Although it is numeric only, an optional toolbox uses the MuPAD symbolic engine, allowing access to computer algebra capabilities. An additional package, Simulink, adds graphical multi-domain simulation and Model-Based Design for dynamic and embedded systems.<br />3.2.1 Torque profile evaluation and virtual validation using MATLAB<br />In our study, MATLAB performed the following steps:<br /><ul><li>Get system parameters like mass attached to the foot, body weight, simulation time etc. from the user.
  14. 14. Update AnyBody model files (for both Leg model and Exo-skeleton model) with the new parameters.
  15. 15. Find an appropriate torque profile to be applied to the exo-skeleton knee so depending upon the application selected (whether exo-skeleton or exercise mode).
  16. 16. Run the AnyBody analysis using ‘AnyBodyCon’ executable.
  17. 17. Read the results from the AnyBody output files and display them on screen.
  18. 18. Modify the torque profile depending upon the deviation of the muscle forces from the expected muscle forces.
  19. 19. Update the muscle profile in the AnyBody Model file.
  20. 20. Repeat steps d through g till either the expected muscle profile is achieved or the model diverges and muscle forces exceed admissible muscle forces.</li></ul>The main input parameters for the calibration are:<br /><ul><li>Foot Mass: The Mass, in kg, to be attached at the Foot joint to provide a constant force in the downward direction. It is converted to N and written to the y-component of the applied force in the Leg model.
  21. 21. Simulation Time: The total time of the movement in seconds. It is written to the ‘tEnd’ parameter in both the models.
  22. 22. Body-Weight: It is written to both the models and the weights of the Leg as well as the Exoskeleton are directly proportional to this parameter.
  23. 23. Start Angle: The angle, in degrees, at which the Exercise should start.
  24. 24. End Angle: The angle, in degrees, at which the Exercise should culminate.
  25. 25. Number of Steps: The number of intermediate positions to be considered in inverse dynamic analysis. It is written as the parameter ‘nStep’ in both the models.</li></ul>Upon starting a calibration, the approximate muscle profile for the Exercise model is calculated as:<br />Mα=-MgL+MExogL2*sinαfor Exercise Mode<br />Mα=-MgL+MExogL2+MLeggL2*sinαfor Exo-skeleton Mode<br />Where M = Foot Mass (kg)<br />L=length of shank segment and also of lower exoskeleton segment<br />MLeg = mass of shank segment. Proportional to Body weight<br />MExo = mass of lower exo-skeleton segment. Same as shank segment.<br />nStep, N<br />α = angle that increases from Start Angle to End Angle in ‘nStep’ steps.<br />g = acceleration due to gravity<br />Next, the model files are written with the appropriate parameters, following which AnyBodyCon executable is called to update the model results with the latest models created with updated parameters. <br />Next, the muscle with the highest magnitude of muscle force is selected and the moment profile is corrected as:<br />ΔM(i)=penalty*MuscleForce(i)<br />Equation 10<br />where i goes from 1 to nStep+1<br />MuscleForce is the Muscle Force vector for the muscle with maximum magnitude of muscle force<br />Penalty = ±0.05 depending on whether the muscle with the maximum magnitude of muscle force works during expansion or contraction.<br />This corrected muscle profile is then written to the moment file for the Anyody model and AnyBodyCon is run again.<br />The process is repeated till the maximum error is either less than unity (in which case the model has converged) or greater than 1000 (in which case the model has diverged and calibration in unsuccessful using this method). It was observed that convergence was obtained for all ranges of parameters allowable in the GUI.<br />Once the calibration is over, the success of the calibration is indicated on a GUI indicator, the muscle profile is plotted on the Muscle Force Graph and the Exo-Knee Moment Profile is plotted on the Torque Graph. Also, a history of the magnitudes of maximum muscle forces during each of the iterations is displayed.<br />3.2.2 GUI Implementation in MATLAB<br />A GUI was created in MATLAB to simplify the process of parameter changes and result viewing. It was created using the GUIDE (Graphical User Interface Design Environment). The UI controls were placed as shown in Fig .1. User inputs were captured using UI controls and corresponding actions were implemented using UI callbacks.<br />The various entities used in this GUI were: <br /><ul><li>Axes: Used to plot graphs (eg. Muscle force graph or Knee Torque graph).
  26. 26. Push Button: Used to capture user inputs for performing certain actions (eg. To start calibration).
  27. 27. Pop-Up Menu: Used to toggle between a fixed set of available options (eg. Choice of display of muscle forces corresponding to Leg Model, Exoskeleton model or a difference between the two).
  28. 28. Check-Box: Used to toggle variables that have only two states (eg. Whether a muscle force is to be plotted on the graph or not).
  29. 29. Sliders and Edit Boxes: To capture user input of variables within certain ranges. While the sliders have inbuilt capability of limiting an input, the Edit Boxes had to be explicitly programmed to have this feature. Variables such as the Foot Load, Simulation Time etc. were captured in this way.
  30. 30. Static Text: Used solely for displaying information without any input.</li></ul>One important function in MATLAB GUI programming is the handles function. GUIDE creates a handles structure that contains the handles of all the objects in the figure. UI Components can be accessed through handles by their ‘Tag’ property. Also GUIDE creates and maintains the handles structure as GUI data. Since ‘handles’ is passed as an input to all callbacks, the data can be easily shared between the callbacks.<br />Figure 5 – Main MATLAB-AnBody Interface<br />There are two plots in the GUI:<br /><ul><li>Muscle Force Graph: It plots the muscle forces of the Leg Model or Exoskeleton model or the difference of the two as indicated by the Pop-Up menu.
  31. 31. Torque Graph: It plots the Torque profile required at the Exoskeleton Knee for the required effect.</li></ul>There are two pop-up menus in the GUI:<br /><ul><li>Display Mode: This menu allows the user to select between plotting the muscle forces for the Leg Model, Exoskeleton Model or the difference between the two.
  32. 32. Solution Mode: This menu allows the user to select between the exercise mode and the Exoskeleton mode. The exercise mode is programmed equalize the muscle forces in both models while the Exoskeleton mode is programmed to neutralize muscle forces in the exoskeleton model.</li></ul>There is a checkbox corresponding to each muscle employed in the model to toggle that muscle’s force display in the Muscle force graph.<br />There is a Re-Calibrate Button to initiate the Calibration sequence. It also has a Calibration Status indicator that is green if the previous calibration was successful, yellow if a calibration is underway and red if the previous calibration was unsuccessful.<br />Figure 6 – On First Calibration <br />The following parameters were set for the initial calibration.<br />Foot Load = 5.3kgSimulation Time = 4.3sBody Mass=66.1kgStart Angle = -25。End Angle = 53。Solution Mode = Exercise<br />This implies that the Leg is performing an exercise by attaching a load of 5.3kg at the ankle and the stroke is from -25 degrees to 53 degrees(with respect to the vertical position of the lower leg). This exercise is performed in 4.3 seconds and the body mass is 66.1kg.<br />The body mass is important since it determines the mass of the leg(which is equal to the mass of the corresponding exo-ekeleton segment) and finally affects the moment needed to neutralize it.<br />The left part of the figure shows the forces developed by the various muscles in the leg as the stroke advances. This can be changed to show the muscle forces in the Exo-skeleton model as well as the difference by changing the Display Mode(currently set as Leg Model).<br />As can be expected, some of the muscles are active till the leg reaches the vertical position and others kick in once the vertical position is passed. This means that the muscles active in the former part of the stroke are aiding in the ???<br />The right part of the figure shows the muscle profile that has to be applied to the motor at the knee joint of the exo-skeleton in order to equate the muscle forces in the Leg model with the downward force and those in the Exo-model without the force applied. This implies that the motor will now emulate the effect of having a mass of 5.3kg tied to the Leg at the ankle without the load being actually applied. This sort of force distribution is because of the selection of Exercise mode as the Solution mode. It can be used to design an Exo-skeleton for rehabilitation purposes.<br />The motor torque at the initial point can be calculated as;<br />MInitial=MLower*L2-M*L*g*sin-25*pi180= 6.465Nm<br />where mass of lower leg=mass of lower exo=<br /> MLower=0.045*MBody=0.045*66.1=2.9745kg<br />Mass hung at ankle, M=5.3kg<br />length of lower leg=length of lower exo=L=.409m<br />Final point motor torque is<br />MFinal=MLower*L2-M*L*g*sin53*pi180= -12.2174Nm<br />As we can see, the actual motor torque values are in close accordance with the expected values.<br />Figure 7 – Viewing Force Difference<br />Figure 7 showcases the same calibration as in Figure 6 but now plots the difference of the muscle forces felt in both the models. As can be seen, the differences in muscle forces are reduced to almost zero. This implies that the calibration was successful in emulating the effect of an actual exercise using an exoskeleton.<br />Figure 8 – On change to Exo-skeleton Mode<br />Now we change the solution mode to exoskeleton mode. In this case, we actually apply a load equal to the Foot Load at the Ankle of the Leg and calibrate so as to reduce the muscle forces of the Leg in the Exo-model to a miminum. As can be seen, the muscle forces of the Exo-model are reduced to an exact zero. This implies that the calibration was perfect in nullifying the external forces and moments to make the movement ‘effortless’.<br />Calculating the moments as earlier,<br /> MInitial=MLower*L2+MLower*L2+M*L*g*sin-25*pi180= -14.03Nm<br />MFinal=MLower*L2+MLower*L2+M*L*g*sin53*pi180= 26.514Nm<br />The extra term in this case corresponds to the weight of the Lower Leg that now needs to be compensated for too, since the muscles need to be ‘effortless’. Also, the sign of the M*L term has changed because the motor now needs to neutralize an existing force of M*g rather than emulating it when it does not exist.<br />Again, the actual moment profile is a close match to the expected one. <br />This type of calibration can now be used to design an exo-skeleton for the Leg.<br />Figure 9- On Animation of Exo-skeleton<br />Figure 10 - On Animation of Leg<br />Figures 9 and 10 are a depiction of the actual stroke made by the leg. This animation is triggered by hitting the ‘Animation’ Button in the top right corner of the GUI. Since the Display mode is Exo-model, the exo-skeleton model is displayed while carrying out the stroke. It is programmed to extract the relevant frames from an AVI file that has frames for angles ranging from -40 degrees to 90 degrees (the whole allowable range of angles). The frames are then played at such a speed so as to make the stroke time equal to the Simulation Time.<br />Figure 11 – Final Muscle Force Profile during Calibration<br />Figure 13 shows the Muscle Force differences after the calibration is over. Since there weren’t any significant muscle force differences to begin with, the change in the torque profile is not substantial. This implies that our initial approximation was quite accurate. However, since the maximum value of the differences has gone to less the 0.02N, we can say that the calibration was successful.<br />Figure 12 - Viewing important muscle forces on Interface<br />In order to display the model muscle wise, we can deselect the unimportant muscles in the central area of the GUI and display only the ones that are important. However, this option does not remove the deselected muscles from the actual models.<br />Figure 13 - Iteration and max-error history after calibration with approximate profile<br />Figure 14 - Iteration and max-error history after calibration with exact profile<br />Figure 13 shows the muscle force magnitude as it decreases from the initial value of about 9N to a final value of about 0.9N. As can be seen, there is a really good convergence obtained by the method employed. However, as seen in Figure 14, by applying a correctly calculated Torque Profile in the first go, we can have an acceptable answer without any iterative procedures. Muscle force magnitude is calculated as the maximum magnitude of the difference in the muscle force exhibited by any muscle in the model. Different muscles have the maximum magnitude during different iterations. Hence, the program considers the muscle with the maximum muscle force magnitude while applying corrections to the Muscle Force Profile (Eqn 10).<br />Sensitivity Analyses<br />In this section, we try to ascertain how changes in various parameters affect the muscle forces. We start with a typical set of parameters as:<br />Foot Load = 7kg.Body Mass = 75kg.Start Angle = -40◦End Angle = 90◦Simulation Time = 6.5sNumber of Steps = 65Mode = Exercise Mode<br />Equation 11 – Typical Parameters for sensitivity analyses<br />We then change the parameters one by one and observe changes in the Vasti Muscle. This procedure is intended to provide a better understanding of the system and also validate the formulation.<br />Foot Load<br />When we change the foot load from 0 through 10kg, it has a substantial effect on the muscle forces. This is expected since the main contributing term in the equation.<br />Figure 15 - Foot Load Sensitivity<br />Body Mass<br />Next, we try to change the Body mass from 50 through 100kg. As expected, the change in muscle forces is not significant. This is helpful in the sense that the same calibration can be used for people with a variety of body masses without enduring a considerable downfall in performance.<br />Figure 16 - Body Mass Sensitivity<br />Start Angle<br />Next, we try to change the starting angle and compare the muscle forces at an angular position for different start angles. It has no effect on the muscle forces. We can infer that the starting condition of the exo-skeleton is immaterial although the zero reference needs to be correct.<br />Figure 17 - Start Angle Sensitivity<br />Simulation Time<br />Finally, we try to vary the simulation time to see if longer durations of a stroke can increase muscle forces. As expected, the muscle forces at an angular position are constant for a variety of stroke times (or Simulation Times).<br />Figure 18 - Simulation Time Sensitivity<br />Conclusion<br />A brief study was made on the muscle forces developed in the human leg by creating a simplified model of the leg and analyzing it using AnyBody. The effect of an exo-skeleton on the muscle forces in the leg was also studied by providing the appropriate segments and torques. Two different applications, the exercise mode for rehabilitation and the Exo-skeleton mode for actual exo-skeleton design, were successfully studied and developed. Then, using MATLAB, the analysis process was automated by writing AnyBody files with desired parameters and analyzing them externally (without AnyBody) using AnyBodyCon. A program was developed for converging to the required torque profile using penalty function. Finally, a MATLAB GUI was developed to automate the entire design process and also for ease of access of data.<br />The results obtained were found to be quite satisfactory for this simple model.<br />Future Scope<br />Similar models may be developed for other parts of the body. The starting point could be the Hand model since it closely correlates to the Leg as far as joints are concerned. Also, the simulation may be made more realistic by applying real-time movement data to the knee-joint in the Leg model by using Motion-capture for a full range of parameters.<br />Another approach may involve the use of fmincon function in MATLAB to optimize the muscle force profile for higher end models, whose direct analysis and approximation could be more complex than in this simple example.<br />The final part could be the similar analysis of a full scale exo-skeleton model in the exo-skeleton mode and automation of the process similar to this case.<br />To provide reasonably accurate data for driving the Leg model in AnyBody, an actual exercise can be done with the simulated conditions and the motion of the leg captured using Motion Capture System. For example, a SIMI motion capture system can be used with three cameras for this purpose.<br />References<br />1) “CONVERSION OF POINT CLOUD DATA INTO 3-D MODELS”, Karthikeyan Senthilnathan & Chen Lin, Independent Study Report, Mechanical and Aerospace Engineering, SUNY Buffalo.<br />2) AnyBody Reference Manual, AnyBody Technology –<br />3) “ANALYSIS OF PARALLEL MANIPULATOR ARCHITECTURES FOR USE IN MASTICATORY MOTION CASE STUDIES”, Madusudanan Sathia Narayanan, M.S. Thesis, Mechanical and Aerospace Engineering, SUNY Buffalo<br />4) “MUSCULOSKELETAL MODELING OF SMILODON FATALIS FOR VIRTUAL FUNCTIONAL PERFORMANCE TESTING”, Kiran S Konakanchi, M.S. Project Report, Mechanical and Aerospace Engineering, SUNY Buffalo<br />5)<br />6)<br />7) - AnyScript Support Group<br />