I have been working with the new articulation body feature of Unity for a while and I want to simulate the torque sensors behavior in each joint, which basically is the current force applied on the joint.
I found several properties like position, velocity, acceleration, and force. The problem is the joint force value is always zero.
Does anybody know, why is this like that or is there something which I need to do in order to get the force measurement available in the articulation body?
The example of code which I am reading the force values:
I have tested with version 2021.2 alpha 13. The official documentation from Unity3D for “ArticulationBody.GetJointForces” is here. I have tried it and the force list array is always zero.
List<float> forces = new List<float>() ;
ArticulationBody body = GetComponent<ArticulationBody>();
int f = body.GetJointForces(forces);
print(forces[0]);
If anyone has any updates on this problem, I would glad to hear.
It seems the Physx 4.1 implementation in Unity3D is still missing some functionalities such as “Inverse Dynamics”. For sure the low-level functionality from Nivida Physx has already implemented the force feedback for the new articulation body component and I am wondering why still we don’t have it on the Unity3D side.
// Example from Physx 4.1
PxReal maximalJointForces[NbLinks*6]; //There are 6 dofs (x,y,z,twist,swing1,swing2) per link
articulation->unpackJointData(cache->jointForces, maximalJointForces);
I find it odd that the function in Unity 2021.1.9 still always returns 0. Why would they include such a function if they have no current plans on implementing it.
I don’t believe there is a way to even calculate it yourself from the information given in a articulation body
Hey!
The jointForce property and the GetJointForces method only return the forces you applied to the articulation yourself.
For a use case of a torque sensor I believe the driveForce from the Inverse Dynamics update should do the trick.
AetherBiomedical correctly pointed out that you can calculate this value from the Drive settings, but the drive Force property just makes it easier to grab.