Regarding dJointGetFeedback()

115 views
Skip to first unread message

Mayank Barnawal

unread,
Feb 23, 2012, 1:55:43 AM2/23/12
to ode-users
Hi all,

I am having a little issue with dJointGetFeedback(). I have simulated
a modular robot, where every alternate joint servo is made to rotate,
leaving the other set of servos static. However, when I use
dJointGetFeedback on those static servos, I get some torque values
(though they should be zero). I have even simulated the robot, by
setting the static servo's maximum torque to ~0 and my simulation
works fine.

Does anyone have any idea about the non-zero values of static servos?
Moreover, if I need to get jointtorque, should I add the values from
't1' and 't2'? (Since, if a joint applies t1 to body 1 and t2 to body
2, it should experience an equal and opposite torque which can be
added component-wise)


Thanks,
Mayank

Bill Sellers

unread,
Feb 23, 2012, 8:20:23 AM2/23/12
to ode-...@googlegroups.com
That sounds right. dJointGetFeedback returns the forces/torques that a joint is applying to the bodies it is connected to. If there are other forces/torques acting on the model (gravity, other motors) then it is very likely that the constraints of the joint will generate forces/torques acting between the bodies because of the degrees of freedom it is restricting.

Cheers
Bill

> --
> You received this message because you are subscribed to the Google Groups "ode-users" group.
> To post to this group, send email to ode-...@googlegroups.com.
> To unsubscribe from this group, send email to ode-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ode-users?hl=en.
>

jcooper

unread,
Feb 23, 2012, 10:53:35 AM2/23/12
to ode-...@googlegroups.com
If you want to recover the motor torque applied at a joint without the torque/force required to maintain the fixed anchor/angular constraints, I think that you need to use a motor that is independent from the articulation.

In addition to what Bill said, it's also worth noting that there's no code to zero-out a dJointFeedback structure when a joint isn't active.  Consequently, if you have a pure motor that is active for a time and you then set the dParamForceMax to 0, the dJointFeedback will keep its old values because the constraint won't be evaluated by the stepper while it's inactive.

jc

Mayank Barnawal

unread,
Feb 23, 2012, 1:58:01 PM2/23/12
to ode-...@googlegroups.com
Thanks bill and jcooper.

But, why am I getting torque values for static servos? If the servos are static, dJointGetFeedback should provide zero torque values.

The structure of the modular robot looks like:
        
       __*__*__*__*__*__*__ , where * denotes servo positions

Note: servos 2, 4 and 6 are static servos. Only functional servos are 1,3 and 5. But, dJointGetFeedback provides non-zero torque values for all the servos. Also, am I okay with the understanding that feedback->t1+feedback->t2 should give me the joint torque?

Moreover, I looked at other alternatives for finding forces on bodies so as to find total energy spent by motors. But, the problem with dBodyGetForce() is that it is valid only inside internal structure. Can you suggest me ways to use the values outside the structure?

Thanks,
Mayank

jcooper

unread,
Feb 23, 2012, 2:36:50 PM2/23/12
to ode-...@googlegroups.com
If the previous responses didn't answer your question, perhaps we misunderstood.  You'll need to clarify.  What is a "static servo"?  What kind of joints are you actually using?

To get the joint torque applied by an angular motor, you should only need to get feedback->t1.  Unless I'm confused, feedback->t2 should have an equal and opposite value unless there's no second body or the joint is not just an angular motor but is also applying a linear constraint to two reference points that are not the centers of mass of the two bodies. 

jc

Daniel K. O.

unread,
Feb 23, 2012, 3:06:52 PM2/23/12
to ode-...@googlegroups.com
On 02/23/2012 01:55 AM, Mayank Barnawal wrote:
> I am having a little issue with dJointGetFeedback(). I have simulated
> a modular robot, where every alternate joint servo is made to rotate,
> leaving the other set of servos static.

ODE does not have a joint called servo. You have to tell us precisely
what ODE entities you are using, so we can tell you what to expect from
them.


> However, when I use
> dJointGetFeedback on those static servos, I get some torque values
> (though they should be zero).

A joint doesn't have to be motorized to apply torques. In fact, most
joints have to apply torques to interact with the bodies.

Just a guess here: are you using a hinge joint to keep the axis
constraints, and trying to power it up by using its built-in motor
params? If so, your feedback will contain a combination of forces and
torques, from both the axis constraints and the motor powering it up.
You;'ll have to project the torque along the axis to obtain only the
motor component. Or use a separated AMotor joint to apply the motor part.

> Moreover, if I need to get jointtorque, should I add the values from
> 't1' and 't2'? (Since, if a joint applies t1 to body 1 and t2 to body
> 2, it should experience an equal and opposite torque which can be
> added component-wise)

Newton's third law of motion, the forces and torques will be of equal
magnitude but opposite. So adding t1 and t2 should cancel everything to
zero.


--
Daniel K. O.

Mayank Baranwal

unread,
Feb 23, 2012, 6:25:33 PM2/23/12
to ode-...@googlegroups.com
Thanks Daniel...
Basically, all my joints are hinge joints but i am providing actuation
to odd joints only. However, I am still getting torque values at
non-actuated joints....

and ti and t2 are the torques being applied to bodies 1 and 2... so
net torque on the joint should be (-t1+ -t2).... and should not be
zero....

Also, could you suggest me how to use dBodyGetForce() values for calculations..

Thanks,
Mayank

> --
> You received this message because you are subscribed to the Google Groups
> "ode-users" group.
> To post to this group, send email to ode-...@googlegroups.com.
> To unsubscribe from this group, send email to
> ode-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ode-users?hl=en.
>
>


--
Regards,
Mayank

Daniel K. O.

unread,
Feb 23, 2012, 10:51:22 PM2/23/12
to ode-...@googlegroups.com
On 02/23/2012 06:25 PM, Mayank Baranwal wrote:
> Basically, all my joints are hinge joints but i am providing actuation
> to odd joints only. However, I am still getting torque values at
> non-actuated joints....

Maybe you are interpreting the meaning of torque in a different way?

On our context, a torque is a vector, that represents a "twisting
force". The direction of the vector gives you the axis of the twist, and
its length gives the intensity. Try to display those torque vectors, and
you will see the axis it's trying to rotate around.

Now, suppose a simple, non-powered hinge joint, with no rotational
limits. It will exert forces over the connected bodies to keep them from
falling apart. It will also exert torques, so the bodies don't rotate
freely as if it was a ball joint. In fact, the only difference between
the ball and hinge constraints is the hinge has 2 angular constraints so
there is only 1 degree of freedom for the bodies to rotate. To maintain
the constraints the joint has to apply forces and torques.

To avoid having to draw something, look at the letter V floating in zero
gravity, and imagine it has a hinge at the bottom, connecting \ and /,
with no friction. Suppose you push \ to the right, at its very center
(so you initially have no intention of rotating \), what happens to / ?
Well, the two pieces can't get closer unless they rotate. So \ tries to
push / to the right, but the inertia of / tries to keep it still. So it
pushes \ back. This reaction force is not acting on the center of \, so
it starts to rotate; that is, we have a torque. Even though the hinge is
not powered, it induced a rotation around the axis that it's supposed to
let rotate freely. [1]


> and ti and t2 are the torques being applied to bodies 1 and 2... so
> net torque on the joint should be (-t1+ -t2).... and should not be
> zero....

If I understood your sentence correctly, I think you are confusing
something. Joints don't have net torques. Torques, like forces, are
applied on bodies. A body can have a net torque. So if body 1 receives a
torque to rotate it to the left, body 2 will receive a torque of the
same magnitude to rotate it to the left, or something like that. They
will be opposite vectors of the same magnitude, so they cancel out.

> Also, could you suggest me how to use dBodyGetForce() values for calculations..

Whenever you call dBodyAddForce(), it gets accumulated in the body. To
retrieve value that was accumulated so far you call dBodyGetForce(). You
can override this accumulated value directly by calling dBodySetForce().

When you step the world, those accumulated forces are combined with
gravity, and the system proceeds to find constraint forces to
compensate, so the joint constraints are not violated. Then the force
accumulator for each body is zeroed. [2]

So whatever you would obtain with dBodyGetForce() you already know,
because you added the force in yourself. The constraint forces are added
later, during the time step.

What exactly do you intend to calculate? Or even better, what is your
goal? Maybe you could use a different approach.


[1] This happens because, to establish linear constraints away from the
center of mass, a transformation is used, that combines linear and
angular constraints.

[2] ODE uses first-order approximation, so it deals with velocities and
impulses instead of accelerations and forces. But the concept is the same.


--
Daniel K. O.

Mayank Baranwal

unread,
Feb 23, 2012, 10:02:22 PM2/23/12
to ode-...@googlegroups.com
Thanks a lot Daniel... I was getting the things incorrectly in the
beginning... but your post is very helpful...
thanks again!!

Mayank

Mayank Baranwal

unread,
Feb 24, 2012, 7:32:07 PM2/24/12
to ode-...@googlegroups.com
Hi Daniel,

In which frame does dJointGetFeedback return values? Is it global frame
or joint fixed frame?

Thanks,


Mayank
On 23-Feb-12 10:51 PM, Daniel K. O. wrote:

Daniel K. O.

unread,
Feb 24, 2012, 8:53:23 PM2/24/12
to ode-...@googlegroups.com
On 02/24/2012 07:32 PM, Mayank Baranwal wrote:
> Hi Daniel,
>
> In which frame does dJointGetFeedback return values? Is it global frame
> or joint fixed frame?


Everything is always in the global frame, unless specified otherwise.


--
Daniel K. O.

Mayank Baranwal

unread,
Feb 24, 2012, 9:11:32 PM2/24/12
to ode-...@googlegroups.com
Thanks Daniel.



--
Daniel K. O.

--
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-...@googlegroups.com.
To unsubscribe from this group, send email to ode-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en.




--
Regards,
Mayank
Reply all
Reply to author
Forward
0 new messages