point velocity not obeying constraint - bug?
Posted: Sun Jan 23, 2011 6:02 pm
Hello,
I am using the API to calculate the linear/angular velocity of a point in a body. In a certain model pose the values opensim returns are incorrect and I am wondering if it is a bug. Perhaps my implementation is incorrect.
I set the model state by setting generalized coordinate values and speed values. I then use the simbodyengine to do the velocity calculations as follows:
osimModel.getSystem().realize(si,SimTK::Stage::Velocity);
osimModel.getSimbodyEngine().getVelocity(si,body,ptBodyJ,vel_linear);
osimModel.getSimbodyEngine().getAngularVelocity(si,body,vel_angular);
The problem is that when I put the model into a certain pose the results I get are wrong. In this pose, two of the model's axis of rotation align. A model constraint applies the opposite of the first coordinate value to the second coordinate. The end results is that the two coordinates cancel out each other hence movement of the first coordinate results in zero model motion. However when I calculate the velocity of the body points as above, the results show the same velocity as if the constraint was not applied.
Could this be a bug? Perhaps I am not using the functions correctly? Could it be that I am not using the "realize" function up to the correct stage? or do I need to do another step, like use the projectConfigurationToSatisfyConstraints() function or similar?
Any help is greatly appreciated. This has had me stumped for quite some time.
Cheers
Marc
I am using the API to calculate the linear/angular velocity of a point in a body. In a certain model pose the values opensim returns are incorrect and I am wondering if it is a bug. Perhaps my implementation is incorrect.
I set the model state by setting generalized coordinate values and speed values. I then use the simbodyengine to do the velocity calculations as follows:
osimModel.getSystem().realize(si,SimTK::Stage::Velocity);
osimModel.getSimbodyEngine().getVelocity(si,body,ptBodyJ,vel_linear);
osimModel.getSimbodyEngine().getAngularVelocity(si,body,vel_angular);
The problem is that when I put the model into a certain pose the results I get are wrong. In this pose, two of the model's axis of rotation align. A model constraint applies the opposite of the first coordinate value to the second coordinate. The end results is that the two coordinates cancel out each other hence movement of the first coordinate results in zero model motion. However when I calculate the velocity of the body points as above, the results show the same velocity as if the constraint was not applied.
Could this be a bug? Perhaps I am not using the functions correctly? Could it be that I am not using the "realize" function up to the correct stage? or do I need to do another step, like use the projectConfigurationToSatisfyConstraints() function or similar?
Any help is greatly appreciated. This has had me stumped for quite some time.
Cheers
Marc