Step by step integration
Posted: Sun Jun 03, 2018 9:40 am
Hi,
I am trying to perform a simulation step by step in python. The results differ between a 0.2s integration and two 0.1s integrations.
Would you be able to tell me if there is something wrong in these few lines of code?
I am using the build_simple_arm_model.py" example.
The controller
1 step (0.2)
The check
gives me :
1.5007997946757727
1.0
0.9999787865083376
2 steps (0.1 then 0.1)
The check
gives me :
1.5007492993654519
1.0
0.999978786034814
Any idea?
I am trying to perform a simulation step by step in python. The results differ between a 0.2s integration and two 0.1s integrations.
Would you be able to tell me if there is something wrong in these few lines of code?
I am using the build_simple_arm_model.py" example.
The controller
Code: Select all
brain = osim.PrescribedController()
brain.addActuator(biceps)
func = osim.Constant(1.0)
brain.prescribeControlForActuator("biceps", func)
Code: Select all
manager = osim.Manager(arm)
state.setTime(0)
manager.initialize(state)
state = manager.integrate(0.2)
Code: Select all
print(elbow.getCoordinate().getValue(state))
print(biceps.getActivation(arm.initSystem()))
print(biceps.getExcitation(arm.initSystem()))
1.5007997946757727
1.0
0.9999787865083376
2 steps (0.1 then 0.1)
Code: Select all
manager = osim.Manager(arm)
state.setTime(0)
manager.initialize(state)
state = manager.integrate(0.1)
state.setTime(0)
state = manager.integrate(0.1) # I believe that the manager.integrate is always based on the current state
gives me :
1.5007492993654519
1.0
0.999978786034814
Any idea?