Table of Contents

ChangeLog

26 August 2013

9 April 2013

11 March 2013

  • Changed from llSetVelocity to llApplyImpulse in order to make the script OpenSim compatible.

Article

Introduction

As we have previously introduced weighted state machines state machines, we provide an example of what the weighted non-deterministic finite automaton (wNFA) might be be used for. We name it Great Wanderer since it is an similar to Wanderer but provides proximity-aware movement.

More precisely, a usual variation of wanderer is to add the following lines at the end of the code:

collision_start(integer num) {
  moveTo(nextCoordinates(MOVEMENT_TYPE));
}

which would make the wandering object change its destination in case it collides with another object.

The Great Wanderer, on the other hand, uses the wNFA to probabilistically determine the next destination.

Video

Realtime Plot

Great Wanderer One is the name given to a Great Wanderer, currently on OpenSim which is currently mapping a $5m \times 5m \times 5m$ box. The dimensions of the Great Wanderer One are $.5m \times .5m \times .5m$ (a standard default primitive cube).

One may observe that the most dense scatter on the real-time display, takes place around corners and close objects. This is because the wNNA has to do the most work around those difficult geometries. You can observe a typical corner-movement in the video section.

Possible Practical Applications

Possibly, except animating animals in Second Life, the Great Wanderer could be used for autonomous space exploration; one result thereof could be passively cartographing that space. This works well under Second Life terms (see below), however under real-life circumstances one may not wish to collide with an object in order to sense that that object is in the path of the current trajectory.

In such circumstances, similar to Second Life, one could use a detector llSensor that continuously scans a $2\pi$ area, encompassing the entire volume of the Great Wanderer and switch to the compute state once the proximity of an object has been detected. This would avoid collisions but for simplicity's sake, we avoided to complicate the example since there is no destruction due to impact in Second Life (although implementing it would be easy with Great Wanderer, simply by progressively darkening the faces on impact but without the possibility of elastic deformations).

Cartography

Since the Great Wanderer is able to sense and repel from objects and determines the next destination by calculating the safest route based on the cumulative probabilities of all directions, a practical application could be to use the Great Wanderer for space mapping. More precisely, given an enclosed space (cubic, under simulation restrictions), the Great Wanderer will eventually explore all the possible areas of the cube. Whenever the Great Wanderer impacts with a primitive, the Great Wanderer's coordinates are recorded in a database. After that, all the coordinates gathered by wanderer are mapped in three dimensions.

Given an uniform scattering of probabilities, eventually every point within the confined space will be visited at some point - except those occluded by objects.

Explaining Brownian Movement

The Great Wanderer could be used to explain Brownian movement by placing several, smaller, Great Wanderers in an enclosure:

By applying an impulse to one of the smaller cubes (Great Wanderers), the kinetic energy transferred to the small Great Wanderer will make it drift towards its neighbors. Upon collision, the other cubes will start moving, perhaps colliding with each other. At some point, due to the nature of the Great Wanderer, all the smaller cubes will drift towards the fringe of the enclosure.

Code

The Great Wanderer, has four modules which one may use independently, depending on the application:

Module Description
Great Wanderer the main LSL script
Position to Database PHP script to enter coordinates in an SQLite3 database
Position to Web Server LSL script that passes data to a web-server

The database-related scripts are only needed in case one chooses to track collisions.

Index