Pybullet force on a joint / caused by a constraint?

Hey!

I’m kinda new to panda3d / pybullet, but I was wondering if there are ways to get the force vector applied on a joint / constraint.

Specifically, I’m trying to simulate a 3-axis accelerometer on a robot. I have two dynamic BulletRigidBodyNode attached together with a BulletSphericalConstraint, one acts as a robot, the other is the sensor. The reaction force of the joint holding the two together divided by the mass of the sensor would give the accelerometer values. The mass of the sensor is negligible compared to the mass of the robot if that makes any difference.

From my research over the internet

  1. I saw that there is a method called get_applied_impulse(), which seems proportional to the force, but I’m not sure it really is. Even if it is, it doesn’t give a vector but just a float value :frowning:
  2. the “real” pybullet has a function getJointState() which looks like what I need, but I couldn’t find it in panda3d’s version of pybullet. Another problem is that it supposes I use an URDF file to describe my robot (which looks like the standard on the “real” pybullet) and I don’t.
  3. the getTotalForce() method from BulletRigidBodyNode-s doesn’t seem to take into account joint forces and gravity, always giving me (0,0,0) as the force on the sensor.

I think I could calculate the reaction force by not attaching the two bodies together, and constantly teleporting the sensor to the same place on the robot, while comparing it to the position it would have been if it wasn’t teleported, but I was hoping for a more elegant solution :slight_smile:

Thanks in advance :wink:

Pybullet is not part of panda, panda has its own binding through the C++code wrapper.

You’d better ask at the appropriate resource on Pybullet.

Panda3D doesn’t use pybullet, it has its own set of Python bindings for Bullet.

getJointState does not appear to be a function of the Bullet C++ API. Perhaps it is a combination of multiple method calls?