Page 1 of 1

Constraint Missing implementation

Posted: Tue Sep 15, 2009 5:52 am
by jpjodoin
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

RE: Constraint Missing implementation

Posted: Tue Sep 15, 2009 9:42 am
by sherm
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

RE: Constraint Missing implementation

Posted: Tue Sep 15, 2009 12:32 pm
by jpjodoin
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

RE: Constraint Missing implementation

Posted: Thu Sep 17, 2009 11:36 am
by peastman
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

RE: Constraint Missing implementation

Posted: Thu Sep 17, 2009 11:44 am
by jpjodoin
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


RE: Constraint Missing implementation

Posted: Thu Sep 17, 2009 1:07 pm
by sherm
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

RE: Constraint Missing implementation

Posted: Fri Sep 18, 2009 9:54 am
by jpjodoin
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

RE: Constraint Missing implementation

Posted: Fri Sep 18, 2009 10:53 am
by sherm
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