M-File Help: Navigation | View code for Navigation

# Navigation

Navigation superclass

An abstract superclass for implementing navigation classes.

## Methods

plot | Display the occupancy grid
visualize | Display the occupancy grid (deprecated)
plan | Plan a path to goal
path | Return/animate a path from start to goal
display | Display the parameters in human readable form
char | Convert to string

rand | Uniformly distributed random number
randn | Normally distributed random number
randi | Uniformly distributed random integer

## Properties (read only)

occgrid | Occupancy grid representing the navigation environment
goal | Goal coordinate
seed0 | Random number state

## Methods that must be provided in subclass

plan | Generate a plan for motion to goal
next | Returns coordinate of next point along path

## Methods that may be overriden in a subclass

goal_set | The goal has been changed by nav.goal = (a,b)
navigate_init | Start of path planning.

## Notes

- Subclasses the MATLAB handle class which means that pass by reference semantics apply.
- A grid world is assumed and vehicle position is quantized to grid cells.
- Vehicle orientation is not considered.
- The initial random number state is captured as seed0 to allow rerunning an experiment with an interesting outcome.

## See also

Dstar, dxform, PRM, RRT

# Navigation.Navigation

Create a Navigation object

n = Navigation(occgrid, options) is a Navigation object that holds an occupancy grid occgrid. A number of options can be be passed.

## Options

'navhook', F | Specify a function to be called at every step of path
'goal', G | Specify the goal point (2x1)
'verbose' | Display debugging information
'inflate', K | Inflate all obstacles by K cells.
'private' | Use private random number stream.
'reset' | Reset random number stream.
'seed', S | Set the initial state of the random number stream. S must be a proper random number generator state such as saved in the seed0 property of an earlier run.

## Notes

- In the occupancy grid a value of zero means free space and non-zero means occupied (not driveable).
- Obstacle inflation is performed with a round structuring element (kcircle).
- The 'private' option creates a private random number stream for the methods rand, randn and randi. If not given the global stream is used.

# Navigation.char

Convert to string

N.char() is a string representing the state of the navigation object in human-readable form.

# Navigation.display

Display status of navigation object

N.display() displays the state of the navigation object in human-readable form.

## Notes

- This method is invoked implicitly at the command line when the result of an expression is a Navigation object and the command has no trailing semicolon.

## See also

Navigation.char

# Navigation.goal_change

Notify change of goal

Invoked when the goal property of the object is changed. Typically this is overriden in a subclass to take particular action such as invalidating a costmap.

# Navigation.message

Display debug message

N.message(s) displays the string s if the verbose property is true.

N.message(fmt, args) as above but accepts printf() like semantics.

# Navigation.navigate_init

Notify start of path

Invoked when the path() method is invoked. Typically overriden in a subclass to take particular action such as computing some path parameters. start is the initial position for this path, and nav.goal is the final position.

# Navigation.path

Follow path from start to goal

N.path(start) animates the robot moving from start (2x1) to the goal (which is a property of the object).

N.path() as above but first displays the occupancy grid, and prompts the user to click a start location. the object).

x = N.path(start) returns the path (2xM) from start to the goal (which is a property of the object).

The method performs the following steps:

- Get start position interactively if not given
- Initialized navigation, invoke method N.navigate_init()
- Visualize the environment, invoke method N.plot()
- Iterate on the next() method of the subclass

## See also

Navigation.plot, Navigation.goal

# Navigation.plot

Visualize navigation environment

N.plot() displays the occupancy grid in a new figure.

N.plot(p) as above but overlays the points along the path (Mx2) matrix.

## Options

'goal' | Superimpose the goal position if set
'distance', D | Display a distance field D behind the obstacle map. D is a matrix of the same size as the occupancy grid.

# Navigation.rand

Uniformly distributed random number

R = N.rand() return a uniformly distributed random number from a private random number stream.

R = N.rand(m) as above but return a matrix (MxM) of random numbers.

R = N.rand(L,m) as above but return a matrix (LxM) of random numbers.

## Notes

- Accepts the same arguments as rand().
- Seed is provided to Navigation constructor.

## See also

rand, randstream

# Navigation.randi

Integer random number

i = N.randi(rm) return a uniformly distributed random integer in the range 1 to rm from a private random number stream.

i = N.randi(rm, m) as above but return a matrix (MxM) of random integers.

i = N.randn(rm, L,m) as above but return a matrix (LxM) of random integers.

## Notes

- Accepts the same arguments as randn().
- Seed is provided to Navigation constructor.

## See also

randn, randstream

# Navigation.randn

Normally distributed random number

R = N.randn() return a normally distributed random number from a private random number stream.

R = N.randn(m) as above but return a matrix (MxM) of random numbers.

R = N.randn(L,m) as above but return a matrix (LxM) of random numbers.

## Notes

- Accepts the same arguments as randn().
- Seed is provided to Navigation constructor.

## See also

randn, randstream

# Navigation.spinner

Update progress spinner

N.spinner() displays a simple ASCII progress spinner, a rotating bar.

# Navigation.verbosity

Set verbosity

N.verbosity(v) set verbosity to v, where 0 is silent and greater values display more information.

© 1990-2014 Peter Corke.