name value pairs are not working for plannerAStarGrid

조회 수: 2 (최근 30일)
Harry Dunn
Harry Dunn 2023년 4월 15일
댓글: Image Analyst 2023년 4월 15일
I want to switch diagonal search off in the below function which should work according to the documentationfor plannerAStarGrid but Matlab is stating that:
"'DiagonalSearch' is not a recognized parameter. For a list of valid name-value pair arguments, see the documentation for this function.".
The documentation itself states that this is a valid name value pair and the function works with other name value pairs such as 'TieBreaker'. Am I doing something wrong?
planner = plannerAStarGrid(map,'DiagonalSearch','off');

답변 (1개)

Image Analyst
Image Analyst 2023년 4월 15일
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
  댓글 수: 2
Harry Dunn
Harry Dunn 2023년 4월 15일
Thanks for such a quick response.
Its in the navigation toolbox. I just went on the online Matlab editor and for some reason the exact same code works online but not on my downloaded issue. Does this likely mean that it is the version of matlab which is causing the issue?
Image Analyst
Image Analyst 2023년 4월 15일
Yeah, that's strange. I'd call them about it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Motion Planning에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by