Constraint Missing implementation

Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
POST REPLY
User avatar
Jean-Philippe Jodoin
Posts: 14
Joined: Thu Sep 10, 2009 6:32 am

Constraint Missing implementation

Post by Jean-Philippe Jodoin » Tue Sep 15, 2009 5:52 am

Hi, I'm currently working with Simbody. I have a linking error when I call Constraint::Ball getBallReactionForceOnBody1(state) and getBallReactionForceOnBody2(state). After looking at the code, I don't see where those methods are implemented ? Am I missing something or are they not yet implemented ?

Thanks,

Jean-Philippe

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

RE: Constraint Missing implementation

Post by Michael Sherman » Tue Sep 15, 2009 9:42 am

Hi, Jean-Philippe.

Yes, you are right. Those specialized reaction force methods are more an expression of good intentions than actual code at the moment!

None of the specialized reaction force methods for either mobilizers (MobilizedBody) or Constraints are implemented yet -- instead you have to use the generic reaction force methods for now. For mobilizers that means calling the calcMobilizerReactionForces() method of SimbodyMatterSubsystem. For constraints, you have to first obtain the constraint multipliers via the Contraint's getMultipliersAsVector() method, then feed those multipliers to the Constraint's calcConstraintForcesFromMultipliers() method. (Those are methods of the Constraint base class so every Constraint has them.)

Regards,
Sherm

User avatar
Jean-Philippe Jodoin
Posts: 14
Joined: Thu Sep 10, 2009 6:32 am

RE: Constraint Missing implementation

Post by Jean-Philippe Jodoin » Tue Sep 15, 2009 12:32 pm

Thanks a lot for the answer, I'll try that. I also want to detect collision between object. Currently I'm using a GeneralContactSubsystem and an a CollisionHandler (that inheritate from TriggeredEventHandler). It works correctly when using two ContactGeometry::Sphere, but if I try to use ContactGeometry::HalfSpace, I get compilation error and if I use ContactGeometry::TriangleMesh with a PolygonalMesh loaded from obj a (100x1x100 sized plane), collision are not working. Are those implemented ? What would be the easiest way to make a plane collide with a ball for instance ?

Thanks in advance,

Jean-Philippe

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

RE: Constraint Missing implementation

Post by Peter Eastman » Thu Sep 17, 2009 11:36 am

Hi Jean-Philippe,

Yes, all of that is implemented, so it should work. What is the compilation error you're getting? Can you post your code so we can see exactly what you're doing?

Peter

User avatar
Jean-Philippe Jodoin
Posts: 14
Joined: Thu Sep 10, 2009 6:32 am

RE: Constraint Missing implementation

Post by Jean-Philippe Jodoin » Thu Sep 17, 2009 11:44 am

Hi Peter, actually, I have achieved to make it work with a polygonal mesh. I can only make them work if they Pin. Free body doesn't seems to collide.
For the HalfSpace ContactGeometry, I still get this compilation error:
error C2664: 'SimTK::GeneralContactSubsystem::addBody' : cannot convert parameter 3 from 'SimTK::ContactGeometry::HalfSpace (__cdecl *)(void)' to 'const SimTK::ContactGeometry &'

for this part of code:

ContactSetIndex index = collisions.createContactSet();
ContactGeometry::HalfSpace Plane();
ContactGeometry::Sphere CollisionSphere(1);
collisions.addBody(index , PlancherPhysique, Plane , Transform(Vec3(0)));
collisions.addBody(index , BallePhysique , CollisionSphere , Transform(Vec3(0)));
collisions.addBody(index , BallePhysique2 , CollisionSphere , Transform(Vec3(0)));


where BallePhysique and BallePhysique2 are the MobilizedBody.


Thanks in advance,

Jean-Philippe


User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

RE: Constraint Missing implementation

Post by Michael Sherman » Thu Sep 17, 2009 1:07 pm

Hi, Jean-Philippe. It looks as though you mistakenly declared the variable Plane to be a "function of no arguments returning Halfspace" -- that is how I think the compiler will interpret the "()". That would explain the error message you got. Regards, Sherm

User avatar
Jean-Philippe Jodoin
Posts: 14
Joined: Thu Sep 10, 2009 6:32 am

RE: Constraint Missing implementation

Post by Jean-Philippe Jodoin » Fri Sep 18, 2009 9:54 am

Oups, you're right. It works now. I was wondering, what would be the best to set a range to a mobilizer ? For example, I have a MobilizerBody::Ball that I only want to move on 180 degrees (Half-Ball). Or for instance, I have a pin and I want to allow the motion on only 90 degrees. Is there an easy way for this or do I have to create a custom mobilizer ? And if so, how would I do that ?

Thanks a lot,

Jean-Philippe

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

RE: Constraint Missing implementation

Post by Michael Sherman » Fri Sep 18, 2009 10:53 am

Since this is a new topic I'm moving it to a new thread entitled "Limiting joint motion" -- please see that thread for a response.

Sherm

POST REPLY