setCoveragePattern
Description
setCoveragePattern(
sets the angle at which the UAV sweeps the polygon with the index space
,index
,SweepAngle=angle
)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
Plan Coverage Path Using Geodetic Coordinates
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
space
— Coverage space
uavCoverageSpace
object
Coverage space, specified as a uavCoverageSpace
object. space
must contain at least one polygon.
index
— Polygon index
integer in range [1, N]
Polygon index, specified as an integer in the range [1, N].
N is the total number of polygons in
space
.
Data Types: single
| double
angle
— Desired sweep angle for polygon
numeric scalar in range [-180, 180]
Desired sweep angle for the polygon, specified as a numeric scalar in range [-180, 180], in degrees.
Data Types: single
| double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Generating code containing the setCoveragePattern
requires you to enable dynamic memory allocation. For more information about enabling dynamic memory allocation, see Set Dynamic Memory Allocation Threshold (MATLAB Coder).
Deploying to embedded real time (ERT) targets is not supported.
Version History
Introduced in R2023aR2023b: Code generation support with dynamic memory allocation
setCoveragePattern
now supports code generation with dynamic memory allocation enabled. For more information about enabling dynamic memory allocation, see Set Dynamic Memory Allocation Threshold (MATLAB Coder).
Deploying to embedded real time (ERT) targets is not supported.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)