Grasshopper Kangaroo

From TOI-Pedia


What is Kangaroo?

Kangaroo is an add-on for Grasshopper/Rhino and Generative Components which embeds physical behavior directly in the 3D modelling environment and allows you to interact with it 'live' as the simulation is running. It can be used for various sorts of optimization, structural analysis, animation and more.

Basic understanding of Kangaroo

Kangaroo component

To start creating a simulation you must place the main Kangaroo component on the Grasshopper canvas. You only need one instance of this component per definition (Grasshopper model).


Remember that hovering over a component without clicking will show a very brief description of what it does, and hovering over each of the inputs or outputs will display further information.

Force Objects

Kangaroo contains various ways of generating forces which affect the particles in the simulation. All of these are fed into the Force Objects input.


Forces can come from various sources - the response of materials to deformation (elasticity), user input, geometric constraints... By treating all of these within the common language of force vectors Kangaroo allows live interaction between them.


The input to Force objects needs to be a flattened list. (To flatten the input right click on the name and select Flatten).

Anchor Points

Anchor Points can be used to keep points fixed in a certain location. No matter what forces are applied to them they will not be moved by Kangaroo. However, you can still move them in Rhino to interact with the simulation as it is running. This can be done with points made in Rhino and then connect them to Grasshopper, so called Referenced Points.

Particle consolidation - Joining objects together

If two or more points in the initial input (Force Objects and Anchors) are in the same position (to within the tolerance setting) they will get joined together and treated as a single particle by Kangaroo.


Anchor points which start out coincident to points of Force Objects (such as the end of a spring) will therefore move those objects around with them when you move them during the simulation. Bear in mind though, if you stop the simulation and Reset it, if the anchor points no longer coincide with the points of the force objects they will no longer be connected. So you may sometimes need to undo your movements of the Anchor points in Rhino before running the simulation again.


For now if you do want to have to objects start in the same place but not get joined you must move them apart by a small amount.

Settings

Kangaroo Settings

Global settings for the simulation can be accessed from the Settings input of the main Kangaroo component.

You can access these settings either by adding a settings component to the canvas (the spanner/ screwdriver icon).

Tolerance
The minimum distance between separate points. Points closer than this will be consolidated into one.
TimeStep
How far through time the system moves at each iteration. Smaller values will result in a more stable, but slower simulation. Stronger forces and stiffer springs require smaller time steps.
SubIterations
The number of iterations calculated between each time the solution is drawn on screen.
Floor
A simple constraint which can be switched on or off preventing particles moving below Z=0

This is much faster than Brep collision.

Drag
A force on all particles resisting their motion.This is essential to make a system settle down to a

static equilibrium position. If drag is too low, the system will oscillate for a long time, if it is too high, the particles will move slowly.

Restitution
How elastic collisions between particles and the floor are. If 1 then particles bounce back to the height from which they were dropped, if 0 they do not bounce at all.
Tumble
How much horizontal velocity is conserved in collisions between particles and the floor.
Solver
The integration method used by Kangaroo to calculate new positions for the particles.


Running the simulation

Simulation Reset & Timer component

To start and stop the simulation you need to attach a Toggle (Params>Input>Boolean Toggle) to the SimulationReset input of Kangaroo. When this is set to True Kangaroo does some initial pre-calculation and matches all the inputs to the appropriate points. When it is set to False the simulation moves forward one iteration every time the grasshopper solution updates.


To make the simulation continuously update you need to attach a Timer component (Params>Util>Timer). Drag the dotted line from the timer to any part of the Kangaroo component. The timer has an interval setting which controls how long it waits between updating the solution. Right click and change this interval to 1ms to get the maximum speed.


Displaying the Grasshopper canvas takes quite a lot of memory and slows down the simulation considerably. To avoid this you can minimize it while running your simulation.

Instead of double-clicking the Timer component to turn it on and off you can double click the global toggle which will appear on your Taskbar the first time you use the Timer.


Simulation Output

The simulation oscillates wildly or explodes

Because Kangaroo is numerically approximating continuous behavior with discrete time steps, errors can occur. Usually these errors remain very small, but when dealing with very stiff springs, particles sometimes overshoot in a way that builds up rapidly, causing the whole system to fly apart.

The solution is either to use softer springs or to decrease the timestep (try reducing it by a factor of 10, eg from 0.01 to 0.001). Increasing Drag or Spring Damping can also help. Smaller timestep means more calculation steps for the same amount of movement, so the simulation will run slower.

One way to counteract this is to increase the value of SubIterations (typically by the same factor you reduced the timestep). This means that multiple calculations of the particles' positions occur between the ones which you actually see on the screen.

Geometry of a spring

Catenary

Kangaroo Cables

A catenary is a idealized hanging chain assumes under its own weight when supported only at its ends. The curve has a U-like shape.

Geometry of a spring in Kangaroo is determined by just 2 points, it can only ever be a straight line.


To make flexible elements we must first break them up into smaller pieces and model each segment as a separate spring.


Here we make certain simplifications, for example, when modelling a hanging chain we treat it as though all the mass is concentrated at the ends of each segment, when in reality it is distributed over its length.

However, provided some care is taken with how the masses and forces are assigned then these lumped mass models can often provide a decent approximation of continuum mechanics (even when quite coarse subdivision is used).

Sheet Materials - Membranes

Membrane - spring system

The simplest way to make a sheet material in Kangaroo is to use a grid of springs.


A grid of zero rest length springs will behave something like a soap film - trying to minimize area. So if you don't restrain the edges it will shrink down to nothing. If you wanted to avoid this (for example if you are simulating tensioned fabric), you could use a rest length for each spring which was some multiple between 0 and 1 of it's start length (illustration). You could also increase the stiffness of springs around the outside of the mesh to simulate edge cables.

For catenary structures where you want to simulate a hanging grid of chains you may want to make the rest length more than the start length to give it some slack.


To more realistically model the behavior of cloth you may also want to add shear springs - diagonals which stop each square from deforming into a diamond shape.

Different stiffness values can be used for the main square grid springs and the shear springs for different cloth properties.


There are a number of choices for how these diagonals are added - 1 or 2 per quad, aligned or alternating. I haven't tested much yet how this choice affects the behavior.


You can also add bending stiffness - (useful for some cloth behavior and particularly for sheet materials like paper or metal). The typical way to do this is to connect springs between alternate points in the grid, but a better way is to use the bending elements described in the section below on rods.

Rods

Bending resistance works with sets of 3 points. It will try to keep those 3 points in a straight line. So to model an elastic rod you need to input the 1st 2nd and 3rd nodes, the 2nd 3rd and 4th nodes, etc


To fix the tangent of a rod simply make 2 points at the end anchor points. To just fix the end position only use one anchor point.

There is currently no way to simulate resistance to torsion for 1D elements in Kangaroo, so it is as though the rod is free to twist about its own axis at the constrained ends. (Though you can make solids with torsional resistance as described below).

Springs

It might seem odd at first to simulate entire structures with springs - but we are not just talking about the kind of springs in car suspensions and mattresses. Even the stiffest materials stretch and compress when we apply forces to them.

Hooke's law says that the force exerted by a spring is directly proportional to the amount its length differs from its natural or rest length.

This is a simplification, but often a good approximation for many materials in ordinary use.


Note there is no Kangaroo input for the start length of a spring - it simply uses the length of the curve input to springs. The rest length (also called natural or slack length) of the spring is the length it 'wants' to be.


If you do not supply a value for rest length it defaults to 0. Often you will want to make the start length the same as the rest length - which you can do by simply connecting the curve to the rest length input.

You can also include a multiplier, so that the rest length is some multiple of the start length. If this multiplier is between 0 and 1 it will be like pre-tensioning the spring.

Zero rest-length spring

Springs with a natural length of zero are often useful. For example minimal surfaces can be roughly approximated by treating all the edges of a mesh as zero-length springs.

Kangaroo Download

For further information and example files, please visit the Kangaroo group on the Grasshopper website: http://www.grasshopper3d.com/group/kangaroo

Personal tools
Actions
Navigation
Tools