Page 1 of 1

RRA/CMC problems

Posted: Fri Oct 15, 2010 3:13 am
by andrewlewis
Hi,

I am having issues with OpenSim crashing and shutting down when I try and run the CMC tool with this Lower Limb Model through the OpenSim GUI.

From my (brief) experience of using OpenSim I have learnt to use the CMC tool twice for the purposes of residual reduction (RRA) by replacing the muscle actuators with joint and global reserve actuators. The first run to alter the model CoM (& mass) and the second run to alter the kinematics to closer match the GRF. I then run the CMC tool a third time to generate muscle activation data by keeping the model's muscle actuators and adding the joint and global actuators as reserves.

I have successfully run both RRAs and CMC on a kinematic & kinetic dataset collected in our gait lab using the gait2392 model. However when I try to run the 1st RRA on the Lower Limb Model using this same dataset and set-up files, OpenSim crashes on the first time-step.

I re-ran the IK tool for the new model as I know that some of the joint contraints have changed from the gait2392 model. I have tried using both fast and slow optimisation targets, both ipopt and cfsqp optimisers, both *.mot and *.sto as the kinematic input file types and both with and without kinematic filtering (all tricks which seems to help before) but OpenSim still crashes.

Am I being stupid tying to use the same set-up files as I used with gait2392 or should it work?

Any help much appreciated.
Thanks,
Andy

RE: RRA/CMC problems

Posted: Wed Oct 20, 2010 6:21 pm
by emarnold
Hi Andy,
I started from some gait2392 setup files, then modified them to work with my model, so there's nothing wrong with that strategy, but it's always tricky to get all the options just right in an RRA or CMC setup.

The first thing I would suggest is running CMC in the command line, not the GUI. This will do two things: it will give you a little more information about where things are falling apart since the printout won't disappear when the gui crashes, and it will be a little faster. This model has many more wrapping surfaces than gait2392 and is correspondingly slower. CMC will still be slow. I was leaving the cmc simulation to run overnight for 1 gait cycle, but RRA runs in about 5 minutes.

Here are the steps to run cmc (or any tool) in the command line:
In Windows, go the the Start menu, select Run, type cmd, and click OK to open a command window.
Navigate the the folder where your setup file is. (e.g. "cd My Documents\mysimulation\setupfiles")
Type the path to the tool you want to use, followed by -S and the name of the setup file.
i.e.
c:\Program Files\OpenSim 2.0\bin\cmc.exe -S mySetupFile_RRA.xml
Hit Enter.

Use cmc.exe to run RRA, the difference is the adjust_com and replace actuator set flags. I used cfsqp and the slow optimizer. I used the .mot output from IK as the desired kinematics.
I'm not sure if the current version prints the intermediate output if the tool doesn't run to completion, but there should be an out.log file. It's hard to tell what's going on with the RRA setup file without seeing it or the out.log. If you send me those I'll be happy to look at them.

I'll post an abbreviated version of my out.log for RRA in the next comment so you can compare.
-Edith

RE: RRA/CMC problems

Posted: Wed Oct 20, 2010 6:32 pm
by emarnold
-------------------------------------------------------
This program includes software developed by the
Apache Software Foundation (http://www.apache.org/).
-------------------------------------------------------

Constructing investigation from setup file de2_ss_walk1_Setup_RRA1_LEM2009.xml.

AbstractTool de2_ss_walk1_RRA1 loading model 'LEM2009_Schutte1993_scaled_de2_tightSM.osim'
Created model de2_LEM2009_032410 from file LEM2009_Schutte1993_scaled_de2_tightSM.osim
Adding force object set from de2_ss_walk1_RRA_Actuators.xml
-----------------------------------------------------------------------
Loaded library
-----------------------------------------------------------------------
MODEL: de2_LEM2009_032410
forces: 19
analyses: 0
bodies: 21
joints: 20
markers: 39
-----------------------------------------------------------------------

Running tool de2_ss_walk1_RRA1.


taskSet size = 19



WARN- a desired points file was not specified.



Loading desired kinematics from file de2_ss_walk1_ik_LEM2009.mot ...

Loading q's from file de2_ss_walk1_ik_LEM2009.mot.
Storage: file=de2_ss_walk1_ik_LEM2009.mot (nr=100 nc=171)
Found 100 q's with time stamps ranging
from 0.5 to 2.15.


Low-pass filtering desired kinematics with a cutoff frequency of 6...

MODEL: de2_LEM2009_032410

ANALYSES (0)

BODIES (21)
body[0] = ground (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
body[1] = pelvis (mass: 10.3018) (inertia: 0.0880115 0 0 0 0.0745701 0 0 0 0.0495707)
body[2] = femur_r (mass: 8.13627) (inertia: 0.125972 0 0 0 0.0330217 0 0 0 0.132839)
body[3] = femur_wlkr_r (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
body[4] = tibia_wlkr_r (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
body[5] = tibia_r (mass: 3.24308) (inertia: 0.0546462 0 0 0 0.00552967 0 0 0 0.0554052)
body[6] = shaft_axis_r (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
body[7] = patella_r (mass: 0.0754023) (inertia: 2.7e-006 0 0 0 1.233e-005 0 0 0 1.233e-005)
body[8] = talus_r (mass: 0.0874736) (inertia: 0.00108425 0 0 0 0.00108425 0 0 0 0.00108425)
body[9] = calcn_r (mass: 1.09342) (inertia: 0.00123883 0 0 0 0.00345102 0 0 0 0.003628)
body[10] = toes_r (mass: 0.189468) (inertia: 8.849e-005 0 0 0 0.00017698 0 0 0 0.00088488)
body[11] = femur_l (mass: 8.13627) (inertia: 0.125972 0 0 0 0.0330217 0 0 0 0.132839)
body[12] = femur_wlkr_l (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
body[13] = tibia_wlkr_l (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
body[14] = tibia_l (mass: 3.24308) (inertia: 0.0546462 0 0 0 0.00552967 0 0 0 0.0554052)
body[15] = shaft_axis_l (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
body[16] = patella_l (mass: 0.0754023) (inertia: 2.7e-006 0 0 0 1.233e-005 0 0 0 1.233e-005)
body[17] = talus_l (mass: 0.0874736) (inertia: 0.00108425 0 0 0 0.00108425 0 0 0 0.00108425)
body[18] = calcn_l (mass: 1.09342) (inertia: 0.00123883 0 0 0 0.00345102 0 0 0 0.003628)
body[19] = toes_l (mass: 0.189468) (inertia: 8.849e-005 0 0 0 0.00017698 0 0 0 0.00088488)
body[20] = torso (mass: 29.948) (inertia: 1.53537 0 0 0 0.786687 0 0 0 1.49049)

ACTUATORS (19)
actuator[0] = FX
actuator[1] = FY
actuator[2] = FZ
actuator[3] = MX
actuator[4] = MY
actuator[5] = MZ
actuator[6] = hip_flexion_r
actuator[7] = hip_adduction_r
actuator[8] = hip_rotation_r
actuator[9] = knee_angle_r
actuator[10] = ankle_angle_r
actuator[11] = hip_flexion_l
actuator[12] = hip_adduction_l
actuator[13] = hip_rotation_l
actuator[14] = knee_angle_l
actuator[15] = ankle_angle_l
actuator[16] = lumbar_extension
actuator[17] = lumbar_bending
actuator[18] = lumbar_rotation
numStates = 58
numCoordinates = 29
numSpeeds = 29
numActuators = 19
numBodies = 21
numConstraints = 6

STATES (58)
y[0] = pelvis_tilt
y[1] = pelvis_list
y[2] = pelvis_rotation
y[3] = pelvis_tx
y[4] = pelvis_ty
y[5] = pelvis_tz
y[6] = hip_flexion_r
y[7] = hip_adduction_r
y[8] = hip_rotation_r
y[9] = knee_angle_r
y[10] = patellofemoral_r_r3
y[11] = patellofemoral_r_tx
y[12] = patellofemoral_r_ty
y[13] = ankle_angle_r
y[14] = subtalar_angle_r
y[15] = mtp_angle_r
y[16] = hip_flexion_l
y[17] = hip_adduction_l
y[18] = hip_rotation_l
y[19] = knee_angle_l
y[20] = patellofemoral_l_r3
y[21] = patellofemoral_l_tx
y[22] = patellofemoral_l_ty
y[23] = ankle_angle_l
y[24] = subtalar_angle_l
y[25] = mtp_angle_l
y[26] = lumbar_extension
y[27] = lumbar_bending
y[28] = lumbar_rotation
y[29] = pelvis_tilt_u
y[30] = pelvis_list_u
y[31] = pelvis_rotation_u
y[32] = pelvis_tx_u
y[33] = pelvis_ty_u
y[34] = pelvis_tz_u
y[35] = hip_flexion_r_u
y[36] = hip_adduction_r_u
y[37] = hip_rotation_r_u
y[38] = knee_angle_r_u
y[39] = patellofemoral_r_r3_u
y[40] = patellofemoral_r_tx_u
y[41] = patellofemoral_r_ty_u
y[42] = ankle_angle_r_u
y[43] = subtalar_angle_r_u
y[44] = mtp_angle_r_u
y[45] = hip_flexion_l_u
y[46] = hip_adduction_l_u
y[47] = hip_rotation_l_u
y[48] = knee_angle_l_u
y[49] = patellofemoral_l_r3_u
y[50] = patellofemoral_l_tx_u
y[51] = patellofemoral_l_ty_u
y[52] = ankle_angle_l_u
y[53] = subtalar_angle_l_u
y[54] = mtp_angle_l_u
y[55] = lumbar_extension_u
y[56] = lumbar_bending_u
y[57] = lumbar_rotation_u


Loading external loads kinematics from file de2_ss_walk1_ik_LEM2009.mot ...
Storage: file=de2_ss_walk1_ik_LEM2009.mot (nr=100 nc=171)
Low-pass filtering external load kinematics with a cutoff frequency of 6...
Storage: file=C:\Documents and Settings\emarnold\My Documents\FiberLengthWalkingSimulation\SchutteModel\de2_ss_walk1_grf.mot (nr=9009 nc=19)

Note: requested COM adjustment time range 0.51 - 2.15 clamped to nearest available data times 0.508 - 2.14

Computing average residuals between 0.508 and 2.14
Average residuals before adjusting torso COM:
FX=-1.96657 FY=2.26348 FZ=-1.69873
MX=8.09696 MY=-1.93171 MZ=3.27406

CMCTool.adjustCOMToReduceResiduals:
torso weight = 293.689
dx=0.011148, dz=-0.0275698

dmass = -0.230811

Recommended mass adjustments:
ground: orig mass = 0, new mass = 0
pelvis: orig mass = 10.3018, new mass = 10.2657
femur_r: orig mass = 8.13627, new mass = 8.10777
femur_wlkr_r: orig mass = 0, new mass = 0
tibia_wlkr_r: orig mass = 0, new mass = 0
tibia_r: orig mass = 3.24308, new mass = 3.23173
shaft_axis_r: orig mass = 0, new mass = 0
patella_r: orig mass = 0.0754023, new mass = 0.0751382
talus_r: orig mass = 0.0874736, new mass = 0.0871672
calcn_r: orig mass = 1.09342, new mass = 1.08959
toes_r: orig mass = 0.189468, new mass = 0.188804
femur_l: orig mass = 8.13627, new mass = 8.10777
femur_wlkr_l: orig mass = 0, new mass = 0
tibia_wlkr_l: orig mass = 0, new mass = 0
tibia_l: orig mass = 3.24308, new mass = 3.23173
shaft_axis_l: orig mass = 0, new mass = 0
patella_l: orig mass = 0.0754023, new mass = 0.0751382
talus_l: orig mass = 0.0874736, new mass = 0.0871672
calcn_l: orig mass = 1.09342, new mass = 1.08959
toes_l: orig mass = 0.189468, new mass = 0.188804
torso: orig mass = 29.948, new mass = 29.8431

Computing average residuals between 0.508 and 2.14
Average residuals after adjusting torso COM:
FX=-1.83026 FY=2.62122 FZ=-1.6874
MX=-0.192093 MY=-1.95234 MZ=0.583737


Constructing function set for tracking desired kinematics...

No Actuation analysis found in analysis set -- adding one
No Kinematics analysis found in analysis set -- adding one
Using the generalized coordinates specified in de2_ss_walk1_ik_LEM2009.mot to set the initial configuration.
Successfully linked to CFSQP library 'osimCFSQP.dll'
Using CFSQP optimizer algorithm.

Setting optimizer print level to 2.
Setting optimizer convergence criterion to 1e-006.
Setting optimizer maximum iterations to 2000.

Setting cmc controller to not use verbose printing.
CMC.computeControls: t = 0.51



================================================================
================================================================
Using CMC to track the specified kinematics
Integrating from 0.51 to 2.15
Start time = Fri Apr 16 11:25:14 2010
================================================================
CMC.computeControls: t = 0.51
CMC.computeControls: t = 0.511
CMC.computeControls: t = 0.512
more time steps...
CMC.computeControls: t = 2.147
CMC.computeControls: t = 2.148
CMC.computeControls: t = 2.149
----------------------------------------------------------------
Finished tracking the specified kinematics
=================================================================
Start time = Fri Apr 16 11:25:14 2010
Finish time = Fri Apr 16 11:29:32 2010
Elapsed time = 258 seconds.
================================================================


Printing results of investigation de2_ss_walk1_RRA1 to ResultsRRA1st/.


Average residuals:
FX=-1.72189 FY=2.73357 FZ=-1.68177
MX=-0.0284871 MY=-2.08945 MZ=0.439929


RE: RRA/CMC problems

Posted: Mon Oct 25, 2010 4:04 am
by andrewlewis
Hi Edith,
Running the CMC tool from the windows command line worked a treat. I have now sucessfully run both RRA and CMC for my dataset.
Thanks for your help,
Andy