Hello!
I'd like to add support for Featherstone's algorithm to the Bullet Engine, more precisely starting with the simplest form of the algorithm for stationary, "serial" articulated bodies (for example, a robotic arm whose segments are connected by hinge constraints).
I've already got a data structure in place that automatically tracks joint hierarchies when new hinge joints are added to the dynamics world; the next more challenging step is the implementation of the algorithm itself.
As far as I understand so far, it's not easily possible to combine Bullet's existing constraint algorithms with the Featherstone algorithm; am I correct if I assume that I either have to disable the existing hinge constraint code (considering I'd like to stick to the hinge constraint only for a start), or to explicitly skip hinge constraints that belong to an articulated body I'd like to control via the Featherstone algorithm?
Looking at btDiscreteDynamicsWorld, there's solveConstraints that assembles the list of constraints per simulation island; is this where one could put a diversion to exclude specific articulated bodies from Bullet's default constraint calculation?
Feedback/comments/pointers are welcome!
With best regards,
Fabian Aichele
Getting started with a Featherstone algorithm implementation
-
- Posts: 9
- Joined: Wed Aug 27, 2008 7:56 am
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Getting started with a Featherstone algorithm implementation
Usually Featherstone constraints act on more than two objects, while the current Bullet constraints are all pair-wise constaints.
There are several issues to resolve:
If you want to solve the Featherstone constraints interleaved with each PGS iteration, you can derive your own "FeatherstoneChainConstraint" derived from btTypedConstraint. Make sure to implement the
This will get called every iteration of the constraint solver (10 iterations per internal simulation step).
The second issue remains: pairs of connected objects in the Featherstone constraint chain are not reported to Bullet, so island (de)actication won't work properly. In order to solve this, you can create some 'fake' empty constraints between all pairs of connected bodies in the chain. You could implement a EmptyConstraint, derived from btTypedConstraint.
I assume the btHingeConstraint is just a default PGS constraint and is not used for Featherstone. That's why I suggest to implement your own FeatherstoneChainConstraint, dealing with chains of constraints (possibly more than 2)?
Does this help?
Thanks,
Erwin
There are several issues to resolve:
- How to interleave regular constraint solving with your Featherstone constraint solving
- Compatibility with existing island (activation) management.
If you want to solve the Featherstone constraints interleaved with each PGS iteration, you can derive your own "FeatherstoneChainConstraint" derived from btTypedConstraint. Make sure to implement the
Code: Select all
class FeatherstoneChainConstraint : public btTypedConstraint
{
virtual void solveConstraintObsolete(btRigidBody& bodyA,btRigidBody& bodyB,btScalar timeStep)
{
//solve Featherstone constraint chain here
};
virtual void getInfo1 (btConstraintInfo1* info)
{
//Don't solve any rows using PGS, just report 0
info->m_numConstraintRows = 0;
info->nub = 0;
}
}
The second issue remains: pairs of connected objects in the Featherstone constraint chain are not reported to Bullet, so island (de)actication won't work properly. In order to solve this, you can create some 'fake' empty constraints between all pairs of connected bodies in the chain. You could implement a EmptyConstraint, derived from btTypedConstraint.
Code: Select all
class EmptyConstraint: public btTypedConstraint
{
virtual void solveConstraintObsolete(btRigidBody& bodyA,btRigidBody& bodyB,btScalar timeStep)
{
//empty
};
virtual void getInfo1 (btConstraintInfo1* info)
{
//Don't solve any rows using PGS, just report 0
info->m_numConstraintRows = 0;
info->nub = 0;
}
}
I assume the btHingeConstraint is just a default PGS constraint and is not used for Featherstone. That's why I suggest to implement your own FeatherstoneChainConstraint, dealing with chains of constraints (possibly more than 2)?
Does this help?
Thanks,
Erwin
-
- Posts: 9
- Joined: Wed Aug 27, 2008 7:56 am
Re: Getting started with a Featherstone algorithm implementation
Hello!
Sorry for the long delay to my response.
Would it be a feasible alternative to "inject" transitive dependencies in a joint chain into simulation island management, i. e. to extend the dependencies between groups of rigid bodies (which form individual simulation islands) introduced by joints to consider complete articulated bodies instead of just pairs of constraints?
Thank you very much for your feedback!
With best regards,
Fabian Aichele
Sorry for the long delay to my response.
Yes, your hints are definitely helpful!Erwin Coumans wrote:Does this help?
That was the original reason to add a mechanism to Bullet that actually tracks dependencies across joint hierarchies so I get past Bullet's "pair-wise joints only" limit.Erwin Coumans wrote:Usually Featherstone constraints act on more than two objects, while the current Bullet constraints are all pair-wise constaints.
At the first glance, adding a "pseudo-constraint" type to exclude Featherstone-controlled joints seems the better way to me, since I wouldn't have to revert to a callback mechanism, but would get a suitable 'detour' without breaking Bullet's existing joint handling.Erwin Coumans wrote: How to interleave regular constraint solving with your Featherstone constraint solvingCode: Select all
class FeatherstoneChainConstraint : public btTypedConstraint { virtual void solveConstraintObsolete(btRigidBody& bodyA,btRigidBody& bodyB,btScalar timeStep) { //solve Featherstone constraint chain here }; virtual void getInfo1 (btConstraintInfo1* info) { //Don't solve any rows using PGS, just report 0 info->m_numConstraintRows = 0; info->nub = 0; } }
I didn't consider island management yet; however, to have another constraint type to act as 'fake' constraints would mean that I'd represent a chain of interconnected joints twice, once as chain of "EmptyConstraint"s, and once as chain of "FeatherStoneConstraint"s?Erwin Coumans wrote: Compatibility with existing island (activation) management.
In order to solve this, you can create some 'fake' empty constraints between all pairs of connected bodies in the chain. You could implement a EmptyConstraint, derived from btTypedConstraint.
Would it be a feasible alternative to "inject" transitive dependencies in a joint chain into simulation island management, i. e. to extend the dependencies between groups of rigid bodies (which form individual simulation islands) introduced by joints to consider complete articulated bodies instead of just pairs of constraints?
Thank you very much for your feedback!
With best regards,
Fabian Aichele
-
- Posts: 47
- Joined: Sun Oct 27, 2013 4:16 am
Re: Getting started with a Featherstone algorithm implementa
I have some files in the blender game engine that could demo this technology if it helps
http://www.youtube.com/watch?v=s57ipxhXBS4 <- needs this to take over game industry
http://www.youtube.com/watch?v=fwNtOlWCiPg <- catching objects with a 6dof robot
http://www.youtube.com/watch?v=s57ipxhXBS4 <- needs this to take over game industry
http://www.youtube.com/watch?v=fwNtOlWCiPg <- catching objects with a 6dof robot
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Getting started with a Featherstone algorithm implementa
This was an old topic from 2010.
Anyway, we have Featherstone now, using the btMultiBody. The Featherstone joints and links are all within the btMultiBody. You can have constraints between btMultiBody links and between btMultiBody and btRigidBody.
BluePrintRandom , are those videos using Featherstone?
Anyway, we have Featherstone now, using the btMultiBody. The Featherstone joints and links are all within the btMultiBody. You can have constraints between btMultiBody links and between btMultiBody and btRigidBody.
BluePrintRandom , are those videos using Featherstone?
-
- Posts: 47
- Joined: Sun Oct 27, 2013 4:16 am
Re: Getting started with a Featherstone algorithm implementa
No,I am using 6dof and my own python
-
- Posts: 47
- Joined: Sun Oct 27, 2013 4:16 am
Re: Getting started with a Featherstone algorithm implementa
I want to use featherstrone to articulate the arms, and allow for the player to "animate" them with a 3d mouse, or mouse+mousewheel