interpolate
설명
예제
여러 웨이포인트를 기준으로 navPath 생성하기
Dubins 공간에서 여러 웨이포인트를 기준으로 navPath
객체를 생성합니다.
dubinsSpace = stateSpaceDubins([0 25; 0 25; -pi pi])
dubinsSpace = stateSpaceDubins with properties: SE2 Properties Name: 'SE2 Dubins' StateBounds: [3x2 double] NumStateVariables: 3 Dubins Vehicle Properties MinTurningRadius: 1
pathobj = navPath(dubinsSpace)
pathobj = navPath with properties: StateSpace: [1x1 stateSpaceDubins] States: [0x3 double] NumStates: 0 MaxNumStates: Inf
waypoints = [8 10 pi/2; 7 14 pi/4; 10 17 pi/2; 10 10 -pi]; append(pathobj,waypoints)
정확히 250개의 점을 포함하도록 경로를 보간합니다.
interpolate(pathobj,250)
보간된 경로와 원래 웨이포인트를 시각화합니다.
figure grid on axis equal hold on plot(pathobj.States(:,1),pathobj.States(:,2),".b") plot(waypoints(:,1),waypoints(:,2),"*r","MarkerSize",10)
경로의 길이를 계산합니다.
len = pathLength(pathobj);
disp("Path length = " + num2str(len))
Path length = 19.4722
SE(3) 상태공간에서 여러 웨이포인트를 기준으로 navPath
생성하기
도시 블록의 3D 점유 맵을 작업 공간으로 불러옵니다. 장애물이 없는 셀로 간주할 임계값을 지정합니다.
mapData = load("dMapCityBlock.mat");
omap = mapData.omap;
omap.FreeThreshold = 0.5;
장애물 주변에서 안전하게 작동할 수 있도록 점유 맵을 확장하여 완충 지대를 추가합니다.
inflate(omap,1)
상태 변수의 범위가 지정된 SE(3) state space 객체를 생성합니다.
ss = stateSpaceSE3([0 220;0 220;0 100;inf inf;inf inf;inf inf;inf inf]);
SE(3) 상태공간에서 여러 웨이포인트를 기준으로 navPath
객체를 생성합니다.
path = navPath(ss); waypoints = [40 180 15 0.7 0.2 0 0.1; 55 120 20 0.6 0.2 0 0.1; 100 100 25 0.5 0.2 0 0.1; 130 90 30 0.4 0 0.1 0.6; 150 33 35 0.3 0 0.1 0.6]; append(path,waypoints)
정확히 250개의 점을 포함하도록 경로를 보간합니다.
interpolate(path,250)
보간된 경로와 원래 웨이포인트를 시각화합니다.
show(omap) axis equal view([-10 55]) hold on % Start state scatter3(waypoints(1,1),waypoints(1,2),waypoints(1,3),"g","filled") % Goal state scatter3(waypoints(end,1),waypoints(end,2),waypoints(end,3),"r","filled") % Intermediate waypoints scatter3(waypoints(2:end-1,1),waypoints(2:end-1,2), ... waypoints(2:end-1,3),"y","filled") % Path plot3(path.States(:,1),path.States(:,2),path.States(:,3), ... "r-",LineWidth=2)
경로의 길이를 계산합니다.
len = pathLength(path);
disp("Path length = " + num2str(len))
Path length = 204.1797
입력 인수
확장 기능
C/C++ 코드 생성
MATLAB® Coder™를 사용하여 C 코드나 C++ 코드를 생성할 수 있습니다.
버전 내역
R2019b에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)