Joints feedback

bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Joints feedback

Post 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)
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Joints feedback

Post 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
bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Re: Joints feedback

Post 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 !
bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Re: Joints feedback

Post 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.
bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Re: Joints feedback

Post by bonjovi »

Hi,

Really not idea on how to get joint feedback ?

Thanks
User avatar
rponomarev
Posts: 56
Joined: Sat Mar 08, 2008 12:37 am

Re: Joints feedback

Post 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
beaelp
Posts: 2
Joined: Mon Feb 09, 2009 12:55 pm

Re: Joints feedback

Post by beaelp »

That would be great cause we are also needed this feedback.
User avatar
rponomarev
Posts: 56
Joined: Sat Mar 08, 2008 12:37 am

Re: Joints feedback

Post 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
bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Re: Joints feedback

Post 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
User avatar
ejtttje
Posts: 96
Joined: Mon Nov 03, 2008 9:57 pm

Re: Joints feedback

Post 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.
bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Re: Joints feedback

Post by bonjovi »

It is exactly the same for me: i would like to create torque/force sensor along and around joint axes ...
User avatar
rponomarev
Posts: 56
Joined: Sat Mar 08, 2008 12:37 am

Re: Joints feedback

Post by rponomarev »

Hello,

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

Thanks,
Roman
User avatar
rponomarev
Posts: 56
Joined: Sat Mar 08, 2008 12:37 am

Re: Joints feedback

Post 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
bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Re: Joints feedback

Post 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 ! :)
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Joints feedback

Post 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
Post Reply