Maybe try
planner = plannerAStarGrid(map,'DiagonalSearch', 0);
% or
planner = plannerAStarGrid(map);
planner.DiagonalSearch = 'off'; % or false or 0
I don't have that function in any of my toolboxes, so I can't really test it. What toolbox is it in?
help plannerAStarGrid
plannerAStarGrid A* path planner for grid map.
A* path planning algorithm performs A* search on the occupancy map and
finds obstacle-free, shortest path between the given start grid and
goal grid guided by heuristic cost.
PLANNER = plannerAStarGrid creates a plannerAStarGrid object with a
binaryOccupancyMap with a width and height of 10 meters, and grid
resolution of one cell per meter.
PLANNER = plannerAStarGrid(MAP) creates a plannerAStarGrid object with
the specified map object, MAP. Specify the Map either as a
binaryOccupancyMap or occupancyMap object. The MAP input sets the
value of the Map property.
PLANNER = plannerAStarGrid(MAP, Name, Value, ...) specifies additional
attributes of the plannerAStarGrid object with each specified property
name set to the specified value. Name must appear inside single
quotes (''). You can specify several name-value pair arguments in any
order as Name1,Value1,...,NameN,ValueN. Properties not specified retain
their default values.
plannerAStarGrid properties:
Map - Map representation.
TieBreaker - Toggle tie breaker.
DiagonalSearch - Toggle diagonal search.
GCost - Cost of moving between any two points in a grid.
GCostFcn - Custom gcost function.
HCost - Heuristic cost between a point and goal in a grid.
HCostFcn - Custom hcost function.
plannerAStarGrid methods:
plan - Finds obstacle-free path between two points.
show - Visualize the planned path.
Example:
% Create a binary occupancy map
map = binaryOccupancyMap(zeros(50,50));
% Create plannerAStarGrid object with map
planner = plannerAStarGrid(map);
% Find path between two grid coordinates
pathRowCol = plan(planner, [2 3], [28 46]);
% Visualize the map and path in a figure
show(planner)
% Adding legend to plot
legend
Example:
% Create a binary occupancy map
map = binaryOccupancyMap(zeros(50,50));
% Create plannerAStarGrid object with map
planner = plannerAStarGrid(map,'HCost','Manhattan');
% Find path between two grid coordinates
pathRowCol = plan(planner, [2 3], [28 46]);
% Visualize the map and path in a figure
show(planner)
% Adding legend to plot
legend
Example:
% Create a binary occupancy map
map = binaryOccupancyMap(zeros(50,50));
% Custom Manhattan distance function handle.
manhattan = @(pose1,pose2)sum(abs(pose1-pose2),2);
% Create plannerAStarGrid object with map and custom hcost function
planner = plannerAStarGrid(map,'HCostFcn',manhattan);
% Find path between two grid coordinates
pathRowCol = plan(planner, [2 3], [28 46]);
% Visualize the map and path in a figure
show(planner)
% Adding legend to plot
legend
See also binaryOccupancyMap, occupancyMap, plannerRRT,
plannerHybridAStar
Documentation for plannerAStarGrid
doc plannerAStarGrid