getMultibodySystem().realize in python [SOLVED]
Posted: Mon Oct 22, 2018 12:03 pm
Hello!
I am rewriting the Static Optimization in Python. At some point (at the beginning of a new frame), I need to update the model according to the Q of the state. In a naive approach, I decided that I would create an "osim.State" and populate it with the required Q (something like that:
self.model = osim.Model(model_path)
self.state = osim.State()
self.Q = self.state.getQ() # Get a reference to the Q into that state
self.Q.resize(n_dof_of_the_model)
for i in range(n_dof_of_the_model):
self.Q.set(i, desired_values)
thereafter, I would have called:
self.model.getMultibodySystem().realize(self.state, DESIRED_KINEMATIC_FLAG)
But two problems arose. The first one is "realize" is not callable from the swig API. The second is (when the first will be solved) the FLAGS are not interfaced either.
So my question is: Is there a better way to update the kinematics of a model to a desired pose?
Thanks
I am rewriting the Static Optimization in Python. At some point (at the beginning of a new frame), I need to update the model according to the Q of the state. In a naive approach, I decided that I would create an "osim.State" and populate it with the required Q (something like that:
self.model = osim.Model(model_path)
self.state = osim.State()
self.Q = self.state.getQ() # Get a reference to the Q into that state
self.Q.resize(n_dof_of_the_model)
for i in range(n_dof_of_the_model):
self.Q.set(i, desired_values)
thereafter, I would have called:
self.model.getMultibodySystem().realize(self.state, DESIRED_KINEMATIC_FLAG)
But two problems arose. The first one is "realize" is not callable from the swig API. The second is (when the first will be solved) the FLAGS are not interfaced either.
So my question is: Is there a better way to update the kinematics of a model to a desired pose?
Thanks