Main Content

driving.ReedsSheppPathSegment

Reeds-Shepp path segment

Description

A driving.ReedsSheppPathSegment object represents a segment of a planned vehicle path that was connected using the Reeds-Shepp connection method [1]. A Reeds-Shepp path segment is composed of a sequence of three to five motions. Each motion is one of these types:

  • Straight (forward or reverse)

  • Left turn at the maximum steering angle of the vehicle (forward or reverse)

  • Right turn at the maximum steering angle of the vehicle (forward or reverse)

The driving.ReedsSheppPathSegment objects that represent a path are stored in the PathSegments property of a driving.Path object. These paths are planned by a pathPlannerRRT object whose ConnectionMethod property is set to 'Reeds-Shepp'.

Properties

expand all

This property is read-only.

Initial pose of the vehicle at the start of the path segment, specified as an [x, y, Θ] vector. x and y are in world units, such as meters. Θ is in degrees.

This property is read-only.

Goal pose of the vehicle at the end of the path segment, specified as an [x, y, Θ] vector. x and y are in world units, such as meters. Θ is in degrees.

This property is read-only.

Minimum turning radius of the vehicle, in world units, specified as a positive real scalar. This value corresponds to the radius of the turning circle at the maximum steering angle of the vehicle.

This property is read-only.

Length of each motion in the path segment, in world units, specified as a five-element real-valued vector. Each motion length corresponds to a motion type specified in MotionTypes and a motion direction specified in MotionDirections.

When a path segment requires fewer than five motions, the remaining MotionLengths elements are set to 0. The remaining MotionTypes elements are set to "N" (no motion).

This property is read-only.

Type of each motion in the path segment, specified as a five-element string array. Valid values are shown in this table.

Motion TypeDescription
"S"Straight (forward or reverse)
"L"

Left turn at the maximum steering angle of the vehicle (forward or reverse)

"R"

Right turn at the maximum steering angle of the vehicle (forward or reverse)

"N"No motion

MotionTypes contains a minimum of three motions, specified as a combination of "S", "L", and "R" elements. If a path segment has fewer than five motions, the remaining elements of MotionTypes are "N" (no motion).

Each motion type corresponds to a motion length specified in MotionLengths and a motion direction specified in MotionDirections.

Example: ["R" "S" "R" "L" "N"]

This property is read-only.

Direction of each motion in the path segment, specified as a five-element vector of 1s (forward motion) and –1s (reverse motion). Each motion direction corresponds to a motion length specified in MotionLengths and a motion type specified in MotionTypes.

When no motion occurs, that is, when a MotionTypes value is "N", then the corresponding MotionDirections element is 1.

Example: [-1 1 -1 1 1]

This property is read-only.

Length of the path segment, in world units, specified as a positive real scalar.

Examples

collapse all

Plan a vehicle path through a parking lot by using the optimal rapidly exploring random tree (RRT*) algorithm. The planned path is composed of a sequence of Reeds-Shepp path segments. Check that the path is valid, and then plot the transition poses along the path.

Load a costmap of a parking lot. Plot the costmap to see the parking lot and inflated areas for the vehicle to avoid.

data = load('parkingLotCostmapReducedInflation.mat');
costmap = data.parkingLotCostmapReducedInflation;
plot(costmap)

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 2 objects of type image, patch. This object represents Inflated Areas.

Define start and goal poses for the vehicle as [x, y, Θ] vectors. World units for the (x,y) locations are in meters. World units for the Θ orientation angles are in degrees.

startPose = [4, 4, 90]; % [meters, meters, degrees]
goalPose = [48.75, 29.75, 90];

Use a pathPlannerRRT object to plan a path from the start pose to the goal pose. Set the ConnectionMethod property of the pathPlannerRRT object to 'Reeds-Shepp'.

planner = pathPlannerRRT(costmap);
planner.ConnectionMethod = 'Reeds-Shepp';
refPath = plan(planner,startPose,goalPose);

Check that the path is valid.

isPathValid = checkPathValidity(refPath,costmap)
isPathValid = logical
   1

Interpolate the transition poses along the path.

transitionPoses = interpolate(refPath);

Plot the planned path and the transition poses on the costmap.

hold on
plot(refPath,'DisplayName','Planned Path')
scatter(transitionPoses(:,1),transitionPoses(:,2),[],'filled', ...
   'DisplayName','Transition Poses')
hold off

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 31 objects of type image, patch, scatter, line, polygon. These objects represent Inflated Areas, Planned Path, Transition Poses.

Notice that the path from the start pose to the goal pose requires at least one reverse motion before sliding into the parking spot at the goal position. In such scenarios where a reverse motion is required to reach the goal pose, Reeds-Shepp path segments are useful as Dubins path segments do not allow reverse motion.

References

[1] Reeds, J. A., and L. A. Shepp. "Optimal Paths for a Car That Goes Both Forwards and Backwards." Pacific Journal of Mathematics. Vol. 145, Number 2, 1990, pp. 367–393.

Extended Capabilities

Version History

Introduced in R2018b