Home  >  Examples  >  Simple navigation

Home
Screenshots
Examples
Background
Changes
Contact
User guide
Simple navigation
Rat components
Programattic navigation

Simple navigation - avoiding the walls

Download: simpnav.jar (after saving the file locally, the components can be imported with the import... option from the File menu).

There are two parts to the navigation task: the environment that the rat moves around in, and the rat itself. The screenshots work from the top down showing first how the two are combined, and the two separate parts. For details of the component definitions that back up the behaviors see Rat components.

To see it in action, you have to run the model, but this screenshot shows the main behavior. The rat is in a corner of the T-maze and the nearest two white dots indicate the end of its whiskers. The left whisker is in contact with the wall, and will be generating spikes. The control script turns the rat a bit to the right each time a spike arrives from the left whiskers. By adjusting the amount of turn and whisker position it is possible to get the rat to explore the environment without getting stuck. screenshot
The main model is of type "MazeExperiment". It is very simple, just specifying which rat to use with which maze. You can select from any of the defined rats and mazes by right-clicking on the corresponding images, or by editing the main component on the right. screenshot
There is a short (one line) script associated with the main model: it moves the rat to the starting point in the maze at the beginning of the experiment. screenshot

The Maze

The maze is a simple T shape. The boundary was created from the closed curve component on the far left of the second row of components (looks like a triangle to start with) by dragging out extra points. The lights, dispenser speaker and lever are not used in this experiment, but are there because the same maze model can be used in many different contexts. Apart from the boundary, the only essential component is the "Start" marker which defines a named location in the maze. This is accessed by the control script for the experiment as a whole when it says 'rat.moveTo("maze.start");'.

This maze is rather simple - there is no control script or other logic associated with it, but for more complicated experiments the signal sent form the lever could for example be connected to the dispenser to provide a food reward and so on.

screenshot

The Rat

The rat has a simple physical shape and two sets of whiskers positioned about level with his nose to left and right. The actual position of the whiskers is defined by the little green dot at the end of the line coming out of the image. The behavior of the whisker component is to generate spikes when there is a wall or barrier between the body and the point where the whiskers are, so it acts a bit as though there was a real whisker between the body and the green dot. There is one settable parameter for the whiskers - the frequency of spikes that are generated when they are in contact with something.

In this model, each set of whiskers is connected to a different buzzer so you can hear when they are active. But the main behavior (moving around and avoiding walls) is defined by the script that controls the rat.

screenshot

In this example, the logic that controls the rats movement is provided by a script. There are three different events to be handled: the regular update as time moves on and what to do when spikes arrive from each set of whiskers. The model interface provides containers for each of these. All that is needed for the script is to put in the appropriate lines. There is not much to this script: when a spike comes form the left whiskers it turns 60 degrees to the right, and a spike from the right makes it turn 30 degrees left. Then at each timestep, the current bearing is applied to the rat and it attempts to take a step forwards.

screenshot