How to locate a collide segment of a post-smoothed path?
3 ビュー (過去 30 日間)
古いコメントを表示
I am working on motion planning problem, and so fare i have generated irregular path and then prun it using Ramer–Douglas–Peucker algorithm later by utilizing piecewise cubic B-spline we could produce smoothed path. However, collision-freeness is not quarantee so that I am trying to check for a collision condition for a post-smoothed path. I have mangage to identify if there is a collision using the following code:
env = map;
% J = im2uint8( map );
% env = imnoise( J ,'salt & pepper');
v = pathSmooth;
for ii = 1:length(v)-1
if env(round(v(ii,1)), round(v(ii,2))) ~= 0
disp('There is no intersection')
else
disp('There is intersection')
pause;
end
end
My question, how to locate the first and last locations where the collision are detected based on the ii index and return them?
I have attached mat files for the used map as well as the resulted smoothed path for your reference as well as an image for the map, reduced path, and smoothed path.
0 件のコメント
採用された回答
KSSV
2022 年 6 月 9 日
env = map;
% J = im2uint8( map );
% env = imnoise( J ,'salt & pepper');
v = pathSmooth;
iwant = zeros([],2) ;
count = 0 ;
for ii = 1:length(v)-1
if env(round(v(ii,1)), round(v(ii,2))) ~= 0
disp('There is no intersection')
else
count = count+1 ;
iwant(count,:) = [round(v(ii,1)), round(v(ii,2))] ;
disp('There is intersection')
end
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interpolation of 2-D Selections in 3-D Grids についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!