Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Featherstone's solver for articulations

Discussion in 'Physics Previews' started by yant, Dec 11, 2019.

  1. ashtorak

    ashtorak

    Joined:
    Feb 19, 2014
    Posts:
    36
    I got the following setup, which is mostly working, but I have a question.

    0 - root (not shown here, but everything sits on a larger hierarchy)
    -1 - rev joint
    --2 - prismatic, which drives everything
    ---3 - rev
    ----b1 - rev (back leg)
    -----b2 - rev
    ----f1 - rev (front legs)
    -----f2 - rev

    There are two legs in the front and one in the back. The second front leg is not set up yet, but it is not important as the movement is only in one axis as you can see in the video and it's not relevant to the question anyway.
    The legs have small cubes (blue) attached on f2 and b2, that are kept in place by the yellow cubes (attached to root). In this way I got them working ok-ish as supports. But I was wondering, if there is another way to do supports for an arrangement like this with articulation bodies or is just not possible? Because it doesn't seem right and it's also not unproblematic as the cube can just snap out when you put too much force on it too fast.
    (I just realized that I probably could just use spheres instead of the cubes and the lower rev joints. It would be a bit like an actual bearing even in this case.)

    support question2.JPG
     
    Last edited: Jun 8, 2022
  2. i-make-robots

    i-make-robots

    Joined:
    Aug 27, 2017
    Posts:
    17
    GetJointPositions, SetDriveTargets, and GetDriveTargets...
    are they using values in degrees or radians? the documentation is unspecific.
    I'd really like them to be degrees, same as the joint upper and lower limits.
     
    Last edited: Jul 29, 2022
  3. JuozasK

    JuozasK

    Unity Technologies

    Joined:
    Mar 23, 2017
    Posts:
    74
    GetJointPositions will return the same values for the whole chain as ArticulationBody.jointPosition returns for one, where the units would be meters for linear joints and radians for angular ones.

    https://docs.unity3d.com/2023.1/Documentation/ScriptReference/ArticulationBody-jointPosition.html

    Same idea with SetDriveTargets and GetDriveTargets.

    https://docs.unity3d.com/2023.1/Documentation/ScriptReference/ArticulationDrive-target.html

    Meters for linear, radians for angular.
     
  4. JuozasK

    JuozasK

    Unity Technologies

    Joined:
    Mar 23, 2017
    Posts:
    74
    That's an interesting use case. Unfortunately we don't support loop joints currently, since that would require creating a Joint with the ground at f2 and b2 points and our joints currently have a hard requirement on having Rigidbodies, which directly interfere with ArticulationBodies.

    As it stands, workarounds like this would be the way to go for simulating robots of this type.
     
    babiskir and ashtorak like this.
  5. Augustinas-Simkus

    Augustinas-Simkus

    Unity Technologies

    Joined:
    Mar 9, 2020
    Posts:
    58
    Hello folks!
    I have a small update. So after a little bit of experimenting and tinkering, I managed to bump the Articulation Body tree limit from 64 links to 256. I've cooked up a test build (which you can find here), any feedback or spotted issues are very welcome.
    This limit must be chosen at compile time of PhysX so unfortunately it cannot be exposed as a field in the Physics settings. The change also brings a ~10% performance boost to the Articulation Body solver. Hope this enables more use-cases.

    If all goes well, the upgrade should be considered for an official release soon.
     
    Last edited: Aug 11, 2022
    babiskir, drycactus, ashtorak and 8 others like this.
  6. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    525
    this sounds great, do you know which Unity versions this will be integrated to? Only latest 2023.1 alpha, or also older versions?
     
  7. Augustinas-Simkus

    Augustinas-Simkus

    Unity Technologies

    Joined:
    Mar 9, 2020
    Posts:
    58
    Well, for now it's only going to the latest 2023.1 alpha. If everything goes well, and there is a demand for it, I imagine it's possible to backport it. Although I'm hesitant to promise that, because this improvement required quite a few changes in PhysX which actually had to trickle out of Articulation Body code a little bit.
     
    Qleenie likes this.
  8. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    525
    I can confirm demand;) but I know Unity was very strict about backporting. Would be cool if possible.
     
  9. lazyrobotboy

    lazyrobotboy

    Joined:
    Jul 1, 2020
    Posts:
    16
    Is it possible to simulate force torque sensors for each joint in an articulation chain that react to external collisions? Haven't found a solution yet.
     
  10. Giantbean

    Giantbean

    Joined:
    Dec 13, 2012
    Posts:
    113
    Is there a tutorial for this anywhere? I'm trying to get UltraLeap ir 170 to work with XR interactions and the interaction toolkit but the Interaction Behavior makes objects disappear. If full physics hands with articulation bodies can be done I have made a lot of VR projects but I'm still having issues with leap, still I would love to test this out if there is a demo or tutorial on how to set it up.

    Thanks.
     
  11. wsinw

    wsinw

    Joined:
    Apr 23, 2017
    Posts:
    14
    https://docs.ultraleap.com/ultralab/physicshands-preview-blogpost.html
     
  12. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    12
    Hi,
    We are using the reduced coordinate pipeline with very good results so far for our game Plasma ( https://store.steampowered.com/app/1409160 )
    The main drawback is not being able to use cylinders (ex: wheels), we have tried with different tessellation count (32, 64,128 edges etc.) but the main problem across the board is hard bounces when edges hit which causes plenty of jittering.
    I came across this thread on the PhysX github https://github.com/NVIDIAGameWorks/PhysX/issues/50 where they talk about using 'rest offset' parameters to smooth the edges a bit, although I'm pretty sure this is something that isn't exposed on the Unity side.
    Would it be possible to consider adding this feature so we can have smooth cylinders when using articulations?
    Thanks!
    Patrick
     
  13. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    565
    Hey Patrick!

    Actually, we're working hard to natively introduce cylinders with PhysX 4.1 and Unity. So far we have promising results, but I won't commit to any dates yet. Let's hope things go well and it gets rolled out eventually.

    In the meantime, any solution would have to be somewhat hack-ish, either using contact modification to smoothen out the bumps, or doing some custom code of other nature (based on queries etc). In our robotics toolbox, we are recommending to use spheres instead of cylinders precisely for the reasons you outlined.

    Anthony
     
  14. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    12
    Thanks Anthony, I'll look forward to the native cylinder implementation with patience :)
     
    JuozasK and Augustinas-Simkus like this.
  15. goncalo-vasconcelos

    goncalo-vasconcelos

    Joined:
    May 24, 2017
    Posts:
    8
    Hi,
    I would also like to support the request for exposing the 'rest offset' parameter on colliders.
    Over the years, I've seen numerous threads on these forums asking for help related to bodies hitting collider seams when sliding (some recent examples: 1, 2, 3, 4).

    From PhysX documentation and developer comments, it seems like one of the simplest way to mitigate the issue is to increase the 'rest offset' for the participating colliders.

    https://gameworksdocs.nvidia.com/Ph...xguide/Manual/AdvancedCollisionDetection.html
    https://github.com/NVIDIAGameWorks/PhysX/issues/50
    https://gameworksdocs.nvidia.com/Ph...xShape.html#a413afb25b39a7a0cf0981aa01c6d7f8b
    I have created a simple scene to test the effect of the rest offset setting on another engine, and recorded the results in the PhysX Visual Debugger.

    In the video, both yellow ramps are made from a number of same-sized cubes placed next to each other.
    The cubes making up the ramp that is further away from the camera have a 'rest offset' setting of zero, while
    the ones making up ramp that is closest have 'rest offset' that is larger than zero.
    The sliding green cubes hit every seam between colliders in the first ramp, but slide smoothly on the closest one with the non-zero rest offset.
     
    DragonCoder likes this.
  16. JuozasK

    JuozasK

    Unity Technologies

    Joined:
    Mar 23, 2017
    Posts:
    74
    Hey! You are absolutely right. It's a simple task and we have added it to our task list. I'm not sure if we are going to be backporting it though, so in the meantime you can fix the ghost contact issues by using the existing contact modification workflow.
     
    goncalo-vasconcelos likes this.
  17. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    12
    Thanks for all the hard work and ongoing support of the articulation pipeline.
    I was also hoping there are plans to implement adding a 'soft' constrain in an articulation to form loops, I understand this is something PhysX supports (of course that joint isn't accurate like the rest of the articulation links) but not implemented Unity side yet.
    The articulation approach is awesome for so many reasons, but the lack of being able to make loops can be a real killer for gameplay in a physics sandbox (from the point of view of the player that is).
    Here's hoping this is on the radar.
    Thanks,
    Patrick
     
    DarkMemories likes this.
  18. JuozasK

    JuozasK

    Unity Technologies

    Joined:
    Mar 23, 2017
    Posts:
    74
    That's also something that we were looking into, though currently it poses a tough challenge. Our entire joint system is dependent on rigid bodies, so to be able to create a joint without an ArticulationBody or a Rigidbody component, that would form a loop in the Articulation tree, we would first need to detach the existing joint components from the Rigidbody or create a new component specifically for this case. Either way it's a big task and I can't even give an estimate on when that would be completed, but just wanted to share that it's definitely something we'd like to enable users to do.
     
    DragonCoder likes this.
  19. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    12
    Hi Augustinas,

    Would you be able to provide an update on the increase to 256 links limit in a tree?
    It doesn't seem to be in the release notes for 2013.1a yet, and we would LOVE to have it backported to 2022.2b so that we can use it in our upcoming game without the inherent risk of using an alpha release of Unity.

    Thanks,
    Patrick
     
    Qleenie likes this.
  20. Augustinas-Simkus

    Augustinas-Simkus

    Unity Technologies

    Joined:
    Mar 9, 2020
    Posts:
    58
    Hey Patrick,

    Sorry for the silence, the PR encountered quite a few not physics related problems, but looking at the schedule right now, it should be published as part of 2023.1.0a17.

    The final final PhysX change iteration was a lot less invasive so I have more hope for the backport to be approved.

    I'll post an update once the change actually lands + once I have some more information on the backport for 2022.2

    Edit: Finally merged as part of 2023.1.0a17!

    Augustinas
     
    Last edited: Oct 21, 2022
    drycactus and Qleenie like this.
  21. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    12
    Well that's great news! We would LOVE to see this backported to 2022.2, I'll cross my fingers and hold my breath until we find out!
     
    Augustinas-Simkus likes this.
  22. Augustinas-Simkus

    Augustinas-Simkus

    Unity Technologies

    Joined:
    Mar 9, 2020
    Posts:
    58
    Took a while but finally landed in 2022.2.2f1!
     
  23. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    12
    Awesome! Thanks for letting us know, is there a planned release date for 2022.2.2f1?