qGraph function added for C-space
This commit is contained in:
parent
e7c410c79b
commit
2c1af2338b
Binary file not shown.
|
|
@ -43,7 +43,7 @@ function buildPRM (rangeQ1Q2, nbPoints, L1, L2, MapFilename)
|
||||||
drawLine(top_line);
|
drawLine(top_line);
|
||||||
hold on;
|
hold on;
|
||||||
drawLine(bottom_line);
|
drawLine(bottom_line);
|
||||||
center_box=[L2 L2; -L2 L2; -L2 -L2; L2 -L2]
|
center_box=[L2 L2; -L2 L2; -L2 -L2; L2 -L2];
|
||||||
drawPolygon(center_box);
|
drawPolygon(center_box);
|
||||||
hold on;
|
hold on;
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ function buildPRM (rangeQ1Q2, nbPoints, L1, L2, MapFilename)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (OutOfRange==0)
|
if (OutOfRange==0)
|
||||||
|
Q_storage(1:2, i)=Q;
|
||||||
Points(1:2, i)=jTee; %assign the current random point to the Points matrix
|
Points(1:2, i)=jTee; %assign the current random point to the Points matrix
|
||||||
MatrixOfLinks(i, i)=1; %it doesnt intersect with the obstacles when compared to itself
|
MatrixOfLinks(i, i)=1; %it doesnt intersect with the obstacles when compared to itself
|
||||||
|
|
||||||
|
|
@ -111,6 +111,7 @@ function buildPRM (rangeQ1Q2, nbPoints, L1, L2, MapFilename)
|
||||||
|
|
||||||
MatrixOfLinks
|
MatrixOfLinks
|
||||||
Points %display the points vector to check on the graph
|
Points %display the points vector to check on the graph
|
||||||
|
qGraph (Q_storage, nbPoints, MatrixOfLinks)
|
||||||
|
|
||||||
%saves the results into a .mat file
|
%saves the results into a .mat file
|
||||||
save(strcat(MapFilename,'.mat'), 'Points', 'MatrixOfLinks')
|
save(strcat(MapFilename,'.mat'), 'Points', 'MatrixOfLinks')
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Created by Octave 7.3.0, Tue Jan 10 14:36:10 2023 GMT <unknown@LAPTOP-EJ1AIJHT>
|
||||||
|
# name: Points
|
||||||
|
# type: matrix
|
||||||
|
# rows: 2
|
||||||
|
# columns: 10
|
||||||
|
-2.9722694997088999 2.2027074585576791 -2.4163314018998832 -1.563641777935366 1.8247189104154553 -0.17308723248350155 0.24577290552178044 -0.80469834936605633 2.0135592026997866 -0.36560396489119051
|
||||||
|
0.047890118375208762 -0.42713698315704518 -0.30925089631194735 -1.216804326954257 1.3865824550438368 1.3067789455813377 -1.2708472666201218 1.1717992231942889 -0.02269206049426975 1.84133215165838
|
||||||
|
|
||||||
|
|
||||||
|
# name: MatrixOfLinks
|
||||||
|
# type: matrix
|
||||||
|
# rows: 10
|
||||||
|
# columns: 10
|
||||||
|
1 0 1 1 0 0 0 1 0 1
|
||||||
|
0 1 0 0 1 0 0 0 1 0
|
||||||
|
1 0 1 1 0 0 0 0 0 1
|
||||||
|
1 0 1 1 0 0 1 0 0 0
|
||||||
|
0 1 0 0 1 1 0 1 1 1
|
||||||
|
0 0 0 0 1 1 0 1 0 1
|
||||||
|
0 0 0 1 0 0 1 0 0 0
|
||||||
|
1 0 0 0 1 1 0 1 0 1
|
||||||
|
0 1 0 0 1 0 0 0 1 0
|
||||||
|
1 0 1 0 1 1 0 1 0 1
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
## Author: adril <adril@LAPTOP-EJ1AIJHT>
|
||||||
|
## Created: 2023-01-10
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%function buildPRM (rangeQ1Q2, nbPoints, L1, L2, MapFilename)
|
||||||
|
%
|
||||||
|
% Task:
|
||||||
|
%
|
||||||
|
% Inputs:
|
||||||
|
% -
|
||||||
|
%
|
||||||
|
% Outputs:
|
||||||
|
% - None
|
||||||
|
%
|
||||||
|
% Adrien Lasserre (adrien.lasserre@ecam.fr) & Gwenn Durpoix-Espinasson (g.durpoix-espinasson@ecam.fr)
|
||||||
|
% 10/01/2023
|
||||||
|
%
|
||||||
|
% Check library matgeom: https://octave.sourceforge.io/matgeom/overview.html
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
function qGraph (Q, nbPoints, mat)
|
||||||
|
hold off;
|
||||||
|
figure 2
|
||||||
|
for i=1:nbPoints
|
||||||
|
for j=1:nbPoints
|
||||||
|
drawPoint(Q(1,i), Q(2,i));
|
||||||
|
current_point=[Q(1, i), Q(2, i)];
|
||||||
|
previous_point=[Q(1, j), Q(2, j)];
|
||||||
|
if mat(i, j)==1 & mat(j, i)==1
|
||||||
|
L = createEdge(current_point, previous_point);
|
||||||
|
hold on;
|
||||||
|
drawEdge(L);
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
# graph
|
||||||
|
# nodes
|
||||||
|
5 2
|
||||||
|
10 10
|
||||||
|
20 10
|
||||||
|
10 20
|
||||||
|
20 20
|
||||||
|
27 15
|
||||||
|
# edges
|
||||||
|
6
|
||||||
|
1 2
|
||||||
|
1 3
|
||||||
|
2 4
|
||||||
|
2 5
|
||||||
|
3 4
|
||||||
|
4 5
|
||||||
|
|
@ -52,7 +52,6 @@ intersectLinePolygon(L, poly_a)
|
||||||
isempty(intersectLinePolygon(L, poly_a))!=1
|
isempty(intersectLinePolygon(L, poly_a))!=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## This should be how we apply the function:
|
## This should be how we apply the function:
|
||||||
####rangeQ1Q2=[-5, -5; 5, 5];
|
####rangeQ1Q2=[-5, -5; 5, 5];
|
||||||
####nbPoints=10;
|
####nbPoints=10;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue