Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding
Announcements
We are currently migrating data within this board to improve the community. During this process, posting, replying, editing and other features are temporarily disabled. We sincerely apologize for any inconvenience caused and appreciate your understanding. Thank you for your patience and support.

HIK extend bone past preferred angle

jasond240
Enthusiast Enthusiast
933 Views
11 Replies
Message 1 of 12

HIK extend bone past preferred angle

jasond240
Enthusiast
Enthusiast

I have a mechanical rig similar to a human arm but the 'elbow' needs to hyper-extend past what the HIK preferred angle will allow. If I flip the angle 180 degrees, it moves in the correct direction however the elbow pivot is of course no longer in the right spot.

 

Any suggestions for how I can get this to work?

 

HIK arm setup.png

 

 

Thanks,

JD

Reply
Reply
0 Likes
Accepted solutions (1)
934 Views
11 Replies
Replies (11)
Message 2 of 12

leeminardi
Mentor
Mentor

It is not clear what action you want and what is not working correctly. Is it that you want the forearm (box002) to rotate to an angle > 180° if the humerus (box001) comes in contact with box003? If not, what event would allow the arm to take a hyperextension configuration rather than assume its normal configuration? 

Can you post a picture of the rig in a position of what it does and one that shows what you want it to do?

 

lee.minardi
Reply
Reply
0 Likes
Message 3 of 12

jasond240
Enthusiast
Enthusiast

Hi Lee, thanks for your response. Sorry my description isn't clear.

 

The vertical bar is connected to Box001. When it moves down, it pushes Box001 which will pull Box002 with it because Box001 is pinned in place at its center pivot. The two boxes 'retract' from the hyper-extended position about their linked pivot. The hyper-extension physically locks the mechanical rig in place.

 

If I detach Box001, Box002, change the HIK swivel angle to 180 degrees, it moves in the right direction but cannot hyper-extend which I need it to do. When I re-link the boxes to the bones, they of course detach at their conjoined pivot as shown below.

 

 

Untitled-4.png

 

Let me know if you need some further details.

 

Thank you for your input, much appreciated!

 

JD

Reply
Reply
0 Likes
Message 4 of 12

leeminardi
Mentor
Mentor

JD,

As I understand the mechanism, Box1 pivots about the fixed pivot point A.  Box1 is connected to Box2 with a pin joint at B.  What is not clear is what should control the angle Box2 make with Box1.  For example, is point C of Box2 fixed to travel only horizontally?  If not, what keeps C from moving down (or up)?  Once the kinematics are clear we can determine whether it is appropriate to use an IK solver or perhaps an expression controller.

 

 

a1.png

 

Lee

lee.minardi
Reply
Reply
0 Likes
Message 5 of 12

jasond240
Enthusiast
Enthusiast

Hi Lee,

 

Point C will travel inwards to the left and up on an arc when the vertical bar moves down. B moves up and to the left on an arc while A remains pinned at all times.

 

This assembly pulls/pushes a flap open and closed 90 degrees. The flap is attached to C via a separately pinned cam of sorts at D.

 

 

Untitled-1.png

 

Thanks!

JD

 

 

Reply
Reply
0 Likes
Message 6 of 12

leeminardi
Mentor
Mentor

Is the action something like the following sequence?  If so, where is the center of the arc and the radius for the path of point C?

pos1.JPGpos2.JPGpos3.JPGpos4.JPG

 

 

lee.minardi
Reply
Reply
0 Likes
Message 7 of 12

jasond240
Enthusiast
Enthusiast

Hi Lee,

 

The radius in my actual assembly is 1.623" centered at "D". May need to extrapolate for this example though :S. Point C in stage 1 below (pos1) will be hyper-extended a few degrees past where you currently have it. Pos2 is collinear to D.

 

 

Untitled-2.png

 

Unfortunately I cannot post my actual assembly in this public forum.

 

Thanks!

JD

 

 

Reply
Reply
0 Likes
Message 8 of 12

jasond240
Enthusiast
Enthusiast

Hi Lee,

 

Have you had a chance to give any further thought to a solution for this problem? The forum doesn't seem to allow for PM'ing attachments, otherwise I'd send you a test file privately.

 

Thank you so much! 🙂


JD

Reply
Reply
0 Likes
Message 9 of 12

leeminardi
Mentor
Mentor

@jasond240 Actually I gave this problem a lot of thought and made some progress with a solution.

 

The essence of the challenge is to determine the angle of box2 (cyan box) as box1 rotates. The end of box2 should follow a circular path.   The problem is that there is an inflection point where the continued rotation of box1 in a CW direction yields a solution where box2 can go in a CW or CCW direction.

 

To help me explore how to compute the angle of box2 I created a point A (PtA) that should be located at one of the two intersections of two circles. One of the circles is located at the pivot of box2 (yellow circle) and the and the other is centered at your point D (pink circle).  I used a numerical approach (trial and error) to determine the appropriate intersection.   In the code below, Po is an initial guess for the intersection point.  It lies on the yellow circle.  Pn on the pink circle at the intersection of a line from Po to the center of the pink circle.  It is closer to one of the two true intersections of the two circles than Po. Pm is on the yellow circle and is at an intersection of a line from Pm to the center of the yellow circle.  The calculation of Pm and Pn is in a while loop which continues recalculating Pm and Pn until the distance between Pm and Pn is less than 0.01 (an arbitrary error value).  I placed a limit of 10 iterations on the loop to protect against the case when the two circles do not intersect. The process converges very quickly to a solution.  The initial guess for Po determines which of the two circle intersection points will be calculated.  My code needs some work to better choose the initial guess.

 

Slowly rotate box1 or box2 in the attached file (I have not tied the rotation of box2 to PtA) and you will see PtA move with the intersection point of the two circles.  WARNING! The code will crash Max if the two circles do not intersect.  My plan was to use PtA to determine the angle of rotation for box2.  But at what point should the arm hyper-extend?  My code jumps PtA to the other solution when box2 pivot is on the line from the pivot of box 1 to the center of the pink circle. This needs to be addressed.

 

Play around with my file and you may gain some more insight into the problem and a potential solution.

cc1.PNG

 

Script for PtA.

alpha = rotation of box1, beta = rotation of box2, P1 = pivot of box1. 8 = radius of yellow circle, cirRad = radius of pink circle.

beta = alpha + betaLoc
P1= box1+[dum1.x*cos(alpha),dum1.x*sin(alpha),0]
Po = [8.0*cos(beta),8*sin(beta),0] + P1
cont = 1
Pn = cirPos + cirRad/length(Po-cirPos)*(Po - cirPos)
while cont > 0 do
(
Po = Pn
Pm = P1 + 8/length(Pn-P1)*(Pn-P1)
Pn = cirPos + cirRad/length(Pm-cirPos)*(Pm - cirPos)
if cont > 10 then cont = 0
if length(Pm-Pn) < 0.01 then cont = 0
) -- end while
Pm

Script for PtA. 

 

lee.minardi
Reply
Reply
0 Likes
Message 10 of 12

jasond240
Enthusiast
Enthusiast

Hi Lee,

 

That's some serious math going on there! I'll try to disect it. One thing I noticed is that box2's pivot should be in the middle, near your "box2" text rather than its end point. I'm afraid this may unfortunately negate the other circle and intersection point(s).

 

Below is a screen grab of my actual assembly, main pivot points/paths marked with circles. The top image (A) is correct (flap retracted), image B is deployed but the arms are not properly rotated as it still uses the original, non-functional bones. The red line in B is approximately where it should be. The pink & translucent parts move up and down, pushing/pulling the purple arm (pin travels in slot) to make it rotate.

 

Points on the blue and pink circles in the image travel their circumference in an inverse motion. Perhaps there is a way to constrain their pivots to a path and push/pull their joint (C)?

 

flapper.png

 

Bit of a head scratcher :S

 

JD

Reply
Reply
0 Likes
Message 11 of 12

leeminardi
Mentor
Mentor
Accepted solution

 

The problem as I now understand it is much simpler than I thought?  I think a configuration like the following should work.

 

The cyan box (your purple link) has its pivot as noted in the top image.  Three  bones are created as shown. The root bone is linked to the box near its end and has an HI IK solver to the end bone.  Rotating the box yields the motion you want! The flap (red, green and gray items in your drawing) are linked to the second bone in the chain.  Your blue link is linked to the root bone.  Keep the rotation of the link within reasonable limits and the mechanism should work fine.

cc8.png

 

 

 

 

 

lee.minardi
Reply
Reply
0 Likes
Message 12 of 12

jasond240
Enthusiast
Enthusiast
Fantastic, it works perfectly! Thank you so much for all your help! I'm still going to work through your scripting method and find some further tutorials. Seems scripting can solve a lot of headaches!!

JD
Reply
Reply
0 Likes