Main Content

setCoveragePattern

Set sweep angle for polygon in coverage area

Since R2023a

    Description

    example

    setCoveragePattern(space,index,SweepAngle=angle) sets the angle at which the UAV sweeps the polygon with the index index in coverage space space to angle angle.

    Use the show function to visualize the polygons in the coverage space to identify which polygon index to use.

    Note

    space must contain at least one polygon.

    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 a uavCoverageSpace object. space must contain at least one polygon.

    Polygon index, specified as an integer in the range [1, N]. N is the total number of polygons in space.

    Data Types: single | double

    Desired sweep angle for the polygon, specified as a numeric scalar in range [-180, 180], in degrees.

    Data Types: single | double

    Extended Capabilities

    Version History

    Introduced in R2023a

    expand all