Main Content

show

Visualize 2D coverage space

Since R2023a

    Description

    ax = show(space) visualizes the polygons in coverage space space with numbering corresponding to the order that the polygons were specified at the time of creation of space. You can also use the show function for showing coverage space polygons that were decomposed with the coverageDecomposition function.

    example

    ax = show(space,Name=Value) specifies additional options using one or more name-value arguments.

    Examples

    collapse all

    This example shows how to plan a coverage path that surveys the parking lots of the MathWorks Lakeside campus.

    Get the geodetic coordinates for the MathWorks Lakeside campus. Then create the limits for our map.

    mwLS = [42.3013 -71.375 0];
    latlim = [mwLS(1)-0.003 mwLS(1)+0.003];
    lonlim = [mwLS(2)-0.003 mwLS(2)+0.003];

    Create a figure containing the map with the longitude and latitude limits.

    fig = figure;
    g = geoaxes(fig,Basemap="satellite");
    geolimits(latlim,lonlim)

    Get the outline of the first parking lot in longitude and latitude coordinates. Then create the polygon by concatenating them.

    pl1lat = [42.3028 42.30325 42.3027 42.3017 42.3019]';
    pl1lon = [-71.37527 -71.37442 -71.3736 -71.37378 -71.375234]';
    pl1Poly = [pl1lat pl1lon];

    Repeat the process for the second parking lot.

    pl2lat = [42.30035 42.2999 42.2996 42.2999]';
    pl2lon = [-71.3762 -71.3734 -71.37376 -71.37589]';
    pl2poly = [pl2lat pl2lon];

    Create the coverage space with both of those polygons, set the coverage space to use geodetic coordinates, and set the reference location to the MathWorks Lakeside campus location.

    cs = uavCoverageSpace(Polygons={pl1Poly,pl2poly},UseLocalCoordinates=false,ReferenceLocation=mwLS);

    Set the height at which to fly the UAV to 25 meters, and the sensor footprint width to 20 meters. Then show the coverage space on the map.

    ReferenceHeight = 25;
    cs.UnitWidth = 20;
    show(cs,Parent=g);

    Set the sweep angle for polygons 1 and 2 to 85 and 5 degrees, respectively, to have paths that are parallel to the roads in the parking lots. Then create the coverage planner for that coverage space with the exhaustive solver algorithm.

    setCoveragePattern(cs,1,SweepAngle=85)
    setCoveragePattern(cs,2,SweepAngle=5)
    cp = uavCoveragePlanner(cs,Solver="Exhaustive");

    Set the takeoff position to a location in the courtyard, then plan the coverage path.

    takeoff = [42.30089 -71.3752, 0];
    [wp,soln] = plan(cp,takeoff);
    hold on
    geoplot(wp(:,1),wp(:,2),LineWidth=1.5);
    geoplot(takeoff(1),takeoff(2),MarkerSize=25,Marker=".")
    legend("","","Path","Takeoff/Landing")
    hold off

    Input Arguments

    collapse all

    Coverage space, specified as an uavCoverageSpace object.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: show(cs,FontSize=5)

    Parent axes for plotting, specified as either an Axes object or a GeographicAxes object.

    If the value of the UseLocalCoordinates property of space is true, then the parent axes must be a Axes object. If the value is false, then the parent axes must be a GeographicAxes object.

    Font size of polygon numbering, specified as a positive numeric scalar. Units are in points, where 1 point = 1/72 of an inch.

    Width of polygon outlines, specified as a positive numeric scalar. Units are in points, where 1 point = 1/72 of an inch.

    Output Arguments

    collapse all

    Axes handle, returned as an Axes object or a GeographicAxes object.

    Version History

    Introduced in R2023a