Page 1 of 2

Joints feedback

Posted: Mon Feb 22, 2010 4:57 pm
by bonjovi
Hi,

I'm trying to get joints feedback to know how many force/torque the joint applied on bodies in order to preserve the constraint.

By looking at the code it seems that i have to use btVector3& getAppliedLinearImpulse() to retrieve the value(s).

But the returned vector is always = 0 ! (i've activated the needsfeedback).

Looking at where the variable btTypedConstraint::m_appliedLinearImpulse is filled, i found that this variable is never filled in.
It is used in :

Bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h(55): btVector3 m_appliedLinearImpulse;
Bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h(193): return m_appliedLinearImpulse;
Bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h(199): return m_appliedLinearImpulse;

And getAppliedAngularImpulse :
Bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h(176):
Bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h(190): const btVector3& getAppliedLinearImpulse() const
Bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h(196): btVector3& getAppliedLinearImpulse()

So, it seems that this variable is never used, never filled ....

I'm missing something ?

Thank you for your help (using Bullet 2.75)

Re: Joints feedback

Posted: Mon Feb 22, 2010 11:55 pm
by Erwin Coumans
You need to use btTypedConstaint::getAppliedImpulse.

Joint feedback was broken in 2.75. Can you try latest Bullet trunk or wait for Bullet 2.76 later this week?
Thanks,
Erwin

Re: Joints feedback

Posted: Tue Feb 23, 2010 9:58 am
by bonjovi
Hi,

If i understand, btTypedConstaint::getAppliedImpulse returns a scalar. in my case i need the 3 length of the force ...

I will wait for the 2.76 and will give a feedback about that.

Thank you for the response !

Re: Joints feedback

Posted: Thu Mar 11, 2010 4:51 pm
by bonjovi
Hi, i come back with the JointFeedback:

As suggested i've installed the 2.76 and i don't find the Joints feedback. I've found the

Code: Select all

btScalar	getAppliedImpulse() const
But it gives a 'scalar' (instead of vectors) : it is not possible to deduce the force and torque applied on X,Y and Z for body BBB...

Is there another function i missed ?

Thank you.

Re: Joints feedback

Posted: Sun Mar 14, 2010 10:39 am
by bonjovi
Hi,

Really not idea on how to get joint feedback ?

Thanks

Re: Joints feedback

Posted: Wed Mar 17, 2010 12:32 am
by rponomarev
Hello,

Unfortunately for now there are no functions that return applied impulse in vector form.
However it looks like they could be added easily.
I'll do that soon and post a notice here.

Thanks,
Roman

Re: Joints feedback

Posted: Wed Mar 17, 2010 11:02 am
by beaelp
That would be great cause we are also needed this feedback.

Re: Joints feedback

Posted: Wed Mar 17, 2010 7:09 pm
by rponomarev
Hello,

As of r2069 I've added several access functions to get velocities applied by solver to rigid body
at one simulation step. These functions are defined as:

Code: Select all

const btVector3& btRigidBody::getDeltaLinearVelocity() const;
const btVector3& btRigidBody::getDeltaAngularVelocity() const;
const btVector3& btRigidBody::getPushVelocity() const;
const btVector3& btRigidBody::getTurnVelocity() const;
The last two functions works only if Split Impulse Mode is set.

Note, that these functions returns the result of ALL constraint forces acting to body.
IMHO, forces that are added by a single constraint row during the solving process are considered as an intermediate result and has no useful meaning

Thanks,
Roman

Re: Joints feedback

Posted: Wed Mar 17, 2010 9:58 pm
by bonjovi
Hi,

Thank you for this information.
forces that are added by a single constraint row during the solving process are considered as an intermediate result and has no useful meaning
In fact we use to work with the JointFeedback in ODE (every joint can collect the force/torque applied to body(ies)).

Getting the TOTAL forces/torque applied to the body is not very useful for us, because we have to know what is the joint/axe that is the origin of the force/torque.

when you say "as an intermediate result and has no useful meaning" : does it mean that the result, for each joint, has really no meaning ? or is it only your opinion ?

Thank you

Re: Joints feedback

Posted: Thu Mar 18, 2010 6:46 pm
by ejtttje
To give an example of why I would also like to know constraint force, our robot can sense torque on the servos, and can use this information for adaptive manipulation as a "sense of touch". It would be useful if the simulation could provide corresponding information, otherwise we cannot simulate torque and pressure sensors, and therefore cannot test and debug algorithms which use this data in simulation.

Re: Joints feedback

Posted: Thu Mar 18, 2010 10:03 pm
by bonjovi
It is exactly the same for me: i would like to create torque/force sensor along and around joint axes ...

Re: Joints feedback

Posted: Fri Mar 19, 2010 6:42 pm
by rponomarev
Hello,

OK, I understand now what is needed.
I'll add this possibility soon and keep you posted.

Thanks,
Roman

Re: Joints feedback

Posted: Fri Mar 19, 2010 7:52 pm
by rponomarev
Hello again,

Looks like ODE keeps the sum of constraint forces applied by joint to bodies in world space,
and not for each constraint axis.

http://opende.sourceforge.net/wiki/inde ... Functions)

Code: Select all

typedef struct dJointFeedback {
    dVector3 f1; // force that joint applies to body 1
    dVector3 t1; // torque that joint applies to body 1
    dVector3 f2; // force that joint applies to body 2
    dVector3 t2; // torque that joint applies to body 2
} dJointFeedback;
As far as I understand you need them separated for each axis.
Is this correct?

Thanks,
Roman

Re: Joints feedback

Posted: Sat Mar 20, 2010 5:04 pm
by bonjovi
Hello,

yes, each joint stores in a structure dJointFeedback the force and torque applied to body1 and body2 separately.
The values are stored in world space.

Another thing very interesting: because contact-points are joints-like constraints, it is also possible to get force/torque information from contacts points feedback. the result is that it is possible to create force/torque sensors from:
-> joint axes
-> contacts points.

Thank you for your interest in this feature, i'm ready to test BETAs if you need ! :)

Re: Joints feedback

Posted: Mon Mar 22, 2010 11:14 pm
by Erwin Coumans
bonjovi,

ODE accumulates the feedback, and doesn't split them along individual axis. Are you happy with the dJointFeedback from ODE?

Note that Bullet can already provide the joint feedback from contact points: each contact stores the accumulated impulse and contact/friction directions.
Thanks,
Erwin