Using bullet with a Force Feedback Device

Post Reply
User avatar
LarrxX
Posts: 5
Joined: Wed May 16, 2012 3:37 pm

Using bullet with a Force Feedback Device

Post by LarrxX »

Hello,

I am trying to couple my Bullet Physics world with a Force Feedback Device. The coupling between the device and the physics object uses a position/force loop:

Code: Select all

1 - Read the bullet object's position and speed (using getWorldTransform from the motionState)
2 - Set the device's requested position and speed to match
3 - Read the force and torque needed to apply to the object to move it to the correct position from the device
4 - Apply the force and torque to the bullet object
I exclusively use btConvexHullShape and btRigidBody in my physics world and I need my body to have a mass (which means I have to use Dynamic objects). I could use Kinematic objects if I absolutely have to and manually add the gravity myself if needed.

Now, my problem is I don't know how to apply the force and Torque to the rigid body.

I tried using btRigidBody's applyCentralForce() and applyTorque() methods but the simulation quickly becomes unstable. Looking more closely to the code of these two methods, it seems that each time they are called, they add the force to the m_totalForce and m_totalTorque members which thus grow exponentially.

I tried using clearForces() then just applying my own force and torque (plus gravity) but it doesn't seem to work either as it clears the forces applied by other dynamics in the wolrd (I assume).

I also tried using applycentralImpulse() and applyTorqueImpulse() which don't work either and send my object flying.

Is any of these methods sound? Because if one of them is, I'll have to see why the force and torque I apply are wrong? If not, how can I do what I want to do? Is it even possible?

Thanks in advance to anyone who might help with this.
User avatar
LarrxX
Posts: 5
Joined: Wed May 16, 2012 3:37 pm

Re: Using bullet with a Force Feedback Device

Post by LarrxX »

Sorry to bump my own thread but isn't there anyone who can confirm if I'm using the correct method at least? I'm at my wit's end here :'(
Post Reply