This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

show

Visualize path segment

Syntax

show(pathSeg)
show(pathSeg,Name,Value)

Description

example

show(pathSeg) plots the path segment with start and goal positions and their headings.

show(pathSeg,Name,Value) also specifies Name,Value pairs to control display settings.

Examples

collapse all

Create a DubinsConnection object.

dubConnObj = robotics.DubinsConnection;

Define start and goal poses as [x y theta] vectors.

startPose = [0 0 0];
goalPose = [1 1 pi];

Calculate a valid path segment to connect the poses.

[pathSegObj, pathCosts] = connect(dubConnObj,startPose,goalPose);

Show the generated path.

show(pathSegObj{1})

Create a ReedsSheppConnection object.

reedsConnObj = robotics.ReedsSheppConnection;

Define start and goal poses as [x y theta] vectors.

startPose = [0 0 0];
goalPose = [1 1 pi];

Calculate a valid path segment to connect the poses.

[pathSegObj,pathCosts] = connect(reedsConnObj,startPose,goalPose);

Show the generated path. Notice the direction of the turns.

show(pathSegObj{1})

pathSegObj{1}.MotionTypes
ans = 1×5 cell array
    {'L'}    {'R'}    {'L'}    {'N'}    {'N'}

pathSegObj{1}.MotionDirections
ans = 1×5

     1    -1     1     1     1

Disable this specific motion sequence in a new connection object. Reduce the MinTurningRadius if the robot is more manueverable. Increase the reverse cost to reduce the likelihood of reverse directions being used. Connect the poses again to get a different path.

reedsConnObj = robotics.ReedsSheppConnection('DisabledPathTypes',{'LpRnLp'});
reedsConnObj.MinTurningRadius = 0.5;
reedsConnObj.ReverseCost = 5;

[pathSegObj,pathCosts] = connect(reedsConnObj,startPose,goalPose);
pathSegObj{1}.MotionTypes
ans = 1×5 cell array
    {'L'}    {'S'}    {'L'}    {'N'}    {'N'}

show(pathSegObj{1})
xlim([0 1.5])
ylim([0 1.5])

Create a DubinsConnection object.

dubConnObj = robotics.DubinsConnection;

Define start and goal poses as [x y theta] vectors.

startPose = [0 0 0];
goalPose = [1 1 pi];

Calculate a valid path segment to connect the poses.

[pathSegObj,pathCosts] = connect(dubConnObj,startPose,goalPose);

Show the generated path.

show(pathSegObj{1})

Interpolate poses along the path. Get a pose every 0.2 meters, including the transitions between turns.

length = pathSegObj{1}.Length;
poses = interpolate(pathSegObj{1},[0:0.2:length])
poses = 32×3

         0         0         0
    0.1987   -0.0199    6.0832
    0.3894   -0.0789    5.8832
    0.5646   -0.1747    5.6832
    0.7174   -0.3033    5.4832
    0.8309   -0.4436    5.3024
    0.8418   -0.4595    5.3216
    0.9718   -0.6110    5.5216
    1.1293   -0.7337    5.7216
    1.3081   -0.8226    5.9216
      ⋮

Use the quiver function to plot these poses.

quiver(poses(:,1),poses(:,2),cos(poses(:,3)),sin(poses(:,3)),0.5)

Input Arguments

collapse all

Path segment, specified as a robotics.DubinsPathSegment or robotics.ReedsSheppPathSegment object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Headings',{'transitions'}

Axes to plot path onto, specified as an Axes handle.

Heading angles to display, specified as a cell array of character vector or string scalars. Options are any combination of 'start','goal', and 'transitions'. To disable all heading displays, specify {''}.

Positions to display, specified as 'both', 'start', 'goal', or 'none'. The start position is marked with green, and the goal position is marked with red.

Introduced in R2018b