# Inverse kinematics for magnetic bearing structure animation

I basically want to describe and animate what this unusual magnetic bearing structure is doing - you can find a short video of the physical model here: https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/7/47999bb132c70245289cf20f2e42bce6c6c4b0fb.mp4
I´m not sure if Bongo is the right tool for this but with the keyword “Inverse kinematics” I hope to reach what I´m looking for.

I made already a few tries, but got always stuck by the same issue: I can´t reach that the whole structure follows the exact behaviour it should (video) - probably because I don´t have any gravity and magnetic loads? The problem is that I can´t close the IK chain for this structure or even a simple triangle behaviour because the IK chain has always a beginning and an end, right?.. or I´m just doing a few things wrong?

I also send you here my Rhinomodel where you can see what I try to animate: I only what to move the one telescope-bar in z direction up, and the whole structure should move like in the video; only three telescope bars and the rest of the structure is fixed.

Hope that someone can give me a hand with this behaviour, I would be really thankful! (Maybe this would be more easy with grasshopper?)

bongo_02_magnetic_behaviour.3dm (1020.0 KB)

Here’s how to set this up in Grasshopper+Kangaroo.
I’ve constrained 3 points to keep the base fixed, and the lengths of the blue members.

linkage_simple.gh (11.1 KB)

linkage.gh (13.9 KB)

Thanks a lot for your solution and time, Daniel ! - the behaviour seems right to me

Indeed it does. In my vocabulary a chain has a head and an tail – like a snake. This implies hierarchy. Consideration should be given who leads the action, because a parent will drag along his descendants, but a child will take a distance from his ancestor. In the design of structures like yours a disadvantage is that the order of a chain cannot easily be turned upside down. I feel you might benefit from Rhino - Inverse Kinematics

The key to make a IK chain circular (or triangular) is to let the snake bite its own tail.

So e.g. in a chain:
Object 0 > Object 1 > Object 2 > Object 3
in which (at least) Objects 1 and 2 are some kind of joint, the tail (Object 3) can be constrained to Object 0. Since most objects are surfaces (or similar) often an auxiliary point (a child of Object 0) is needed to pin-point the exact location for the constraint (e.g. the center of a sphere).
Have a look in circular.3dm (1.6 MB)

Although I feel the primary objective of Bongo is animation, and IK is primary conceived for the inversion of Forward Kinematics (just like the words say), it is indeed tempting to use IK for the exploration of mechanical structures. Trouble is that it is often hard to tell whether a malfunction is the result of the setup of mechanical structure itself or of the concept of its translation into IK!

In the model bongo_02_magnetic_behaviour 001.3dm (5.5 MB)
• I systematically equipped all rods with a tangible beginning and end using of a small sphere (the magnets) with their pivots located at the center of the vertices. This made compiling of the IK-chain much easier.
• I combined the members of the fixed triangles in a Block definition (1 block = 1 pivot) which is kept in position by 1 Universal joint and 2 Constraints.
• The function of the telescopes is taken on by a ‘telescopic’ joint (that’s what it is for!). Notice that the Y-axis of the pivots of rods 11 and 13 are aligned with the center-axis of the tubes, thus making the telescopic joint move in the correct direction. On a slant (not orthogonal oriented) object that’s not an easy task using the BongoRotatePivot command. It took 2 steps: first turning around the Z-axis (using the horizontal Construction Plane), and then around the X-axis with the CP set to the rod object itself. Tricky! I hope Bongo 3 will provide a BongoOrientPivot command.
Obviously any axis (other than Y) can be used to do the telescoping job. I just picked Y by accident.

The reaction of the organism is determined by the relaxation of vertex 05 which in the model is set to hinge along the (World) Y-axis. Notice how it varies when you e.g. change the joint to Universal and check both X and Y.

Any further questions?! Don’t hesitate.
Thanks for sharing this elegant enigma
Luc

PS
In the model you posted:
• the command line keeps repeating “Unresolved animation hierarchy.”. That is because Object 34 is ‘Look(ing) AT’ Object 35 which is his own (grand)child.
• you used quite some LookAt constraints. Please be aware that Simple constraints cannot take an active role in the resolving of an IK-cain.
Rhino - Bongo™ deals with the difference between Simple and IK constraints.
• Another aspect of Hierarchical linking to be aware of is that while a parent can have many children, a child can only have one parent.

3 Likes

uha, yes this is exactly for what I was looking for ! Thanks a lot for your work here Luc!

Maybe on last question - I try now to combine this with my definition for magnetic filedlines for what I have to scale the model (at the moment its in mm) and I saw last time that when I change the units that the whole Bongo chain breaks apart when I do this - is there an easy solution for it?

Thanks again,
Simon

The thing is that Bongo’s transform data are recorded in ‘units’. This makes that when the model units are altered via Rhino’s document-properties-options (e.g. millimeter to meter), although the model itself is rescaled ( * 0.001) the Bongo transform data are NOT. So you have to manually ‘scale’ the data in the keyframes accordingly.
E.g. in the model above the Position-Z-datum in keyframe 100 needs to be changed from 5000,00 into 5,00 for a millimeter to meter units switch. For millimeter to inches you’ll need a calculator .

Doing this previous to changing the overall units of the model will prevent the IK solver to get stuck on a unsolvable swing.

You’ll also have to adjust the Pivot size in Bongo’s document properties, because this is also noted in ‘units’.

I’ll pass this on to the developers to see if something can be done about it.

You’re welcome,
Luc

1 Like