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
- 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
- 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.
- 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
Thanks in advance