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
Constraint Missing implementation
- Jean-Philippe Jodoin
- Posts: 14
- Joined: Thu Sep 10, 2009 6:32 am
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
RE: Constraint Missing implementation
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
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
- Jean-Philippe Jodoin
- Posts: 14
- Joined: Thu Sep 10, 2009 6:32 am
RE: Constraint Missing implementation
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
Thanks in advance,
Jean-Philippe
- Peter Eastman
- Posts: 2588
- Joined: Thu Aug 09, 2007 1:25 pm
RE: Constraint Missing implementation
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
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
- Jean-Philippe Jodoin
- Posts: 14
- Joined: Thu Sep 10, 2009 6:32 am
RE: Constraint Missing implementation
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
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
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
RE: Constraint Missing implementation
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
- Jean-Philippe Jodoin
- Posts: 14
- Joined: Thu Sep 10, 2009 6:32 am
RE: Constraint Missing implementation
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
Thanks a lot,
Jean-Philippe
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
RE: Constraint Missing implementation
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
Sherm