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

Question Locking ArticulationBody joint in position

Discussion in 'Robotics' started by shemnor_Atkins, Mar 3, 2022.

  1. shemnor_Atkins

    shemnor_Atkins

    Joined:
    Jun 28, 2021
    Posts:
    2
    Hello!

    Im hoping to implement a locking mechanism on joints that are not being driven by the controller. The idea is to lock the arm in its idle position, and unlock joints when a drive command is triggered.

    I tried using AtriculationDofLock (shown below) but this doesn't seem to have any effect. Increasing the .jointFriction property to very high value does not reach a full lock. Is there a way to lock an ArticulationBody joint in position? Thanks!

    Code (CSharp):
    1.        
    2. public ArmArticulationChain aac;
    3. public ArticulationBody[] joints;
    4.  
    5. private void lockAllJoints(RroboEnums.DigitalTwinState state)
    6.         {
    7.             if (state == RroboEnums.DigitalTwinState.Idle)
    8.             {
    9.                 for (int i = 0; i < dof; i++)
    10.                 {
    11.                     aac.joints[i].swingYLock = ArticulationDofLock.LockedMotion;
    12.                     aac.joints[i].swingZLock = ArticulationDofLock.LockedMotion;
    13.                     aac.joints[i].twistLock = ArticulationDofLock.LockedMotion;
    14.                 }
    15.             }
    16.         }