M-File Help: Navigation | View code for Navigation |
Navigation superclass
An abstract superclass for implementing planar grid-based navigation classes.
Navigation | Superclass constructor |
plan | Find a path to goal |
query | Return/animate a path from start to goal |
plot | Display the occupancy grid |
display | Display the parameters in human readable form |
char | Convert to string |
isoccupied | Test if cell is occupied |
rand | Uniformly distributed random number |
randn | Normally distributed random number |
randi | Uniformly distributed random integer |
progress_init | Create a progress bar |
progress | Update progress bar |
progress_delete | Remove progress bar |
occgrid | Occupancy grid representing the navigation environment |
goal | Goal coordinate |
start | Start coordinate |
seed0 | Random number state |
plan | Generate a plan for motion to goal |
next | Returns coordinate of next point along path |
goal_set | The goal has been changed by nav.goal = (a,b) |
navigate_init | Start of path planning. |
Bug2, Dstar, Dxform, PRM, Lattice, RRT
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.
'goal', G | Specify the goal point (2x1) |
'inflate', K | Inflate all obstacles by K cells. |
'private' | Use private random number stream. |
'reset' | Reset random number stream. |
'verbose' | Display debugging information |
'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. |
Convert to string
N.char() is a string representing the state of the navigation object in human-readable form.
Display status of navigation object
N.display() displays the state of the navigation object in human-readable form.
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.
Test if grid cell is occupied
N.isoccupied(pos) is true if there is a valid grid map and the coordinate pos (1x2) is occupied. P=[X,Y] rather than MATLAB row-column coordinates.
N.isoccupied(x,y) as above but the coordinates given separately.
Print 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.
Notify start of path
N.navigate_init(start) is called when the query() method is invoked. Typically overriden in a subclass to take particular action such as computing some path parameters. start (2x1) is the initial position for this path, and nav.goal (2x1) is the final position.
Visualize navigation environment
N.plot(options) displays the occupancy grid in a new figure.
N.plot(p, options) as above but overlays the points along the path (2xM) matrix.
'distance', D | Display a distance field D behind the obstacle map. D is a matrix of the same size as the occupancy grid. |
'colormap', @f | Specify a colormap for the distance field as a function handle, eg. @hsv |
'beta', B | Brighten the distance field by factor B. |
'inflated' | Show the inflated occupancy grid rather than original |
Navigation.plot_fg, Navigation.plot_bg
Visualization background
N.plot_bg(options) displays the occupancy grid with occupied cells shown as red and an optional distance field.
N.plot_bg(p,options) as above but overlays the points along the path (2xM) matrix.
'distance', D | Display a distance field D behind the obstacle map. D is a matrix of the same size as the occupancy grid. |
'colormap', @f | Specify a colormap for the distance field as a function handle, eg. @hsv |
'beta', B | Brighten the distance field by factor B. |
'inflated' | Show the inflated occupancy grid rather than original |
'pathmarker', M | Options to draw a path point |
'startmarker', M | Options to draw the start marker |
'goalmarker', M | Options to draw the goal marker |
Navigation.plot, Navigation.plot_fg, brighten
Visualization foreground
N.plot_fg(options) displays the start and goal locations if specified. By default the goal is a pentagram and start is a circle.
N.plot_fg(p, options) as above but overlays the points along the path (2xM) matrix.
'pathmarker', M | Options to draw a path point |
'startmarker', M | Options to draw the start marker |
'goalmarker', M | Options to draw the goal marker |
Find a path from start to goal using plan
N.query(start, options) animates the robot moving from start (2x1) to the goal (which is a property of the object) using a previously computed plan.
x = N.query(start, options) returns the path (Mx2) from start to the goal (which is a property of the object).
The method performs the following steps:
'animate' | Show the computed path as a series of green dots. |
Navigation.navigate_init, Navigation.plot, Navigation.goal
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.
Navigation.randi, Navigation.randn, rand, RandStream
Integer random number
i = N.randi(rm) returns 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 returns a matrix (MxM) of random integers.
i = N.randn(rm, L,m) as above but returns a matrix (LxM) of random integers.
Navigation.rand, Navigation.randn, randi, RandStream
Normally distributed random number
R = N.randn() returns a normally distributed random number from a private random number stream.
R = N.randn(m) as above but returns a matrix (MxM) of random numbers.
R = N.randn(L,m) as above but returns a matrix (LxM) of random numbers.
Navigation.rand, Navigation.randi, randn, RandStream
Update progress spinner
N.spinner() displays a simple ASCII progress spinner, a rotating bar.
Set verbosity
N.verbosity(v) set verbosity to v, where 0 is silent and greater values display more information.
© 1990-2014 Peter Corke.