OPENSIM
OPENSIM
Tanmay Debnath
PDPM Indian Institute of Information Technology
Design and Manufacturing
Jabalpur; Madhya Pradesh – 482005
India
ABSTRACT:
Page | 1
Biomechanics is one of the important domains to study and research. There are certain
domains within the broad spectrum of biomechanics which is based on the precise
representation of the biomechanics of a particular body. Some of the applications of the
same are evident in the department of sports and exercise, where the improvement in
the biomechanics of the body directly affects the improvement in the game or sport. It is
not only related to the study of the sports and the related mechanics. But it is evident
that it has a wide range of applications on the domain of injury recovery. Worth
mentioning, Hugh Herr, the director of the Biomechatronics lab at MIT Media Lab is
one of the key people to have established the domain in a way no one could have ever
imagined. Using the paradigms of biomechanics and electronics, he revolutionised the
mechanics in human body for those who are required to have some form of body
prosthetics.
In analysing the same, we find the usage of the OpenSim to be most crucial and hence
in turn, determine the scripting of the same to be one of the important paradigms to be
learnt in the same. In this report, I have presented the entire modelling segment of the
human skeleton model using OPENSIM classes in MATLAB. The code shall be utilised in
all versions of MATLAB and can be modified as per requirements.
1. Introduction:
In this internship, I have modelled various methods of scripting an OpenSim model
using MATLAB and XML. There are several factors which are needed to be considered
while constructing the entire model of the Musculoskeletal model of the human body
using just programming. There is a comprehensive class list on the OpenSim website
(predominantly built on C++). The extensive use of C++ in the module, however, made
it a little vague for the implementation of the same in other programming platforms like
MATLAB, XML or Python Scripts etc. The names of the classes have been stated in the
user manual along with their usages which made it rather clear to perform the
implementation of the code in the MATLAB and XML systems. Hence for making the
system perfect, I have cleared out the module and made an entire system of human
skeleton using the MATLAB and XML platforms, starting from scratch.
Figure 1: The class-list definitions as presented on SimTK website (source)
There has been a ambiguity in the application of the similar classes directly into the
MATLAB platform. Applications of most the above cited functions would result in an
error in the MATLAB command line window and hence required an important view to
find out the underlying commands that would lead to the generation of the model. There
Page | 2
are some examples in the website stating some of the commonly used applications of
specific commands, but they clearly miss out the applications of the human skeletal
system and have compared the actual body to that of free body diagrams and hence the
same cannot be considered as a commensurate for the real-life applications. For proper
experimentation, we need a proper model with proper dimensions and actuations .
Using the same, I am modelling the entire skeletal system of the human body using the
same, in a step-by-step manner.
2.1 Pelvis:
The human pelvis is the first piece to be considered for the starting of the base of the
human body. Based on the positioning of the pelvis in space the other system models
have been implemented and coded. The human pelvis has been placed out of no
boundaries in the visualisation space on the OpenSim environment. The human pelvis
has been depicted as an integration of three different bone sets.
In the meshing geometry section of the code, three VTP files have been used, namely:
‘pelvis.vtp’, ‘sacrum.vtp’, and ‘l_pelvis.vtp’. These files are already added in the
OpenSim geometry folder of respective systems. The ‘sacrum.vtp’ stands for the
segment in the middle of the diagram, against which the entire torso segment is
supported and the spinal cord along with the other skeletal systems are attached.
Whereas the ‘pelvis.vtp’ and ‘l_pelvis.vtp’ represents the right and left side of the
attached bones, respectively. The right and the left of the human gait model is attached
Page | 3
to the same, respectively. Now the possible method for the implementation of the same
in the form of a code is pretty intriguing. OpenSim and MATLAB follows a specific set of
rules and a systematic design format for the initialisation and attachment of the bodies
to each other and making them function in unison.
Figure 4: Initialisation of the Pelvis and setting some of the observed values of the body
The function ‘Body()’ is one of the class functions in the OpenSim library which
introduces a new set of body to the OpenSim environment. It declares to MATLAB that a
new body would be introduced and setting the properties of the same, based on the
demo samples already present on the OpenSim environment module. Here, the module
of 2392 has been preferred because of the additional sets of muscle derivations in the
system. However, the model of 2354 and 2392, anatomically remains the same.
Page | 4
Figure 5: Declaration of joints and further operations
After the declaration of the bone sets in the environment, we have to derive the relation
of the same with the environment. We declare a specialised joint, from the classes of
OpenSim. I have chosen ‘FreeJoint’ in this regard because it is the best matching form
of motion that can be replicated to that of the original movement of an individual. Free
Joint would allow the constant movement and rotation in every plane in the 3D space.
Some of the values are also implemented above are based on the experimentation and
largely varies from person-to-person.
Figure 6: Meshing the VTP files into the environment and adding them to the system
environment
After all the necessary steps, adding all the data and declaring all the joints, the object
(3D diagram) of the specific body parts are added and meshed into the system
environment and the final set is added to the OpenSim environment model. This brings
us to the end of the Pelvis declaration.
Page | 5
Figure 7: The Human Femur Bone
The majority of the force shall pass on through this segment of the body. The following
shall be initialised and attached to the main body segment as mentioned above. The
body (OBJ file) which would correspond to the segment is the ‘femur.vtp’ file. This file
would be directly connected to the right-hand side of the pelvis model. The coordinates
shall remain (0,0,0) w.r.t the original parent file, for the orientation. Whereas,
considering the location of the same, there would be a slight change in the coordinates
because of the change in the parent location and the base of the model, Since, the
model is placed at (0,0,0) w.r.t to the OpenSim environment, hence it is crucial to apply
the necessary changes otherwise the system would run into an error.
- Parent: 1 [Pelvis]
- Child: 1 [Tibia Right]
- One of the major possibilities of the error is the placement of the femur bone
w.r.t the pelvis of the skeletal system. If the coordinates are not adjusted
according to the requirements of the model, then there wouldn’t be an error
depicted in the MATLAB command window but during visualisation, there would
be an error.
Page | 6
Figure 9: Incorrect placement of the Femur w.r.t the Pelvis
The error can be fixed by placing the right coordinates for the location in parent,
which is (-0.0707, -0.0661,0.0835). This would eventually bring the bring the
femur to the right of the pelvis model and hence the accurate model would be
generated.
Figure 10: The code for the addition of the tibia into the system environment
The addition of the same, like others, remain the same, without any change. We have to
follow the same procedures as mentioned above to get the body attached into the
system and make it visualize in the OpenSim environment. But we have to be careful
while adding the following component into the body because we have the same anomaly
as discussed in the femur region. The body is not directly connected to the parent body
and is at a little offset to that of the parent. The exact dimensions for the same, as
shown is: (0, -0.38, 0). The error generated because of this value error would happen
similar to that of the figure 9. This might serious hinder the model and might happen to
Page | 7
disrupt the dynamics of the model. The updates in the joints are made in accordance to
the body of a human and the extent to which the particular segment can move. The
values can be manipulated based on the requirement of the model and the type of
motion that the user wants to simulate.
- Parent: 1 [Femur Right]
- Child: 1 [Talus Right]
Here, as well we can observe a slight deviation in the data for the connection of the
child model to that of the parent model. This changes actually fully fit the model into the
bone structure. The data has been counted as to be (0, -0.43, 0). Apart from that, we
can see a normal form of the instruction and not anything to be exclusive in nature.
- Parent: 1 [Tibia Right]
- Child: 1 [Calcaneus Right]
Page | 8
Figure 12: Adding Calcaneus to the model
This was a comprehensive idea about adding some of the important parts of the human
body and adding them into the system of human body in the OpenSim visualization
environment.
- Parent: 1 [Calcaneus Right]
- Child: -None-
2.7 Torso:
Page | 9
The torso stands for the upper part of the body. The anatomical term used to define the
central part of the body, which extends from the neck to the ribs. The torso includes:
the thoracic segment of the trunk, the abdominal segment of the trunk and the
perineum. For the OpenSim visualisation, we have collectively addressed the torso as
one single segment. However, it can be defined discreetly based on the demands of the
model to be analysed. Since we are moving ahead with the model of the below-knee
prosthesis settings hence we would be preferring the lower half of the body more
profoundly than the upper part of the body. Collectively, the segment of the torso has
been meshed and have been placed into the model. The model comprises of 4 files for
the visualization, ‘hat_spine.vtp’, ‘hat_jaw.vtp’, ‘hat_skull.vtp’, and ‘hat_ribs.vtp’ – which
corresponds to the various segments of the facial and other structural bones of the
human body in the upper and the central torso.
Figure 14: The instantiation of the Torso and the joints associated with the same
Now since the joints have been instantiated then there is a requirement for certain
parameters to be assigned to the same for the process of creating a model of utmost
reality and which resembles the nature of the actual human skeleton.
- Parent: 1 [Pelvis]
- Child: -None-
Page | 10
Figure 15: Changing the parameters of the movement and also adding the geometry
files to the system
The torso model would be automatically placed and well attached to the previous
created model of the lower segment of the body. This has created the entire model of
the human skeleton (without the ends). The hands have been removed here because of
the fact that they sometimes create unnecessary vibrations on the body during gait that
might hinder the results. However, these results might be useful if we are considering
to make something for the people with osteoarthritis or osteoporosis, because the hand
vibrations would then create an efficient model of locomotion and movement.
Notice the nuances in the ‘LocationInParent’ variable in figure 15. This is quite different
to that of the one described in figure 8. The only difference that can be observed in
between the two is the difference in the Z-axis. Since the model is horizontally opposite
to that of the Femur Right [2.2]. The possible errors remain to be same and no other
extra outcomes of errors are possible, as of now.
- Parent: 1 [Pelvis]
- Child: 1 [Tibia Left]
Page | 11
Figure 17: The instantiation, adding and
changing the parameters of the tibia left
segment
Similar to the [2.4], there has been no changes in the ‘LocationInParent’ because of the
fact that the Z-axis is turned to zero and hence it makes no sense to have a negative end
to the zero segment.
- Parent: 1 [Tibia Left]
- Child: 1 [Calcaneus Left]
Page | 12
Figure 19: The instantiation adding of parameters of the subtalar joints and the
corresponding bones
It has to be noted here, that the z-axis is not zero and hence there would be significant
difference in reference to that of the description showed in [2.5]. So, the z-axis would
have the exact negative to that of what shown in [2.5].
- Parent: 1 [Talus Left]
- Child: 1[Toes Left]
It has to be noted here, that the z-axis is not zero and hence there would be significant
difference in reference to that of the description showed in [2.6]. So, the z-axis would
have the exact negative to that of what shown in [2.6].
- Parent: 1 [Calcaneus Left]
- Child: -None-
Page | 13
Vec3 () Vector (3-D) representation in any form
FreeJoint () Adding free-joint to the bodies and connecting them
FreeJoint.upd_coordinat Updating the coordinates in the motion
es ()
FreeJoint.setRange () Sets the range for the movement in the joints
Model () Instantiating a model that is our prime focus
Model.finalizeConnectio Finalize the connections and make the model forward for
ns () generation
Model.print () Printing the model into a .osim file (readable by the
OpenSim software)
Using these functions, the entire model has been prepared. The entire code of the same
is present in the repository.
4. Results
Figure 21: Correlating the data from 2392 model and from the created model
From the above figures, we can determine that we have almost matched both the flexion
and adduction readings in out pilot testing. The model requires further grooming as to
receive the proper interaction with the environment. Some of the joint angles and
features are to be determined externally using experiments and hence laterwards can
be implemented directly. Some of the important results include the vibrational features
that the model experience while performing the gait, for a fixed amount of time.
5. Future Work
For future work, the same model can be enhanced into utilisation in several domains,
like prosthetic analysis and fracture analysis. One of the major tasks would be to make
the system user friendly and make any MATLAB access the diversity of the modelling a
musculoskeletal model. In terms of documentation, a proper website or information
Page | 14
brochure can be designed dedicated to the modelling parameters of the human model
and hence finding the optimum gait mechanism. In the report some of the functions
(that have been heavily used in modelling the sections have been mentioned), while
others are subjected to frequent experimentations.
6. Code
Here is the full code prepared for the demonstration of the same.
%% Geometry path
path = 'C:\OpenSim 4.1\Geometry';
ModelVisualizer.addDirToGeometrySearchPaths(path);
%% Adding ground
ground = myModel.getGround();
%
% % Add display geometry to the ground to visualize in the GUI
% % For the ground plane, an arbitrary plane of 5X5X(0.2)mm^3 shape is
taken
ground.attachGeometry(Mesh('treadmill.vtp'));
% --------------------------------------------------------------------
%% Adding pelvis
pelvis = Body();
pelvis.setName('pelvis');
pelvis.setMass(11.777);
pelvis.setMassCenter(Vec3(-0.0707,0,0));
pelvis.setInertia(Inertia(0.1028,0.0871,0.0579,0,0,0));
pelvis_tilt = ground_pelvis.upd_coordinates(0);
pelvis_tilt.setName('pelvis_tilt');
pelvis_tilt.setRange([-1.57079633, 1.57079633]);
pelvis_tilt.setDefaultValue(0);
pelvis_list = ground_pelvis.upd_coordinates(1);
pelvis_list.setName('pelvis_list');
pelvis_list.setRange([-1.57079633, 1.57079633]);
pelvis_list.setDefaultValue(0);
Page | 15
pelvis_rotation = ground_pelvis.upd_coordinates(2);
pelvis_rotation.setName('pelvis_rotation');
pelvis_rotation.setRange([-1.57079633, 1.57079633]);
pelvis_rotation.setDefaultValue(0);
pelvis_tx = ground_pelvis.upd_coordinates(3);
pelvis_tx.setRange([-5,5]);
pelvis_tx.setName('pelvis_tx');
pelvis_tx.setDefaultValue(0);
pelvis_tx.setDefaultSpeedValue(0);
pelvis_ty = ground_pelvis.upd_coordinates(4);
pelvis_ty.setRange([-1,2]);
pelvis_ty.setName('pelvis_ty');
pelvis_ty.setDefaultValue(0.95);
pelvis_ty.setDefaultSpeedValue(0);
pelvis_tz = ground_pelvis.upd_coordinates(5);
pelvis_tz.setRange([-3,3]);
pelvis_tz.setName('pelvis_tz');
pelvis_tz.setDefaultValue(0);
pelvis_tz.setDefaultSpeedValue(0);
hip_adduction_r = hip_r.upd_coordinates(1);
hip_adduction_r.setRange([-2.0943951, 2.0943951]);
Page | 16
hip_adduction_r.setName('hip_adduction_r');
hip_adduction_r.setDefaultValue(0);
hip_adduction_r.setDefaultSpeedValue(0);
hip_rotation_r = hip_r.upd_coordinates(1);
hip_rotation_r.setRange([-2.0943951, 2.0943951]);
hip_rotation_r.setName('hip_adduction_r');
hip_rotation_r.setDefaultValue(0);
hip_rotation_r.setDefaultSpeedValue(0);
femur_r.attachGeometry(Mesh('femur_r.vtp'));
myModel.addJoint(hip_r);
myModel.addBody(femur_r);
% --------------------------------------------------------------------
% % Adding Tibia_Right
tibia_r = Body();
tibia_r.setName('tibia_r');
tibia_r.setMass(3.7075);
tibia_r.setMassCenter(Vec3(0,-0.1867,0));
tibia_r.setInertia(Inertia(0.0504,0.0051,0.0511,0,0,0));
LocationInParent = Vec3(0,-0.38,0);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
knee_angle_r = knee_r.upd_coordinates(0);
knee_angle_r.setName('knee_angle_r');
knee_angle_r.setRange([-2.0943951, 0.17453293]);
knee_angle_r.setDefaultValue(0);
knee_angle_r.setDefaultSpeedValue(0);
tibia_r.attachGeometry(Mesh('tibia_r.vtp'));
tibia_r.attachGeometry(Mesh('fibula.vtp'));
myModel.addJoint(knee_r);
myModel.addBody(tibia_r);
% --------------------------------------------------------------------
% Adding the Talus Right
talus_r = Body();
talus_r.setName('talus_right');
talus_r.setMass(0.10000000000000001);
talus_r.setMassCenter(Vec3(0,-0.1867,0));
talus_r.setInertia(Inertia(0.0504,0.0051000000000000004,0.0511,0,0,0));
LocationInParent = Vec3(0,-0.43,0);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
Page | 17
ankle_angle_r = ankle_r.upd_coordinates(0);
ankle_angle_r.setName('ankle_angle_r');
ankle_angle_r.setRange([-1.57079633, 1.57079633]);
ankle_angle_r.setDefaultValue(0);
ankle_angle_r.setDefaultSpeedValue(0);
talus_r.attachGeometry(Mesh('talus.vtp'));
myModel.addJoint(ankle_r);
myModel.addBody(talus_r);
% --------------------------------------------------------------------
% Adding Calcn Right
calcn_r = Body();
calcn_r.setName('calcn_r');
calcn_r.setMass(1.25);
calcn_r.setMassCenter(Vec3(0.10000000000000001,0.02999999999999999,0));
calcn_r.setInertia(Inertia(0.0014,0.0038999999999999998,0.00410000000000000
03,0,0,0));
LocationInParent = Vec3(-0.04877,-0.04195,0.00792);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
subtalar_angle_r = subtalar_r.upd_coordinates(0);
subtalar_angle_r.setName('subtalar_angle_r');
subtalar_angle_r.setRange([-1.57079633, 1.57079633]);
subtalar_angle_r.setDefaultValue(0);
subtalar_angle_r.setDefaultSpeedValue(0);
calcn_r.attachGeometry(Mesh('foot.vtp'));
myModel.addJoint(subtalar_r);
myModel.addBody(calcn_r);
% --------------------------------------------------------------------
% Adding Toes_right
toes_r = Body();
toes_r.setName('toes_r');
toes_r.setMass(0.21659999999999999);
toes_r.setMassCenter(Vec3(0.034599999999999999,0.0060000000000000001,-
0.017500000000000002));
toes_r.setInertia(Inertia(0.0001,0.00020000000000000001,0.0001,0,0,0));
LocationInParent = Vec3(0.1788,-0.002,0.00108);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
mtp_angle_r = mtp_r.upd_coordinates(0);
mtp_angle_r.setName('mtp_angle_r');
mtp_angle_r.setRange([-1.57079633, 1.57079633]);
Page | 18
mtp_angle_r.setDefaultValue(0);
mtp_angle_r.setDefaultSpeedValue(0);
toes_r.attachGeometry(Mesh('bofoot.vtp'));
myModel.addJoint(mtp_r);
myModel.addBody(toes_r);
% --------------------------------------------------------------------
% Adding the prosthesis
pros_r = Body();
pros_r.setName('pros_r');
pros_r.setMass(1.5666);
pros_r.setMassCenter(Vec3(0,-0.1867,0));
pros_r.setInertia(Inertia(0,0,0,0,0,0));
LocationInParent = Vec3(-10,-10,10);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,-90,0);
foot_angle_l = foot_r.upd_coordinates(0);
foot_angle_l.setName('foot_angle_r');
foot_angle_l.setRange([-2.0943951, 0.17453293]);
foot_angle_l.setDefaultValue(0);
foot_angle_l.setDefaultSpeedValue(0);
pros_r.attachGeometry(Mesh('humanfootv5.obj'));
myModel.addJoint(foot_r);
myModel.addBody(pros_r);
% --------------------------------------------------------------------
% Adding Femur_Left
femur_l = Body();
femur_l.setName('femur_l');
femur_l.setMass(9.3014);
femur_l.setMassCenter(Vec3(0,-0.17,0));
femur_l.setInertia(Inertia(0.1339,0.0351,0.14121,0,0,0));
LocationInParent = Vec3(-0.0707,-0.0611,-0.0835);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
hip_adduction_l = hip_l.upd_coordinates(1);
Page | 19
hip_adduction_l.setRange([-2.0943951, 2.0943951]);
hip_adduction_l.setName('hip_adduction_l');
hip_adduction_l.setDefaultValue(0);
hip_adduction_l.setDefaultSpeedValue(0);
hip_rotation_l = hip_l.upd_coordinates(2);
hip_rotation_l.setRange([-2.0943951, 2.0943951]);
hip_rotation_l.setName('hip_adduction_l');
hip_rotation_l.setDefaultValue(0);
hip_rotation_l.setDefaultSpeedValue(0);
femur_l.attachGeometry(Mesh('femur_l.vtp'));
myModel.addJoint(hip_l);
myModel.addBody(femur_l);
% --------------------------------------------------------------------
% Adding Tibia_left
tibia_l = Body();
tibia_l.setName('tibia_l');
tibia_l.setMass(0.0504);
tibia_l.setMassCenter(Vec3(0,-0.1867,0));
tibia_l.setInertia(Inertia(0.0504,0.0051,0.0511,0,0,0));
LocationInParent = Vec3(0,-0.38,0);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
knee_angle_l = knee_l.upd_coordinates(0);
knee_angle_l.setName('knee_angle_r');
knee_angle_l.setRange([-2.0943951, 0.17453293]);
knee_angle_l.setDefaultValue(0);
knee_angle_l.setDefaultSpeedValue(0);
tibia_l.attachGeometry(Mesh('tibia_l.vtp'));
tibia_l.attachGeometry(Mesh('l_fibula.vtp'));
myModel.addJoint(knee_l);
myModel.addBody(tibia_l);
% --------------------------------------------------------------------
% Adding Talus_Left
talus_l = Body();
talus_l.setName('talus_l');
talus_l.setMass(0.1);
talus_l.setMassCenter(Vec3(0,0,0));
talus_l.setInertia(Inertia(0.001,0.001,0.001,0,0,0));
LocationInParent = Vec3(0,-0.43,0);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
Page | 20
subtalar_angle_l = subtalar_l.upd_coordinates(0);
subtalar_angle_l.setName('ankle_angle_l');
subtalar_angle_l.setRange([-1.57079633, 1.57079633]);
subtalar_angle_l.setDefaultValue(0);
subtalar_angle_l.setDefaultSpeedValue(0);
talus_l.attachGeometry(Mesh('l_talus.vtp'));
myModel.addJoint(subtalar_l);
myModel.addBody(talus_l);
% --------------------------------------------------------------------
% Adding Calcn_Left
calcn_l = Body();
calcn_l.setName('calcn_l');
calcn_l.setMass(1.25);
calcn_l.setMassCenter(Vec3(0.1,0.03,0));
calcn_l.setInertia(Inertia(0.0014,0.0039,0.0041,0,0,0));
subtalar_angle_l = subtalar_l.upd_coordinates(0);
subtalar_angle_l.setName('subtalar_angle_l');
subtalar_angle_l.setRange([-1.57079633, 1.57079633]);
subtalar_angle_l.setDefaultValue(0);
subtalar_angle_l.setDefaultSpeedValue(0);
calcn_l.attachGeometry(Mesh('l_foot.vtp'));
myModel.addJoint(subtalar_l);
myModel.addBody(calcn_l);
% --------------------------------------------------------------------
% Adding Toes_Left
toes_l = Body();
toes_l.setName('toes_l');
toes_l.setMass(0.2166);
toes_l.setMassCenter(Vec3(0.0346,0.006,0.0175));
toes_l.setInertia(Inertia(0.0001,0.0002,0.0001,0,0,0));
LocationInParent = Vec3(0.1788,-0.002,-0.00108);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
mtp_angle_l = mtp_l.upd_coordinates(0);
mtp_angle_l.setName('mtp_angle_l');
mtp_angle_l.setRange([-1.57079633, 1.57079633]);
mtp_angle_l.setDefaultValue(0);
Page | 21
mtp_angle_l.setDefaultSpeedValue(0);
toes_l.attachGeometry(Mesh('l_bofoot.vtp'));
myModel.addJoint(mtp_l);
myModel.addBody(toes_l);
ground = Body();
ground.setName('ground');
ground.attachGeometry(Mesh('treadmill.vtp'));
% --------------------------------------------------------------------
% Adding Torso
torso = Body();
torso.setName('torso');
torso.setMass(34.2366);
torso.setMassCenter(Vec3(-0.03,0.32,0));
torso.setInertia(Inertia(1.47445,0.7555,1.4317,0,0,0));
LocationInParent = Vec3(-0.1007,0.0815,0);
OrientationInParent = Vec3(0,0,0);
LocationInChild = Vec3(0,0,0);
OrientationInChild = Vec3(0,0,0);
lumbar_extension = back.upd_coordinates(0);
lumbar_extension.setName('lumbar_extension');
lumbar_extension.setRange([-1.57079633, 1.57079633]);
lumbar_extension.setDefaultValue(0);
lumbar_extension.setDefaultSpeedValue(0);
lumbar_bending = back.upd_coordinates(1);
lumbar_bending.setName('lumbar_bending');
lumbar_bending.setRange([-1.57079633, 1.57079633]);
lumbar_bending.setDefaultValue(0);
lumbar_bending.setDefaultSpeedValue(0);
lumbar_rotation = back.upd_coordinates(2);
lumbar_rotation.setName('lumbar_rotation');
lumbar_rotation.setRange([-1.57079633, 1.57079633]);
lumbar_rotation.setDefaultValue(0);
lumbar_rotation.setDefaultSpeedValue(0);
torso.attachGeometry(Mesh('hat_spine.vtp'));
torso.attachGeometry(Mesh('hat_jaw.vtp'));
torso.attachGeometry(Mesh('hat_skull.vtp'));
torso.attachGeometry(Mesh('hat_ribs.vtp'));
myModel.addJoint(back);
myModel.addBody(torso);
% --------------------------------------------------------------------
% Final Print of the Model
myModel.finalizeConnections();
myModel.finalizeConnections();
myModel.print('modelfixed.osim');
Page | 22
---THE END---
Page | 23