Forces to torques for a rigid robot arm

119 views
Skip to first unread message

Rahul Iyer

unread,
Apr 8, 2009, 12:12:29 PM4/8/09
to ode-users, rahul...@gmail.com
Hi,

I have just started using ODE and have created a two joint robot arm
with hinge joints for the shoulder and elbow.
I have obtained human trajectory data which gives me x,y,z coordinates
of the points on the forearm and upperarm. I have a simulation where
the robot arm is pulled in to this human trajectory using springs.
This works great with simulated spring forces but I want to now read
this in to joint torques. In other words, instead of applying spring
force, convert them to torques and apply joint torques that give
equivalent results.

I tried using the dJointSetFeedback and dJointGetFeedback () methods
to read the joint torques but these give really small values (that
probably don't correspond to the external spring force). I also tried
computing the torque on my own but failed in the two joint case (it
worked for the one joint scenario).

Could someone please let me know the right way to compute these
torques? I searched through the archives but couldn't find the best
solution. Any help would be appreciated.

Thanks,
Rahul

Jon Watte

unread,
Apr 8, 2009, 2:18:01 PM4/8/09
to ode-...@googlegroups.com, rahul...@gmail.com
When you apply a force at a specific location, the torque is
automatically calculated. You can just step into dBodyAddRelForce() (or
whatever you're calling) and see how it's calculated.
In general, the torque is something like:
inverseMassTensor times ((point - center) cross (forcevector))

Sincerely,

jw

ariadie chandra

unread,
Apr 9, 2009, 7:54:29 AM4/9/09
to ode-...@googlegroups.com
I am also experimenting about robot arm.
I used a sample code Program 6.1 from http://demura.net/simulation
In that sample, he set velocity of joint to move the arm
  dJointSetHingeParam(joint[j],dParamVel, k*z);
Currently, i tried to apply torque instead of velocity,
but haven't get a working result.
I would like to hear more about your result.
Thanks

Regards,
Chandra

Rahul Iyer

unread,
Apr 9, 2009, 3:45:37 PM4/9/09
to ode-users
Thanks for the reply, Jon.

> When you apply a force at a specific location, the torque is automatically calculated.
Using dBodyGetTorque to get the torque on a body worked for me.
However, I have a question: dBodyGetTorque gives the torque about the
center of mass. If I have a cylinder rotating about a hinge joint,
the torque about the center of mass can easily be converted to torque
about the hinge. When I set this back (using either dBodySetTorque
or dBodyAddTorque), should I set it to the torque about the joint or
the center of mass?
Also, what's the difference between dBodySetTorque and dBodyAddTorque
(other than the fact that one adds to the accumulated torque and the
other sets it) ?

> In general, the torque is something like: inverseMassTensor times ((point - center) cross (forcevector))
Maybe I am reading this wrong, but doesn't the above equation give the
angular acceleration rather than the torque.

- Rahul

Rahul Iyer

unread,
Apr 9, 2009, 3:49:37 PM4/9/09
to ode-users
Setting the velocity of the joint would be equivalent to using angular
springs, isn't it ?
I am experimenting with using linear spring and damping instead of
angular ones and then translate that to torques.
This works for single joints, but I am having trouble translating to
multijoint systems.

On Apr 9, 6:54 am, ariadie chandra <aria...@gmail.com> wrote:
> I am also experimenting about robot arm.
> I used a sample code Program 6.1 fromhttp://demura.net/simulation
> In that sample, he set velocity of joint to move the arm
>   dJointSetHingeParam(joint[j],dParamVel, k*z);
> Currently, i tried to apply torque instead of velocity,
> but haven't get a working result.
> I would like to hear more about your result.
> Thanks
>
> Regards,
> Chandra
>

J.D.

unread,
Apr 12, 2009, 12:46:55 PM4/12/09
to ode-users
Rahul,

If you have a set of desired link angles (lets call them q = [q1, q2]'
where q1 and q2 are the link 1 and link 2 joint angles respectively)
and you have or can calculate the desired joint velocities and
accelerations (qp and qpp respectively), then the joint torques can be
calculated with:

tau = M(q) * qpp + V(q,qp) + G(q) + F(qp)

where M(q) is your robot's inertia matrix and V(q,qp) is a vector of
the coriolis forces, G(q) is a vector of the gravity forces and F(qp)
is a vector of fiction forces.

There are numerous software packages out there to do this calculation
for you. For instance, ROBOOP (http://www.cours.polymtl.ca/roboop/) is
a open source C++ library for almost all things robot.. well at least
manipulator robotics. But if you don't like ROBOOP, you can also dig
up a very efficient algorithm published for computing the equation
above (google something like 'recursive Newton-Euler formulation').

In your case, it sounds like you have the positions but would have to
numerically differentiate to find the desired velocities and
accelerations. That can be a little tricky with measured data since
numerical methods amplify noise. But this is all implementation
details - easily addressed with standard filtering and/or fitting
techniques. Personally I prefer fitting real data with a cubic or
quintic spline and then computing the derivative of the spline
analytically. If you don't know the actual joint positions but instead
know the desired Cartesian positions, then you probably also need to
google 'inverse kinematics'... something else ROBOOP can do for you.

This, IMHO, is the 'correct' way to do the calculation you asked for.
Using something like a physics engine to do this isn't wrong exactly,
just kinda circuitous.

ariadie chandra

unread,
Apr 14, 2009, 7:21:42 AM4/14/09
to ode-...@googlegroups.com
> Setting the velocity of the joint would be equivalent to using angular
> springs, isn't it ?

Yup, i think that's right.
To refer J.D reply, in my case i calculate the target joint angle
from the target position of end effector, using simple inverse kinematics with geometric approach. This approach is not flexible if i need to change the geometric of robot arm.


> I am experimenting with using linear spring and damping instead of
> angular ones and then translate that to torques.
> This works for single joints, but I am having trouble translating to
> multijoint systems.
>
> I am experimenting with using linear spring and damping instead of
> angular ones and then translate that to torques.
> This works for single joints, but I am having trouble translating to
> multijoint systems.

If I am not mistaken, I got impression that you want to use this technique
as alternative to conventional inverse kinematics. Is it right ?
Honestly, i think this idea is interesting, although maybe like J.D said, it's "circuitous"

Regards
Chandra

Rahul Iyer

unread,
Apr 15, 2009, 11:26:25 AM4/15/09
to ode-users
Thanks for the info, JD. I will definitely look in to ROBOOP as an
alternative.

I opted for a physics engine because I needed external forces along
with robot actuators in my simulation.
For instance, if I have an arm moving, what would be the consequence
of hitting an obstacle. Not only do I need the torque/force numbers, I
would like to see the effect of the collision.
Another reason I am doing this with ODE, as Chandra pointed out, is, I
don't want to drive the robot using inverse kinematics and dynamics. I
am trying to use the forward dynamics of the physics engine to provide
a numerical solution to the ID.

What I am trying to do for now (as an exercise to understand ODE) is
to replace an external force applied on a body with an external
torque.
ODE has an accumulated torque that is computed as soon as the
accumulated force is applied. Directly applying this computed torque
instead of applying a force does not necessarily work, though.
I am probably doing this wrong - is there a difference in how ODE
applies forces as opposed to torques?

Thanks,
Rahul
Reply all
Reply to author
Forward
0 new messages