Specific torque to joint

NQ

21-06-2007 01:29:10

I've got a spherical joint, and now I want to apply a specific torque to it (of course that means relative to the two attached bodies).

According to the PhysX API there are joint motors, which work like:
revDesc.flags |= NX_RJF_MOTOR_ENABLED;

NxMotorDesc motorDesc;
motorDesc.velTarget = 1000;
motorDesc.maxForce = 500;
motorDesc.freeSpin = true;

revDesc.motor = motorDesc;

But that seems built for the purpose of wanting a certain end speed... not for a certain torque. I don't really care which speed it reaches! All I want is to apply a specific torque. Also, I don't want a constant motor: I need to change the motor torque every frame!

[edit]
Actually, what I really want is a joint->applyTorque(100) function. That way I can run it manually whenever I feel like it. But there doesn't seem to exist such a function?

Anyone got a nice tip on how get me what I want? It doesn't seem very difficult, but still I can't quite figure out how to modify it.
Thanks in advance!

[edit2]
Now that I've thuroughly looked through the API, there doesn't even seem to be motors for spherical joints! Only for revolving joints. The only solution seems to be to apply a torque to one of the bodies - like how they do in the sampleprograms where they demonstrate spherical joints. I'll try to accomplish the same effect by applying torque to the involved bodies, but this isn't really the same thing as I really want, is it?

betajaen

21-06-2007 10:02:06

What is the sort of goal of the Spherical Motor? Are you wanting it to apply torque in all three dimensions or just one?

It's a difficult question because I can't imagine a motor in real-life like that.

For First Edit: Nope, you'd set the Motor torque. Something like joint->motor->setTorque(100).

For Second Edit: What about a revolute joint attached to a dummy Actor which is attached to another revolute joint? That would do two of the dimensions.

I'm not big on joints (I've never used them outside the tutorials) but what about using a 6 Degrees of Freedom joint. Glancing through the SDK they support motors.

NQ

21-06-2007 23:04:53

Thanks for your suggestions! Yeah I know, it's kinda difficult to imagine. The problem I am facing is a shoulder-joint of a big robot. Or hip-joint, more correctly.

I am making the robot move around like a normal creature. In essence it senses its own physical motions, calculates what force is necessary (for keeping balance for instance), and then applies this force to each joint. It sounds complicated, but I have it all written down on paper and now I'm just trying to put my model into PhysX.

The output from my algoriths is in torque-amounts, so it would be preferable if I could feed that straight into the physics engine. I was also thinking about the possibility to use two hinge-joints, but that still leaves me with these motors. I would have to hack them pretty bad, and it wouldn't be pretty.

Right now I'm starting to think that maybe applying torque to each element is the same thing. In this case I would apply it to the thigh of the robot. In case that totally sucks, I'm going to try motors with that 6-degree joint instead.

I think I'm gonna try that, but if somebody else has the correct solution I would appreciate to hear about it! =)

Aiursrage2k

23-06-2007 02:19:24


The following are joints with motor support:

6 DOF Joint
Revolute Joint
Pulley Joint


You wont be able to get a motor on a spherical joint. I think you can use 6 DOF joint and configure it to a spherical joint.

Code to configure 6 DOF joint to a spherical joint -- from Lesson 205

case 2: // Spherical Joint
{
d6Desc.actor[0] = a0;
d6Desc.actor[1] = a1;

d6Desc.localAnchor[0] = localAnchor[0];
d6Desc.localAnchor[1] = localAnchor[1];
d6Desc.localAxis[0] = localBinormal[0];
d6Desc.localNormal[0] = localNormal[0];
d6Desc.localAxis[1] = localBinormal[1];
d6Desc.localNormal[1] = localNormal[1];

d6Desc.twistMotion = NX_D6JOINT_MOTION_LOCKED;
d6Desc.swing1Motion = NX_D6JOINT_MOTION_FREE;
d6Desc.swing2Motion = NX_D6JOINT_MOTION_FREE;

d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;
}
break;