Shorten path error in Train Deep Learning-Based Sampler for Motion Planning
3 views (last 30 days)
Show older comments
Dear MATLAB users
I am using function 'exampleHelperGenerateMazeDataset in Train Deep Learning-Based Sampler for Motion Planning tutorial in Navigation Ttoolbox.
The problem is the function is stopped with the errors below.
I never finished making dataset because of the error
------------------------------------------------------------------------------------------------------------------------------------------------------------
Error using nav.algs.internal.ShortenpathImpl/shorten (line 63)
Unable to shorten the path. Either a path does not exist between two states, or motion constraints prevent a viable path.
Error in shortenpath (line 30)
shortPath = shorten(obj);
Error in exampleHelperGenerateMazeDataset_250319 (line 43)
parfor j=1:numPathsPerMap
--------------------------------------------------------------------------------------------------------------------------------------------------------------
I think the problem is happened while the shortening path from RRT* argorithm.
How can I solve the problem?
0 Comments
Answers (1)
Ajay Pattassery
on 19 Mar 2025
shortenpath is erroring out since the input path that is fed to shortenpath is not collision free when check with stateValidator. The following check can be added to exampleHelperGenerateMazeDataset to shorten only the paths that are valid.
% pathObj path to be shortened
% stateValidator validator used to check whether path is valid or not
isPathValid = true;
for i=1:pathObj.NumStates-1
isvalid = stateValidator.isMotionValid(pathObj.States(i,:), pathObj.States(i+1,:));
if ~isvalid
isPathValid = false;
break;
end
end
if isPathValid
shortenedPath = shortenpath(pathObj, stateValidator);
end
0 Comments
See Also
Categories
Find more on Motion Planning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!