Main Content


Interpolate path based on propagator step size

Since R2021b



interpolate(pathObj) evaluates the path based on the ControlStepSize property of pathObj, and adds all intermediate points to the path.


collapse all

Create a navPath object based on multiple waypoints in a Dubins space.

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];

Interpolate that path so that it contains exactly 250 points.


Visualize the interpolated path and the original waypoints.

grid on
axis equal
hold on

Figure contains an axes object. The axes object contains 2 objects of type line. One or more of the lines displays its values using only markers

Calculate length of path.

len = pathLength(pathobj);
disp("Path length = " + num2str(len))
Path length = 19.4722

Input Arguments

collapse all

Control path, specified as a navPathControl object.

Data Types: double

Version History

Introduced in R2021b