M-File Help: Dstar | View code for Dstar |
D* navigation class
A concrete subclass of the abstract Navigation class that implements the D* navigation algorithm. This provides minimum distance paths and facilitates incremental replanning.
Dstar | Constructor |
plan | Compute the cost map given a goal and map |
query | Find a path |
plot | Display the obstacle map |
display | Print the parameters in human readable form |
char | Convert to string% costmap_modify Modify the costmap |
modify_cost | Modify the costmap |
distancemap | Distance from each point to the goal. |
costmap | Cost of traversing cell (in any direction). |
niter | Number of iterations. |
load map1 % load map goal = [50,30]; start=[20,10]; ds = Dstar(map); % create navigation object ds.plan(goal) % create plan for specified goal ds.query(start) % animate path from this start location
D* constructor
ds = Dstar(map, options) is a D* navigation object, and map is an occupancy grid, a representation of a planar world as a matrix whose elements are 0 (free space) or 1 (occupied). The occupancy grid is coverted to a costmap with a unit cost for traversing a cell.
'goal', G | Specify the goal point (2x1) |
'metric', M | Specify the distance metric as 'euclidean' (default) or 'cityblock'. |
'inflate', K | Inflate all obstacles by K cells. |
'progress' | Don't display the progress spinner |
Other options are supported by the Navigation superclass.
Convert navigation object to string
DS.char() is a string representing the state of the Dstar object in human-readable form.
Dstar.display, Navigation.char
Modify cost map
DS.modify_cost(p, C) modifies the cost map for the points described by the columns of p (2xN) and sets them to the corresponding elements of C (1xN). For the particular case where p (2x2) the first and last columns define the corners of a rectangular region which is set to C (1x1).
Plan path to goal
DS.plan(options) create a D* plan to reach the goal from all free cells in the map. Also updates a D* plan after changes to the costmap. The goal is as previously specified.
DS.plan(goal,options) as above but goal given explicitly.
'animate' | Plot the distance transform as it evolves |
'progress' | Display a progress bar |
Visualize navigation environment
DS.plot() displays the occupancy grid and the goal distance in a new figure. The goal distance is shown by intensity which increases with distance from the goal. Obstacles are overlaid and shown in red.
DS.plot(p) as above but also overlays a path given by the set of points p (Mx2).
Reset the planner
DS.reset() resets the D* planner. The next instantiation of DS.plan() will perform a global replan.
Set the current costmap
DS.set_cost(C) sets the current costmap. The cost map is the same size as the occupancy grid and the value of each element represents the cost of traversing the cell. A high value indicates that the cell is more costly (difficult) to traverese. A value of Inf indicates an obstacle.
© 1990-2014 Peter Corke.