Random Crawlers

Using multi-pendulums

Introducing Random Crawlers

Controls:

  • i - Toggle trajectory
  • p - Toggle pendulums
  • l - Toggle pendulum joints
  • u - Toggle crawlers
  • o - Toggle attachment points

What is it?

A random crawlers as I call it is a set of very simple rules that can simulate natural looking movement. But even though the underlying mechanism is simple, the results are anything but. The name random crawlers is a reference to one of my favorite processes in mathematics, the Random Walk algorithm. This simple process links several fields of modern technology including computer graphics, game dev, physics, fluid simulation and even social sciences. But I find it quite fascinating how linking one stochastic process to another completely seemingly unrelated thing can result in beautiful visualizations.

How does it work?

This is a piece I’ve worked on for quite a while. it’s essentially a set of chained rotating arms connected end to end. Each have their own length and rotational speed. At the end of the chain is anchored a crawler agent that simply connects to nearby points and therefore, the anchor and the connecting lines make it seem like crawlers. The end of the chains form what is known as an epicycle. Since the initialization for the chains are random every step, the generated curve also varies drastically and is extremely sensitive to initial conditions. However, unlike a multi-pendulum system, this is not chaotic, rather deterministic. This gives us the added benefit of parameterizing the model so we don’t depend on the previous step of the simulation to predict the next. The tip position is a closed-form function of time.

Link $i$ has length $L_i$, an initial angle $\varphi_i$, and an angular velocity $\omega_i$, so its angle at time $t$ is simply $\varphi_i + \omega_i t$. Summing the contributions down a chain of $N$ links from a pivot at $(x_0, y_0)$:

$$ x(t) = x_0 + \sum_{i=1}^{N} L_i \sin(\varphi_i + \omega_i t) $$

$$ y(t) = y_0 + \sum_{i=1}^{N} L_i \cos(\varphi_i + \omega_i t) $$

Or, treating the plane as the complex plane, which is much tidier:

$$ z(t) = z_0 + \sum_{i=1}^{N} L_i e^{i(\varphi_i + \omega_i t)} $$

With this parameterizion, we can now predict the state of the chain at any point in time and even look ahead many many steps in the future. Simulating the entire thing by stepping through frames of the sketch is really slow and dependent on the hardware capability of the machine it’s running on. This parameterizion actually fixes the issue as it is no longer dependent on the framerate.

The random points around the crawler anchor is generated using poisson disk sampling. Pure random (or even pseudo random) numbers have a tendency to cluster together, a phenomenon know as poisson clumping. Poisson disk sampling gives a uniform look to the randomly scattered points.

Motivation

This was largely inspired from the work Process Compendium by Casey Reas. There he describes how a simple set of elements and interaction processes can lead to complex forms and behaviours. For Random Crawlers, this can be described simply as follows:

Element 1. A point that moves along the sum of $N$ circular motions. Element 2. Stationary points distributed uniformly along the plane. Process. Draw a line from each Element 1 to every Element 2 within distance $d$.

Tahsin Tariq
Tahsin Tariq
Lecturer, CSE

Hello, I work on human-robot interactions, computer vision, and deep learning.