MATLAB 도움말 센터
Total elapsed duration of control path
Since R2021b
totalTime = pathDuration(pathObj)
totalTime = pathDuration(pathObj) returns the total elapsed duration of the control path.
totalTime
pathObj
example
collapse all
Set State and State Propagator Parameters
Load a ternary map matrix and create an occupancyMap object.
occupancyMap
load("exampleMaps","ternaryMap") map = occupancyMap(ternaryMap,10);
Create a state propagator for a bicycle kinematic model using the map.
propagator = mobileRobotPropagator(Environment=map);
Set the state bounds on the state space based on the map world limits.
propagator.StateSpace.StateBounds(1:2,:) = [map.XWorldLimits; map.YWorldLimits];
Plan Path
Create the path planner from the state propagator.
planner = plannerControlRRT(propagator);
Specify the start and goal states.
start = [10 15 0]; goal = [40 30 0];
Plan a path between the states. For repeatable results, reset the random number generator before planning.
rng("default") path = plan(planner,start,goal);
Check the total elapsed duration of the control path.
pathDuration(path)
ans = 102.4000
Interpolate the path to the control step size of the propagator.
interpolate(path)
Visualize the path.
figure show(map) hold on plot(start(1),start(2),"rx") plot(goal(1),goal(2),"go") plot(path.States(:,1),path.States(:,2),"b") hold off
Plan Return Path
Plan a second path from the end of the previous path location back to the start.
path2 = plan(planner,path.States(end,:),start);
Check the total elapsed duration of the second path.
pathDuration(path2)
ans = 100.3000
figure show(map) hold on plot(start(1),start(2),"rx") plot(goal(1),goal(2),"go") plot(path2.States(:,1),path2.States(:,2),"m") hold off
Combine Paths
Extract the sequence of motions from the second path.
states = path2.States(2:end,:); controls = path2.Controls; targets = path2.TargetStates; durations = path2.Durations;
Append this sequence to the end of the first path.
append(path,states,controls,targets,durations)
Interpolate the new segments in the original path.
Check the total elapsed duration of the final path.
navControlPath
Control path, specified as a navPathControl object.
navPathControl
Data Types: double
double
Total duration of the control path, returned as a positive scalar in seconds.
Introduced in R2021b
navPath
mobileRobotPropagator
append
interpolate
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
유럽
아시아 태평양
지역별 지사에 문의