M-File Help: Dstar | View code for Dstar |
D* navigation class
A concrete subclass of the Navigation class that implements the D* navigation algorithm. This provides minimum distance paths and facilitates incremental replanning.
plan | Compute the cost map given a goal and map |
path | Compute a path to the goal |
visualize | Display the obstacle map (deprecated) |
plot | Display the obstacle map |
costmap_modify | Modify the costmap |
modify_cost | Modify the costmap (deprecated, use costmap_modify) |
costmap_get | Return the current costmap |
costmap_set | Set the current costmap |
distancemap_get | Set the current distance map |
display | Print the parameters in human readable form |
char | Convert to string |
costmap | Distance from each point to the goal. |
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.path(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. |
'quiet' | 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
Get the current costmap
C = DS.costmap_get() is 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. It is autogenerated by the class constructor from the occupancy grid such that:
Dstar.costmap_set, Dstar.costmap_modify
Modify cost map
DS.costmap_modify(p, new) modifies the cost map at p=[X,Y] to have the value new. If p (2xM) and new (1xM) then the cost of the points defined by the columns of p are set to the corresponding elements of new.
Dstar.costmap_set, Dstar.costmap_get
Set the current costmap
DS.costmap_set(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.
Dstar.costmap_get, Dstar.costmap_modify
Get the current distance map
C = DS.distancemap_get() is the current distance map. This map is the same size as the occupancy grid and the value of each element is the shortest distance from the corresponding point in the map to the current goal. It is computed by Dstar.plan.
Modify cost map
Dstar.costmap_set, Dstar.costmap_get
Plan path to goal
DS.plan() updates DS with a costmap of distance to the goal from every non-obstacle point in the map. The goal is as specified to the constructor.
DS.plan(goal) as above but uses the specified goal.
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.
© 1990-2012 Peter Corke.