Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Robot Arm

Discussion in 'Animation Rigging' started by andrzej_, Nov 2, 2019.

  1. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    As means of getting familiar with the Animation Rigging workflow I've decided to try an rig a robotic arm. The end result I want to achieve is to have an end effector that would drive the rotations of all the arm parts. Each part is constrained to only one axis, so my initial idea was to have one chain constrain on the whole arm and individual Multi-rotation constraints for each part.

    So .... not a great success

    without the Multi-Rotation constraints the arm behaves as expected.


    Just to be clear those positions and rotations are "solvable" and increasing solver iterations doesn't result in any changes. Am I wrong to use this Multi-Rotation Constraint for this or it just doesn't work well with the chain constrain and I should dived it into smaller IK chains/solvers?
     
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    Indeed, multi rotation would need to be solved the same way ChainIK is in order for your rotation constraints to apply like you'd want without changing the whole hierarchy.

    As you suggest, you could approach the problem with multiple TwoBoneIKs, ChainIKs to have a more constrained look to your robotic arm.

    Also, take a look at one of our field engineer work on github (https://github.com/TeckUnity/AnimationRiggingPlayground). @teck_unity ported a 6 DOF robotic arm constraint to Animation Rigging. While it may not fit your specific robotic arm, it may be a good constraint to start with!
     
    PTW_AR and andrzej_ like this.
  3. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    Thanks, that looks like exactly what I was looking for. Will test during weekend.
     
  4. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    Well, I haven't tried yet to port this approach to my robotic arm, but the solution in the Rigging Playground is a custom script based on this:
    https://meuse.co.jp/?p=2732
    So I'm pretty sure 99% of people will give up just by looking at the amount of matrices and linear transformations ... :D
     
  5. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    Also noticed the last joint in the example arm flips 180 degrees at certain rotations. this value (line 79 in RoboticArmIK)
    Code (CSharp):
    1. theta[5] = math.atan2(math.cos((float)theta[3]) * bsy - math.sin((float)theta[3]) * bsx, -math.abs(bsz) / math.sin((float)theta[4]));
    is flipping from negative to positive values. I'm guessing the conversion form quaternions to euler angles combined with all the sine and cosine functions make it oscillate. Will need more time to unpack this.
     
  6. h8476532

    h8476532

    Joined:
    Mar 14, 2022
    Posts:
    17
    Excuse me, sir, could you tell me how to open the robotic arm demo? it has a lot of folders that I can't find, thank you.
     
  7. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    I think this is the file you're looking for: Assets/Mechanical/Scenes/RoboticArm.unity
     
  8. h8476532

    h8476532

    Joined:
    Mar 14, 2022
    Posts:
    17