Hello,
I am trying to port some functionality from my btMultiBody implementation to my RigidBody and JointConstraint implementation since not everything is implemented in the btMultiBody yet. In btMultiBody I can apply torque at a certain joint, but in the JointConstraints I can only use the motors and run it with maxTorque and a desired velocity. Can I somehow apply torque at the joints the same as in btMultiBody?
Apply torque with JointMotor
-
- Posts: 350
- Joined: Sat Jul 04, 2015 10:33 am
- Location: Bern, Switzerland
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: Apply torque with JointMotor
One easy way is to just set the torque to be the torque (impulse) you want, and then have the desired velocity be a large number in the direction of that torque. As long as you never exceed that large velocity, the joint will end up (after costing a few cpu cycles) with the same result as if you put a torque on each body at the joint location.
Just remember that it's not very computationally friendly, but the answer should be the same (though not necessarily identical).
Just remember that it's not very computationally friendly, but the answer should be the same (though not necessarily identical).
-
- Posts: 350
- Joined: Sat Jul 04, 2015 10:33 am
- Location: Bern, Switzerland
Re: Apply torque with JointMotor
So there is really no other way to apply the torque (impulse) directly? That is a bit inconsistent in API. Especially for torque driven robots, you do not want that torque ramp-up that bullet is probably doing when increasing towards maxtorque. But ok, then I have to cope with that. Unfortunate, but I will find a way.Thanks for your answer.
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: Apply torque with JointMotor
What torque ramp-up?benelot wrote:So there is really no other way to apply the torque (impulse) directly? That is a bit inconsistent in API. Especially for torque driven robots, you do not want that torque ramp-up that bullet is probably doing when increasing towards maxtorque. But ok, then I have to cope with that. Unfortunate, but I will find a way.Thanks for your answer.
I've been able to get pretty much accurate motors simulation (~0.004 rad for motors with 12bit feedback that has 0.0015 error by itself and another ~0.001-6 rad error from latency variability) using that (and applying torques to each body directly), haven't seen any ramp-up outside that which I put in myself (since motors always have a "ramp-up")
-
- Posts: 5
- Joined: Mon Jun 10, 2019 3:46 pm
Re: Apply torque with JointMotor
Hi,
I have been trying to measure the applied torque through getJointTorque (int dof) and its returning zero.
I have been trying to measure the applied torque through getJointTorque (int dof) and its returning zero.
-
- Posts: 46
- Joined: Sat May 19, 2007 9:28 pm
Re: Apply torque with JointMotor
I guess what you want is btMultiBodyConstraint::getAppliedImpulse(int dof). btMultiBody::getJointTorque(int i) is the external torque applied by the user.usamarafiq93 wrote: ↑Wed Jul 03, 2019 3:21 pm Hi,
I have been trying to measure the applied torque through getJointTorque (int dof) and its returning zero.