Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Featherstone's solver for articulations

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

  1. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,065
    Selecting multiple ArticulationBodies in editor for "mass" edit changes AnchorRotation and parentAnchorRotation



    Also when playing with ArticulationBody (enabling/disabling) setting to immovable and back made it not respect terrain collider. And just fall through.
     
    yant likes this.
  2. lazyrobotboy

    lazyrobotboy

    Joined:
    Jul 1, 2020
    Posts:
    16
    It has been already mentioned but I wanted to underline the need of having a "force-torque sensor" feature. I assume that this would be crucial for many research applications.
     
  3. dawood95

    dawood95

    Joined:
    Apr 18, 2020
    Posts:
    4
    I am trying to build an ml-agents robot arm environment using articulation bodies. I am mostly using revolute joints with limits. Something nondeterministic is causing the joints to go over the set limits which results in the robot breaking apart. Any insight into why this might be happening?
     
    akuikenIHMC likes this.
  4. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,065
    Do you have problem similar to this ?


    I had such a high hopes for Articulations but as I see it now the promise is probably not going to be delivered.
     
    GridWanderer, d1favero and Sab_Rango like this.
  5. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    I am using articulation body revolute joints with limits on my quadruped simulation and didn't run into this, how are you moving the joints?
     
  6. dawood95

    dawood95

    Joined:
    Apr 18, 2020
    Posts:
    4
    My action space is "Rotate Left" and "Rotate Right" for each joint. I am using the drive mechanic to rotate each joint by a fixed delta. The problem occurs when the joint is at its limit (let's say 360 degrees) and the agent is trying to move some other joint. The joint that was at its limit will start reading it's position/rotation as > 360 and eventually explodes in a couple of frames.
     
  7. dawood95

    dawood95

    Joined:
    Apr 18, 2020
    Posts:
    4
    I did have similar problems when I was spawning the robots too close to each other. But, I think the outcome is reasonable considering how that can make the physics solver unstable / probably breaks assumptions made by the solver (ex. two physical things cannot exists in the same space)
     
    Nyanpas likes this.
  8. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    @dawood95 I see, my case is slightly different because I'm setting a target on the drive. It sounds like you/the agent are applying torque forces using target velocity and the agent is choosing to continue applying force even after the joint has reached the limit. The solver isn't always able to actually stop the motion based on the set limits so often times the joint will exceed the limit and it will 'reset' the joint back to within the limit by applying counter torque force. In your situation this counter force meets your agents 'decision' force and scales up to push the joint back to a valid state causing the runaway forces/exploding your experiencing. (That's my best guess anyway)

    It's actually a similar issue to what @koirat is seeing, the solver is getting put in an impossible position and attempts ever increasing forces/velocities to get out of it. You can often set the time scale on the project to something very small and actually watch as it ramps up and blows apart.

    Some things you can try to avoid the situation -
    • Mask your agents actions so the agent cannot perform invalid actions (in this case "rotate right" when already at a limit https://github.com/Unity-Technologi...ent-Design-Agents.md#masking-discrete-actions
    • Increase solver iterations for more accurate simulations, the defaults are incredibly low (Project Settings => Physics => Default Solver Iterations, Default Solver Velocity Iterations)
    • Set a lower Default Max Depenetration Velocity, this caps the force used to correct rigidbodies in invalid or intersecting states (This setting may not affect torque forces, I'm not sure)
    • Be careful changing some Physics settings, the physics engine seems to break when using articulation bodies and anything but 'Patch Friction Type' as the Friction Type for example

    Let me know how it goes
     
  9. dawood95

    dawood95

    Joined:
    Apr 18, 2020
    Posts:
    4
    Thank you for the suggestions. Currently, I am just catching the problem before the robot explodes and ending the training episode. This along with some dynamic spawning of robot has made my training more stable.

    I do make sure my robot cannot perform invalid actions. I cap the max rotation at the limits. I think the extra torque is a side effect of other joints moving around.

    What number would you suggest for solver iterations?
     
  10. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,065
    Do you guys know how to decrees maximum velocity for separation of colliders. This might help with articulation going mad.
     
    Pawciu likes this.
  11. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    Ah, that makes sense, the longer the chain of articulation bodies the more knock-on effects you'll have with velocity downstream.

    I use Default Solver Iterations = 50 and Default Solver Velocity Iterations = 10 but it really depends on your simulation and how big the forces being thrown around are. I initially had an issue where the robot's foot would penetrate the environment floor and get locked there, the solution ended up being - up the solver iterations, lower the timescale (default for training is 20), and extend the floors box collider for more depth so if penetration does happen it's just pushed back out instead of going through and being locked in place.
     
  12. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    @koirat Project Settings => Physics => Default Max Depenetration Velocity (lower this)

    Its not shown in the manual but it's there in unity 2020.2.0a21 for me
     
  13. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,065
  14. GabsKapellmann

    GabsKapellmann

    Joined:
    Jun 13, 2018
    Posts:
    10
  15. projectorgames_unity

    projectorgames_unity

    Joined:
    Oct 15, 2018
    Posts:
    107
    I'm at least 80% sure the Damping field actually modifiers the Target field with a Revolute joint. If my setup is Target 90, Target Vel 150 and it's not moving, and I change the Damping from 100 to 150, it moves about 50 degrees clockwise. If I change it from 100 to 50, it moves about 50 degrees anticlockwise.

    This might also explain why I'm unable to use this as a regular motor - I'd like to be able to set a target rotation *or* a target velocity, but having both is... undefined.
     
  16. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    I strongly assume the formula used is:
    revoluteTorque = (targetPosition - actualPosition)*spring + (targetVelocity - actualVelocity)*damping


    and thus the having both set is well defined. If you don’t care about the actual position but just want it to rotate at a certain speed, set spring to 0. It is, however, not guaranteed that the joint reaches this speed or that it moves at all, depending on other forces/torques.

    A good-enough approximation for you could be a position and velocity controlled motor: set both damping and spring to whatever values are sufficiently aggressive for your application and have a script set the target position to a value that is integrating the desired velocity. This obviously needs an additional Behaviour on the gameobject.
     
  17. TimHogklint

    TimHogklint

    Joined:
    Nov 24, 2017
    Posts:
    40
    Having a problem with the neck connection of a biped. I know that you need a complete chain but it does not help.

    Here is two examples resulting in the same behaviour on low stiffness.

    Dummy non-complete chains - swat model complete chain.













    Swat character has complete chain of articulate bodies IE all bones are setup

    Dummy only has on limbs and spine 1 as chest and head.

    But both have the drifting head.
     
    Last edited: Sep 10, 2020
  18. dchappell2203

    dchappell2203

    Joined:
    Nov 18, 2019
    Posts:
    3
    Hi,

    Articulations look really promising, but I'm having some basic issues. Revolute joints aren't responding to any Target changes, even with Stiffness at high values. Not having this problem with Spherical or Prismatic joints, although I am getting instability in Spherical joints (as seen by others) at certain positions.

    Has anyone else experienced this and managed to get Revolute joints working? I'd like to avoid Spherical joints if I can... Unity 2020.1.4f1

    Also noticed the anchor position is shown in global coordinates on the editor, but actually (at least with Spherical joints) rotates around the anchor position in local coordinates. Only a visual bug, but caused me a headache for a while.

    upload_2020-9-10_16-42-14.png upload_2020-9-10_16-43-24.png
     
  19. dchappell2203

    dchappell2203

    Joined:
    Nov 18, 2019
    Posts:
    3
    Solved with the 2020.1.5 update. How strange.
     
  20. codebiscuits

    codebiscuits

    Joined:
    Jun 16, 2020
    Posts:
    84
    Hi,
    Sorry if this is covered somewhere already: does "Projected Gauss Seidel" vs "Temporal Gauss Seidel" have any effect on ArticulationBody physics, or is the "Featherstone's solver" its own thing, independent of them?
    If not, what about if I have isolated RigidBody objects (like, rocks) bouncing off my ArticulationBody hierarchy, is that affected by solver choice?
    My reading of the manual suggested that Gauss Seidel choice is only used for non-articulatedbody-joints (which I don't have any of), but I'm not at all sure?
     
  21. jcwj

    jcwj

    Joined:
    Sep 8, 2020
    Posts:
    2
    I managed to get around this by using the
    ArticulationJacobian(rows, cols)
    constructor instead of the one with no parameters:

    Code (CSharp):
    1.         robotJac = new ArticulationJacobian(1,1);
    2.         robot.GetDenseJacobian(ref robotJac);
    GetDenseJacobian()
    seems to do the matrix resizing automatically - my output Jacobian is of the correct dimensions.
     
    Last edited: Sep 19, 2020
  22. jcwj

    jcwj

    Joined:
    Sep 8, 2020
    Posts:
    2
    Hi, I had some questions of my own too. I have a robot with a mobile root, and I'm trying to get the reduced coordinates vector q using
    GetJointPositions(q)
    . I expected the resulting q to contain the root's 6 position/rotation DOFs followed by the joint angles, but the actual output list has the first 6 entries zeroed. Is this the intended behavior?

    Ultimately, I want to have access to both the full q (with root rigid body DOFs) as well as its derivatives, q_dot and q_ddot. With q_dot, the
    ArticulationBody
    class has
    velocity
    and
    angularVelocity
    , so that's settled; but with q, only the
    worldCenterOfMass
    seems to be available and there is no
    rotation
    field. Lastly, for q_ddot, there doesn't seem to be a way to get either the linear or angular accelerations of the root.

    Is there any way I can access these latter sets of values? Any help would be greatly appreciated. :)
     
  23. Shesta7

    Shesta7

    Joined:
    Jan 15, 2014
    Posts:
    1
    Hi! Is it possible (or will be possible) to create a kinematic loops?

    I try to simulate modular robot wheel and I need to fix child and parent objects.
    Снимок экрана 2020-09-21 в 13.56.10.png
    Now when the robot moves there is a gap between parent and child
    Снимок экрана 2020-09-21 в 13.56.44.png

    So, it would be nice to set some fix joint between articulation body root and child
     
    Last edited: Sep 21, 2020
  24. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    Short answer is: no
    Longer answer: Articulations can only be a tree structure and therefore cannot describe a loop. You can however use articulation bodies for most of the chain and a regular joint to close the loop. They work for both rigidbodies and articulation bodies.
     
  25. bartez1000

    bartez1000

    Joined:
    Aug 1, 2013
    Posts:
    1
    Hi. Has anyone managed to use articulation body drives' targets fields to rotate the body into the desired rotation when using move than one axis? I have a two-element articulation hierarchy, with an immovable root and sole child element connected by a spherical joint with free motion. I've set the stiffness and damping parameters at each drive to values coercing rotation. When I specify target rotation in one drive to a non-zero value, the joint works as expected. However, when using more than one non-zero target's the achieved rotations do not achieve the specified values. For example targets (x:0, y:20, z:40) result in rotation (x:-6.649 y:18.471 z:39.319) It seems that the bigger the target values are, the bigger the misalignment is. Possibly some kind of target angle values transformation is required, akin to one employed in setting target rotation values in ConfigurableJoints, explained here: https://answers.unity.com/questions/278147/how-to-use-target-rotation-on-a-configurable-joint.html . Unfortunately, when I used this method and inputted the transformed target rotation values, the result was still wrong. I noticed, that from the "Articulation body's point of view" the achieved rotation is the correct one, as reduced coordinates rotation from ArticulationBody.jointPosition field is equal to specified targets ((0, 20, 40) in my example), but represented in radians. How one can transform rotation from local space to reduced coordinates?
     
    Last edited: Sep 22, 2020
    CookieStealer2 and sara_conagher like this.
  26. CookieStealer2

    CookieStealer2

    Joined:
    Jun 25, 2018
    Posts:
    119
    I would love to know this as well! What is the encoding of the joint positions? From my testing it doesn't seem to be any of the Tait-Bryan variants.
     
  27. Steffen-ttc

    Steffen-ttc

    Joined:
    May 27, 2017
    Posts:
    22
    Hi all,
    is it possible to have another root body inside a chain? The real robotic arm has a total of 9 joints, but only the first 6 and the last 3 are controlled together. That said for the inverse kinematics (I'm planning to use the jacobian matrix from the 2020.2b) there are two non-redundant systems which can be moved independent.

    A workaround would be to break the chain and make a second articulation body root. But this would bring me some other trouble because the chain is generated by its DH parameter.

    Maybe there is a little trick?

    Thank you
     
  28. CookieStealer2

    CookieStealer2

    Joined:
    Jun 25, 2018
    Posts:
    119
    Nyanpas likes this.
  29. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    Hey @yant , is there any ETA for articulationBody.velocity setters to find its way into an official release like 2020.1? Right now (in 2020.1.11f1) it's still read-only.

    Also I don't see an option to change "compute parent anchor" in script. I'm still doing that through settings everything up with a parent articulationBody, changing the flag and making a prefab out of it. Is this still in the pipeline?
     
  30. Skyblade

    Skyblade

    Joined:
    Nov 19, 2013
    Posts:
    77
    Hi,
    I'm having difficulties with mixing ArticulationBody and Rigidbody/WheelColliders.
    Basically I'm trying to mount ArticulationBody arm on a moving Rigidbody platform, which is moved by WheelColliders.
    This a sample repo: https://github.com/Skybladev2/Tracks

    When Articulation Body of the Chassis is disabled, I can move it with QWAS buttons, but cannot move the Boom.
    When Articulation Body of the Chassis is enabled, I can move the Boom using Up and Down arrows, but cannot move the Chassis.

    How can I fix this?
     
  31. fallFlat

    fallFlat

    Joined:
    Mar 26, 2014
    Posts:
    26
    Currently it is not possible to have limited prismatic joint target outside it's limits, the target is clamped to limits before it is applied. Imagine how car suspension works - even at the maximum extension (car is lifted) the spring still has a huge load. If the limit is removed (the spring is removed from the damper) the spring would extend past that mechanical limit, reaching it's target length.

    Unity 2020.2.0b10.
     
  32. fallFlat

    fallFlat

    Joined:
    Mar 26, 2014
    Posts:
    26
    Reading PhysX code I've found this curious comment with the following lines:
    //KS - clamp drive target within limits - no point in having 2 parts fight against each-other
    if (j.motion == PxArticulationMotion::eLIMITED)
    targetPos = PxClamp(targetPos, j.limits.low, j.limits.high);

    I guess this answers my question.
     
  33. Fressbrett

    Fressbrett

    Joined:
    Apr 11, 2018
    Posts:
    89
    Do you know by any chance what kind of stiffness/dampening/masses your hopper used?
     
  34. CodeKiwi

    CodeKiwi

    Joined:
    Oct 27, 2016
    Posts:
    119
    Just found the old project. The base mass is 10, upper and lower leg mass is 1. There are only two joints (rotation and piston). Both have a stiffness of 1000 and a damping of 10. I’ve included the test package. Controlled with the horizontal and vertical controller axis.

    Also thought I’d mention an easy way to do balance (not in the included package). It’s probably too slow for runtime but easy to set up. I tried running 10 versions of the same simulation with random noise. Then picking the one with the best score and repeating. I seemed to be fairly stable e.g. could throw objects at the hopper or place it on a slope. Basically the same idea as this paper Sampling-based Contact-rich Motion Control (ubc.ca)
     

    Attached Files:

    Fressbrett likes this.
  35. TimHogklint

    TimHogklint

    Joined:
    Nov 24, 2017
    Posts:
    40
    Howdy

    Anyone would happen to know how to assign a rotation to an articulate body ? I have an ik structure thats exactly the same as the articulate bodies. Essentially when I move the ik target I want to copy the rotations to the relative bodies.

    I've tried to use the configurable joint extensions script which I've used to great effects with the regular joints. But I cant seem to either tweak it right or the articulate bodies works completely diffrently.

    I've also tried to do the signed angle between the ik limb and the physics limb - it seems bad. Everything jiggles and I cant tell if its the constraints or the way Im doing things.

    long story short
    copy rotation target to articulate body.
     
  36. joanllobera

    joanllobera

    Joined:
    Aug 20, 2013
    Posts:
    2
    Hi,
    I am working with Joe Booth in reproducing some examples of physics-based animation in Unity, using ML-agents. For this, we use SphericalJoints with constraints.

    To finish polishing this, one of the main challenges we face is that the class ArticulationBody is quite poorly documented. For example, it is not clearly stated that the Angular constraints are always in the form of a Swing in Y and Z, together with a Twist in X. For this, it would be quite helpful to have documented somewhere whether the constraints assume a decomposition of Quaternions in the form of
    Code (CSharp):
    1. localRotation = swing * twist;
    or rather:
    Code (CSharp):
    1. localRotation = twist * swing ;


    We are also trying to find out why sometimes fixing the velocity of an articulationBody does not generate instabilities, but fixing the position does.

    It would also be useful to know what determines how does the system behave when LinearDamping=0, AngularDamping=0 and JointFriction=0.
     
    Fressbrett likes this.
  37. Fressbrett

    Fressbrett

    Joined:
    Apr 11, 2018
    Posts:
    89
    The ArticulationBody is controlled using drives.
    Try changing the "Target" value of your respective drive in the inspector while the game is running. If changing the Target value does nothing for you, try increasing the Stiffness of your drive to something like 100000, and set Damping to 100.

    With this code snippet you can set the xDrive of an ArticulationBody via script:
    Code (CSharp):
    1. private void RotateTo(float xRot)
    2. {
    3.     var xDrive = _articulationBody.xDrive;
    4.     xDrive.target = xRot;
    5.     _articulationBody.xDrive = xDrive;
    6. }

    Please note that currently Spherical ArticulationBodies are hella buggy and thus completely unusable.
    However, you could fake such a rotation with two revolute ArticulationBodies, one controlling the twist, the other one being the child and controlling the tilt.
    ArticulationBodies currently only work correctly when all axis are locked, except one.

    Have a look into the documentation for ArticulationBodies here.
     
    Last edited: Dec 10, 2020
  38. walaber_entertainment

    walaber_entertainment

    Joined:
    Jul 10, 2017
    Posts:
    30
    I've made some progress with ArticulationBody using mostly Spherical Joint types to make a human that tries to match a reference "rig" that I pose with a variety of tools, including IK:


    One key was realizing that for Spherical Joint Type, the "target" for xDrive, yDrive, and zDrive must be encoded as an "angle axis" vector. Basically, you need to use Quaternion.ToAngleAxis to turn your rotation into an angle + axis, and then multiply the axis with the angle, and supply the X, Y, and Z coordinates of that vector into the Target of xDrive, yDrive, and zDrive.

    here's a code snippet from my prototype:
    Code (CSharp):
    1.  
    2.         // in my case "bindRot matches the "anchor rotation" of the joint as authored on the ragdoll.
    3.         Quaternion bindInverse = Quaternion.Inverse(Quaternion.Euler(_bindRot));
    4.  
    5.         // and this script is on my reference rig, so transform.localRotation = the local rotation of my reference copy of this joint.  after this line "rot" is the local rotation of the ArticulationBody joint, in it's local space.
    6.         Quaternion rot = bindInverse * transform.localRotation;
    7.  
    8.         // turn it into angle-axis
    9.         Vector3 axis;
    10.         float angle;
    11.         rot.ToAngleAxis(out angle, out axis);
    12.  
    13.         // make sure we don't have angles outside of the -180,180 range
    14.         while (angle > 180.0f)
    15.         {
    16.             angle -= 360.0f;
    17.         }
    18.         while (angle < -180.0f)
    19.         {
    20.             angle += 360.0f;
    21.         }
    22.        
    23.         // multiply the angle into the vector.
    24.         axis *= angle;
    25.  
    26.         // optional post-step to rotate this vector if necessary (I'm doing this for hinge/revolute joints in some cases)
    27.         axis = Quaternion.Euler(_postRotOffset) * axis;
    28.  
    29.        
    30.         // assign to the targets...
    31.         ArticulationDrive xDrive = _physicsJoint.xDrive;
    32.         xDrive.target = axis.x;
    33.         _physicsJoint.xDrive = xDrive;
    34.  
    35.         ArticulationDrive yDrive = _physicsJoint.yDrive;
    36.         yDrive.target = axis.y;
    37.         _physicsJoint.yDrive = yDrive;
    38.  
    39.         ArticulationDrive zDrive = _physicsJoint.zDrive;
    40.         zDrive.target = axis.z;
    41.         _physicsJoint.zDrive = zDrive;
    I've noticed that Spherical joints REALLY don't like going near 90 degrees at all on any axis, they become very unstable quickly. Currently as a work-around on my rig, I've broken up the shoulder and hips into 2 joints and limited each of them to less than 80 degrees.

    I'm still struggling with trying to get the motion I'm looking for, currently the whole system is a bit too "springy".
     
    NotaNaN, sohojoe, Nyanpas and 3 others like this.
  39. TimHogklint

    TimHogklint

    Joined:
    Nov 24, 2017
    Posts:
    40
    @walaber_entertainment

    Nice , I can tell by using your way of getting the coordinates is helping my reference ik rotations to map to my bodies however much like @Fressbrett said spherical joints seems quite bugged - I would really like to avoid using workaround like that - I kind reminds me of what I did with configurable joints before.

    It really feels like there is a pole around the twist that dont allow it to follow a reference rotation. Im going to be quite happy once spherical joints starts working :)
     
  40. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,065
    I thought we will not have this bouncy oscillations w articulations. Looks like I was wrong.
     
  41. biu_biubiu

    biu_biubiu

    Joined:
    Dec 24, 2017
    Posts:
    5
    The problem of spherical joint is really fatal. I hope it can be solved as soon as possible. After all, it's an essential component for building humanoid robots.
     
    Fressbrett and TimHogklint like this.
  42. TimHogklint

    TimHogklint

    Joined:
    Nov 24, 2017
    Posts:
    40
    All I want for xmas is spherical joints to work correctly :)
     
    Fressbrett likes this.
  43. TimHogklint

    TimHogklint

    Joined:
    Nov 24, 2017
    Posts:
    40


    only right arm is using the IK targets.


    So while messing around I did the workaround for the right arm - having a revolute socket and below that a spherical with 2 locked axis. It just dawned on me that the forearm needs to be controlled by the upper arms twist :/

    I've tried to programatically add offsets via its upperarm to the lower arm. Kinda makes me wonder if spherical joints will have some kind of IK target feature ?
     
  44. walaber_entertainment

    walaber_entertainment

    Joined:
    Jul 10, 2017
    Posts:
    30
    just thought I'd update here, I've got the values tuned a bit better and I'm able to do some interesting actions with my powered articulationbody human now. I'm curious to try more scenarios and see if the conservation of angular momentum is better on articulation body and on rigid body + configurable joint. I'll probably make a copy of my ragdoll using ConfigurableJoints in order to compare them more directly.

    Also, it seems that Physics.IngoreCollision still doesn't work for Colliders that are children of ArticulationBodys? in my prototype I've had to work around using various layers to prevent collision between some body parts (but keep it for others). Earlier in this thread it claims this issue is fixed, but I'm still not able to get it to work for me. All my ArticulationBodys have colliders that are on child game objects if that makes any difference.

    I'm posting regular progress on this in a twitter thread: https://twitter.com/walaber/status/1335113452675690496
     
    TimHogklint likes this.
  45. biu_biubiu

    biu_biubiu

    Joined:
    Dec 24, 2017
    Posts:
    5
    For human joints, how much should stiffness and damping be set? I'm making a robot, hoping to be as realistic as possible.
     
  46. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    406
    After updigging the code presented by the ML-Agent-trained ArticulationBodies in the previous post above, it seems that this is the "core" of the "conversion" to use the drives correctly:
    Vector3 targetRotationInJointSpace = -(Quaternion.Inverse(joint.anchorRotation) * Quaternion.Inverse(externalLocalRotation) * joint.parentAnchorRotation).eulerAngles;
    targetRotationInJointSpace = new Vector3(
    Mathf.DeltaAngle(0, targetRotationInJointSpace.x),
    Mathf.DeltaAngle(0, targetRotationInJointSpace.y),
    Mathf.DeltaAngle(0, targetRotationInJointSpace.z));

    Is this correct, or am I missing it completely? This seems similar to what needed to be done to use ConfigurableJoints.

    Here is a test I did on an ArticulationBody which has stiffness that gets removed and reapplied into the T-pose:
    uhoh2.gif
     
    codebiscuits, GSanLob and TimHogklint like this.
  47. Bamboidski

    Bamboidski

    Joined:
    Oct 26, 2019
    Posts:
    8
    I'm having a problem with disconnecting the limbs on my robot. I tried disabling the Articulation Body component which always result in the Unity crash. The only way I found to do so is unparanting the part. However when I do so all other parts in higher hierarchy just freeze with colliders disabled.

    Is there a workoaround for this?

    Update: Turning off and on the whole robot seems to make it work again, but doing so resets it's inertia.

    Update 2: Made a little script that stores velocities and apply to all the robot parts after it was re-enabled. Seems to be working :)

    Unity version 2020.2.1f1
     
    Last edited: Jan 16, 2021
  48. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    I'm also experiencing this and my workaround is also to activate/deactivate. I guess it's time for a bug report :) Are you gonna do it?
     
  49. kkarthikm35

    kkarthikm35

    Joined:
    Jun 29, 2018
    Posts:
    4
    I am wondering whether it is possible to move a specific articulation body (e.g. gripper) with respect to the base frame in x,y, and z coordinates. I would like to build such a controller to mimic a teleoperation mode provided by a robot but in Unity simulation (https://www.kinovarobotics.com/site...Ultra_lightweight_robot-User_guide_EN_R01.pdf, page 27) but the only variables the default controller allows me to manipulate are the joint angles. The default controller referenced here is this one: https://github.com/Unity-Technologi...pendix.md##Guide-to-write-your-own-controller).
     
  50. InTooVR

    InTooVR

    Joined:
    Jan 30, 2021
    Posts:
    2
    Hi all. This has been the best thread on Articulations so far. So I will add one more question:
    I am trying to get the force that is being applied at a joint after a robot gripper grasps an object. Here is how my code looks like:
    Code (CSharp):
    1. public class PincherCollision : MonoBehaviour
    2. {
    3.    
    4.     public ArticulationReducedSpace force;
    5.     // Update is called once per frame
    6.     void FixedUpdate()
    7.     {
    8.         ArticulationBody fingerA_articulation = GetComponent<ArticulationBody>();
    9.         ArticulationReducedSpace force = fingerA_articulation.jointForce;
    10.        
    11.         Debug.Log("Force: ");
    12.         Debug.Log(force);
    13.    
    14.     }
    15.    
    16.    
    17. }
    However I can't see any force being displayed. And I'm also not sure about if I should convert it to another datatype so I can do calculations with it.
    I am using the demo available at https://github.com/Unity-Technologies/articulations-robot-demo
    Thanks in advance!
     
    qw246 likes this.