Featherstone's solver for articulations

Hi

As of Unity 2020.1a15, there is a new feature called articulations available. An articulation in this context is a set of bodies that have their relative movement constrained. It’s a bit like using Rigidbody in conjunction with ConfigurableJoint but there is now only one component to deal with, and the benefit is that all joints in an articulation are unstretchable by default (thanks to the new Featherstone solver). This means the locked degrees of freedom will never be violated, which is guaranteed by simulating in reduced coordinates.

Articulations were a new feature in PhysX 4, have a look at this promotional video for inspiration:

. PhysX 4 upgrade was made available in Unity 2019.3, so articulations can now be exposed too. The current featureset will be somewhat limited though, with the plan of making more available in the later versions, based on your feedback and requests. For now, only forward dynamics are available (=you set forces and drives to obtain poses of all articulation parts). Later on, inverse dynamics might be featured too (=calculate joint forces based on observations).

As you might have noticed, the main use case for articulations is more or less robotics – that is areas where accurate body simulation is key. However, it can be applied to traditional game problems too: think ragdolls for instance, various in-game mechanics as well as puzzles that need extra precision.

I wrote this brief technical intro if you’re interested: Understanding the ArticulationBody component - Google Docs

There is also an Nvidia doc: Articulations — NVIDIA PhysX SDK 4.0 Documentation

Known issues:

  • Spherical joint with twist locked or limited to [0, 0] may cause instability

  • Need to fix hierarchical deactivation, currently we only allow bottom to top

  • Articulation bodies have sleeping weirdness

  • Friction type cannot be set to anything other than Patch

  • Articulations without Colliders make the system really unstable

  • Revolute joint will explode if rotated more than 360 deg by target pose

  • Physics.IgnoreCollider has no effect on articulation bodies (adjacent)

  • Revolute joint will crash if twist is locked

Please let me know what you think. Thanks!

Anthony

19 Likes

Thanks Yant! some comments on the technical intro:

I don’t get to see all the joint information when I add a artictulationbody component. I only see the mass field and that’s it… Ah now I see you have to put it in the hierarchy under the root body to make it appear. Perhaps good to know for others. But if the hierarchy is the way to define connections, how do we create circular joint configurations?

the damping ratio d is also allowed to be larger than 1. (In this case it is ‘overdamped’ and really slows down the dynamics.) Is the ‘Damping’ of the drive the actual damping or the damping ratio? My quess it is the damping ratio?

I’m also very interested in how these articulationbodies are supposed to interact with rigidbodies. Simply through their colliders and that’s it? It seems like it is that simple… no caveats?

1 Like

Thanks for creating new thread!

2 Likes

The idea is you get to see what’s relevant, as opposed to just a dump of everything (compare to ConfigurableJoint). I understand it requires to get the idea that there is a root body that shows just a few settings applicable and you need to add more to get to see the joint-specific settings, but I hope that’s for a good reason after all. Articulation body can’t be connected to a world point, it’s not exactly a good old D6 doodle there inside.

I left a comment regarding ‘d’ value on the doc, but will repeat here: stiffness/damping you see as drive parameters are just raw coefficients, not frequency or damping ratios.

2 Likes

They get simulated in the same scene - so rigidbodies bounce off articulations and vice versa naturally by definition. For now, loop joints are not supported so you can’t attach articulation to a rigidbody directly.

1 Like

Suggestion:

Add planar joint type, you can build this behind the scenes with two prismatic joints to form a plane :slight_smile:

1 Like

Suggestion/need #2:

Would be nice to have way to update inertia tensor & center of mass of each ArticulationBody, but is not critical at the moment :smile:

1 Like

I wrote an extension to ArticulationBody for GetPointVelocity and AddForceAtPosition. I attached the file to this post but here’s the code, too. Please check if I got my math right. Testing with simple configurations it intuitively seems correct to me.

public static class MyExtensions
{
    public static Vector3 GetPointVelocity(this ArticulationBody ab, Vector3 worldPosition)
    {
        var v = ab.velocity;
        var w = ab.angularVelocity;
        var lever = worldPosition - ab.centerOfMass;

        return v + Vector3.Cross(w, lever);
    }

    public static void AddForceAtPosition(this ArticulationBody ab, Vector3 force, Vector3 worldPosition)
    {
        var lever = worldPosition - ab.centerOfMass;
        ab.AddTorque(Vector3.Cross(lever, force));
        ab.AddForce(force);
    }
}

5274306–528300–ArticulationBodyExt.cs (653 Bytes)

4 Likes

Seems fine:

https://github.com/NVIDIAGameWorks/PhysX-3.4/blob/5e42a5f112351a223c19c17bb331e6c55037b8eb/PhysX_3.4/Source/PhysXExtensions/src/ExtRigidBodyExt.cpp#L397

1 Like

hey @Kobix , are you sure about Physics.IgnoreCollision not working with articulations? I can’t seem to confirm, here is an example that does work for me

5274732--528366--a4075c5b3dfb0a3fec6ce61d13366d8b.gif

5274732–528369–ignore-test.unitypackage (4.61 KB)

2 Likes

Hi.

I will have to test it again. Quick note: The colliders were children GameObjects of ArticulationBody GOs, which doesn’t seem to be case in your scenario. Will report ASAP.

2 Likes

btw - feel free to file bugs using the bug reporter inside Editor. Articulations are now part of an official build so we can enjoy tracking and so on. Thanks!

1 Like

Ok, never used this. As I see it, it also sends Unity project, right? I shall create separate project so you can get clean scenes/scenarios :). Should speed things up for you and me :).

1 Like

Yup! It then becomes public on the issue tracker and everyone can see its status. Example: Unity Issue Tracker - In play mode switching Articulation Body's Target value and locking that axis causes the object to dissapear and throw errors

1 Like

If anyone needs to set axis in ArticulationBody

UnityArticulation.anchorRotation = Quaternion.FromToRotation(axis, Vector3.right);

Unity crashes with 1 root articulation and 176 articulated prismatic joints. I could file a official bug but I think its no need to here.

Ok exact number is 65 articulations (1 parent, 64 child). I don’t know internals, but it’s maybe cause max children is 64 = 2^6

No, it still crashes :I.

Articulations are something I was waiting for.

btw. is this formula F = (currentPosition - target) * stiffness - (currentVelocity - targetVelocity) * damping
The same for linear movement and angular movement ?

I’m a little concerned about the fact that articulated body will be something different than Rigidbody. What will be the interaction, will we be able to connect normal joints to Articulated body ?
Since unity moved totally into c# maybe it is time to reconsider some interfaces instead of solid classes.

Secondly will disabling and enabling Articulation reset the initial settings like with normal joints ?

There is a max limit on the amount of links in the whole articulation in physx.

Isn’t it possible to relax this limit? I know that upping it may impose bigger memory hit and CPU hit, but it’s just non-sense limit tbh. Isn’t it possible to make it modifiable in Project Setting->Physics menu?

Anyway - I think I figured out that there might be no need for 64 links at the moment.