error in CMC and forward dynamics: causes?
- Will Johnson
- Posts: 3
- Joined: Thu Aug 23, 2007 7:52 pm
error in CMC and forward dynamics: causes?
I've been developing a rat hindlimb model with custom knee joints, using OpenSim v1.7. The model performs as expected through the workflow up until CMC, at which point I get the following error in what I assume is the forward integration step:
rdCMC.computeControls: t = 0.23
RKF.step: NAN in state 1 at time 0.23 (dt = 1e-006)
The error repeats with dt decreasing until it reaches the minimum step size. The set of errors is then repeated many times without crashing the program.
My first thought is that there are NaN's in the kinematic input, but I've checked the output of the RRA steps (i.e. *_Kinematics_q.sto), and all coordinates have the correct values. My second thought is that a segment mass or inertia has somehow been set to zero, but I've double checked those as well and they're all positive except for the ground segment, which is zero in some of the example models and doesn't cause the same problem.
The only obvious difference between my input files and the examples is in the motion file input to the RRA step, which in the example includes ground reaction force data. Is it necessary to include the grf data in the motion file or is it sufficient to specify it in the external loads file? In the examples it's included in both inputs.
The same error occurs when any control input is used with the experimental grf data in the forward dynamics step.
I'm currently using "artificial" standing data as a test, that is many rows of identical coordinates, so all velocities and accelerations are zero. It doesn't seem like that should be a problem though.
Anyone encounter a similar error, or do any developers have insight into what commonly causes that error? Any help would be appreciated.
rdCMC.computeControls: t = 0.23
RKF.step: NAN in state 1 at time 0.23 (dt = 1e-006)
The error repeats with dt decreasing until it reaches the minimum step size. The set of errors is then repeated many times without crashing the program.
My first thought is that there are NaN's in the kinematic input, but I've checked the output of the RRA steps (i.e. *_Kinematics_q.sto), and all coordinates have the correct values. My second thought is that a segment mass or inertia has somehow been set to zero, but I've double checked those as well and they're all positive except for the ground segment, which is zero in some of the example models and doesn't cause the same problem.
The only obvious difference between my input files and the examples is in the motion file input to the RRA step, which in the example includes ground reaction force data. Is it necessary to include the grf data in the motion file or is it sufficient to specify it in the external loads file? In the examples it's included in both inputs.
The same error occurs when any control input is used with the experimental grf data in the forward dynamics step.
I'm currently using "artificial" standing data as a test, that is many rows of identical coordinates, so all velocities and accelerations are zero. It doesn't seem like that should be a problem though.
Anyone encounter a similar error, or do any developers have insight into what commonly causes that error? Any help would be appreciated.
- Lisa MacFadden
- Posts: 18
- Joined: Mon Aug 20, 2007 3:01 pm
RE: error in CMC and forward dynamics: causes?
Hi Will,
I am having this same problem and was wondering if you had figured out how to overcome the RKF.step NAN error. My error is in state 0 instead of in state 1.
Cheers
Lisa
I am having this same problem and was wondering if you had figured out how to overcome the RKF.step NAN error. My error is in state 0 instead of in state 1.
Cheers
Lisa
- Will Johnson
- Posts: 3
- Joined: Thu Aug 23, 2007 7:52 pm
RE: error in CMC and forward dynamics: causes?
Never did solve this problem completely. I'm developing a rat model and when I initially had this problem I had a couple muscles with approximately zero tendon length and modeled them with zero length. The musculotendon dynamics require dividing by tendon slack length though, so obviously that's where my NaNs were coming from. I gave all my muscles a minimum tendon length of 1mm, and still get a similar problem but now the NaN's start to crop up in state 37 for example, which is a muscle length state.
I suspect my current problem is a scaling issue. Even non-zero short tendon slack lengths could cause some instability depending on how the musculotendon dynamics are implemented. One potential solution is to scale everything up and use a giant monster rat model but I haven't gotten around to doing that yet, I've just gone with static optimization for the time being, it gives adequate results for my current purposes.
From what I recall another thing that can cause this problem is not correctly defining segment masses or inertias.
I suspect my current problem is a scaling issue. Even non-zero short tendon slack lengths could cause some instability depending on how the musculotendon dynamics are implemented. One potential solution is to scale everything up and use a giant monster rat model but I haven't gotten around to doing that yet, I've just gone with static optimization for the time being, it gives adequate results for my current purposes.
From what I recall another thing that can cause this problem is not correctly defining segment masses or inertias.
- Lisa MacFadden
- Posts: 18
- Joined: Mon Aug 20, 2007 3:01 pm
RE: error in CMC and forward dynamics: causes?
Will,
Thanks for your reply. I am using a feline hindlimb model I developed.
1. I am using the wrong muscle model (I am using model 4 instead of modal 9)
2. I have not properly defined the dynamic muscle properties in the model.
Since my error is state 0 instead of state 1, I am assuming that my error is in computing muscle activation instead of muscle length, but will also look into the length problem as you suggest.
Thanks again!
Lisa
Thanks for your reply. I am using a feline hindlimb model I developed.
1. I am using the wrong muscle model (I am using model 4 instead of modal 9)
2. I have not properly defined the dynamic muscle properties in the model.
Since my error is state 0 instead of state 1, I am assuming that my error is in computing muscle activation instead of muscle length, but will also look into the length problem as you suggest.
Thanks again!
Lisa
- Will Johnson
- Posts: 3
- Joined: Thu Aug 23, 2007 7:52 pm
RE: error in CMC and forward dynamics: causes?
I recall trying models 4 and 9 (Schutte and Thalen I believe) and getting slightly different errors, but in the same general place, so I suspect the root cause is the same.
Are you getting errors in RRA (with only generalized torque actuators) as well as CMC? If that's the case you may have a problem other than muscle definitions as the musculotendon dynamics wouldn't come into play at that point.
Not defining some of the dynamic muscle properties, or using approximate values definitely seems like it could cause the problems you're seeing. The dynamic equations can be pretty sensitive to some parameters (e.g. optimal fiber and tendon lengths).
will
Are you getting errors in RRA (with only generalized torque actuators) as well as CMC? If that's the case you may have a problem other than muscle definitions as the musculotendon dynamics wouldn't come into play at that point.
Not defining some of the dynamic muscle properties, or using approximate values definitely seems like it could cause the problems you're seeing. The dynamic equations can be pretty sensitive to some parameters (e.g. optimal fiber and tendon lengths).
will
- Lisa MacFadden
- Posts: 18
- Joined: Mon Aug 20, 2007 3:01 pm
RE: error in CMC and forward dynamics: causes?
Thanks for the info. I have successfully run Scaling, IK, ID, static opt, and RRA and now just have issues with CMC. So I think it has to be the muscles, and since I am not having issues with Static Optimization I think it has to be some of the dynamic properties including time constants, etc that are causing my simulation to crash.
I am pretty confident in my pennation angle, optimal fiber length, tendon slack length, and max isometric force, however i think the dynamic properties of the muscles are undefined which could cause problems. I seem to recall in SIMM that it would cause errors if you ran simulations without those properties properly defined when you were running even static optimization.
I will probably get around to changing those parameters over the weekend and let you know if I have success!
Thanks for your suggestions and sharing your experiences with me!
Lisa
I am pretty confident in my pennation angle, optimal fiber length, tendon slack length, and max isometric force, however i think the dynamic properties of the muscles are undefined which could cause problems. I seem to recall in SIMM that it would cause errors if you ran simulations without those properties properly defined when you were running even static optimization.
I will probably get around to changing those parameters over the weekend and let you know if I have success!
Thanks for your suggestions and sharing your experiences with me!
Lisa
- Lisa MacFadden
- Posts: 18
- Joined: Mon Aug 20, 2007 3:01 pm
RE: error in CMC and forward dynamics: causes?
Will,
Just updated all of the dynamic parameters in muscle model 4 (time scale, activation1, and activation 2) and now that problem has disappeared. Now the optimization cannot find a solution, but at least that solved the previous problem
Thanks for your help
Lisa
Just updated all of the dynamic parameters in muscle model 4 (time scale, activation1, and activation 2) and now that problem has disappeared. Now the optimization cannot find a solution, but at least that solved the previous problem
Thanks for your help
Lisa
RE: error in CMC and forward dynamics: causes?
Following up on this integrator error:
Where would be the best place to start "debugging" the model/simulation if we get an integration error like the one below?
RKF.step: NAN in state 1 at time 0.23 (dt = 1e-006)
I'm having trouble locating the start point of the error. It would be usful to have an idea as to how this comes about.
Tim
Where would be the best place to start "debugging" the model/simulation if we get an integration error like the one below?
RKF.step: NAN in state 1 at time 0.23 (dt = 1e-006)
I'm having trouble locating the start point of the error. It would be usful to have an idea as to how this comes about.
Tim
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
RE: error in CMC and forward dynamics: causes?
Tim,
Whenever I see a NAN particularly in a state that corresponds to a "u" I'd suspect something wrong with either the masses/inertia that leads to a force being applied to a massless body or something wrong with the forces being applied.
Unfortunately some of these messages are benign and are not a problem on their own since they are issued while the integrator is just "trying" to take a step, however in many cases the integrator responds by cutting the step size and proceeds successfully.
-Ayman
Whenever I see a NAN particularly in a state that corresponds to a "u" I'd suspect something wrong with either the masses/inertia that leads to a force being applied to a massless body or something wrong with the forces being applied.
Unfortunately some of these messages are benign and are not a problem on their own since they are issued while the integrator is just "trying" to take a step, however in many cases the integrator responds by cutting the step size and proceeds successfully.
-Ayman
- Daniele Tregnaghi
- Posts: 19
- Joined: Tue Sep 22, 2009 12:45 am
RE: error in CMC and forward dynamics: causes?
Hi, I've a problem during the execution of CMC.
The following message appear: rdCMC.computeControls: t = 0
WARN- small force range for tfl_r (0.222173 to 0.232212)
SimTK Exception thrown at InteriorPointOptimizer.cpp:249:
Optimizer failed: Ipopt: Maximum iterations exceeded (status -1)
OPTIMIZATION FAILED...
rdCMC.computeControls: WARN- The optimizer could not find a solution at time = 0.000000.
If using the fast target, try using the slow target.
Starting at a slightly different initial time may also help.
What can I do?
Thanks
The following message appear: rdCMC.computeControls: t = 0
WARN- small force range for tfl_r (0.222173 to 0.232212)
SimTK Exception thrown at InteriorPointOptimizer.cpp:249:
Optimizer failed: Ipopt: Maximum iterations exceeded (status -1)
OPTIMIZATION FAILED...
rdCMC.computeControls: WARN- The optimizer could not find a solution at time = 0.000000.
If using the fast target, try using the slow target.
Starting at a slightly different initial time may also help.
What can I do?
Thanks