UAV Scenario Designer
Description
The UAV Scenario Designer app enables you to interactively create a UAV scenario with terrain, platforms, and sensors and simulate trajectories for a UAV platform. Using the app, you can:
Import, export, and create a UAV scenario
Import terrain from Digital Terrain Elevation Data (DTED) files
Add and edit scene objects, platforms, and sensors
Add custom platforms and scene objects from STL files.
Create and edit platform trajectories
Simulate a UAV scenario

Open the UAV Scenario Designer App
MATLAB® Toolstrip: On the Apps tab, under Robotics And Autonomous Systems, click UAV Scenario Designer
.MATLAB command prompt: Enter
uavScenarioDesigner.
Examples
Open the App
Open the UAV Scenario Designer app by selecting the app in the Apps tab, under Robotics and Autonomous Systems or by running uavScenarioDesigner in the command window.
Add Scene Objects
Define a polygon with three vertices. For more information about defining polygon scene objects, see Create Polygon Scene Objects.
poly = [0 0; 1 1; 2 0];
In the UAV Scenario Designer app toolstrip, in the Scene Object section, select Polygon.

In the Import Polygon dialog box, select poly and click Import. Click anywhere on the UAV Scenario Canvas to place the polygon.
In the Property Panel pane, adjust the Position values of the polygon to for X, Y, and Z to 0, and change Height to 5. To change the elevation of the polygon so that the bottom face makes contact with the ground, click Snap To Ground Elevation.

Add Platform
On the app toolstrip, in the Platform section, select Quadrotor and click anywhere in the UAV Scenario Canvas to place the quadrotor. In the Property Panel pane, set the X position of the quadrotor to 5 and the Y and Z positions of the quadrotor to -5. Note that the reference frame of the platform is north-east-down (NED) by default. Click Zoom to Scenario to zoom in to the polygon and platform.

Add Sensor
With the quadrotor platform selected, on the app toolstrip, in the Sensors section, select Lidar, and click anywhere on the Sensor Canvas to add a lidar sensor. In the Property Panel pane, change the X position of the mounting point of the lidar sensor to 0 and the Y and Z positions to 0.125 and 0, respectively, in the local reference frame of the platform.

Import UAV Scenario and Terrain File
Create a UAV scenario and add building meshes from an OSM file containing building meshes for Manhattan [1].
scene = uavScenario(ReferenceLocation=[40.707088 -74.012146 0]); addMesh(scene,"terrain",{"gmted2010",[-200 200],[-200 200]},[0.6 0.6 0.6]); addMesh(scene,"buildings",{"manhattan.osm",[-200 200],[-200 200],"auto"},[0 1 0]);
Open the UAV Scenario Designer app and click Import Scenario to import a scenario from the MATLAB® workspace. To make the each building more distinguishable, generate new colors for each of the building meshes by clearing Preserve scenario colors at import. Select scene and click Import.

The imported building meshes appear. Turn off the building markers in the UAV Scenario Canvas and UAV Scenario View pane by selecting Hide Scene Object Markers in each pane.

Note that to move buildings, you can drag the scene object marker of the building in the UAV Scenario Canvas pane. You can also zoom in to and delete a scene object from the Scene Browser pane by clicking and right-clicking on the object respectively.
Add Platform and Sensor
In the Platform section, select Fixed Wing, and then click anywhere in the UAV Scenario Canvas to add a fixed-wing UAV platform to the scenario. With the platform selected, in the Property Panel pane, set the X value of the Position parameter to -256 and the Y and Z values to -137 and -125, respectively. Note that the Reference Frame parameter of the platform is set to NED.

To add a lidar sensor to the platform, in the Sensors section, select Lidar and click anywhere in the Sensor Canvas. Specify the mounting position of the sensor on the platform by, in the Property Panel pane, setting the X value of the Position parameter to 0.25 and the Y and Z values to 0. All values are in the local coordinate frame of the platform mesh.

Create Trajectory
Select the Trajectory tab and, with the platform selected, select Add Waypoints. To create a trajectory for the platform, click in the UAV Scenario Canvas. To zoom in or out while adding points to the trajectory, scroll with the scroll wheel as needed. Add three points to the trajectory, and end trajectory creation by pressing Esc, Enter, or double-clicking in the UAV Scenario Canvas.

Click Time-Altitude Plot to open the time-altitude plot in the UAV Scenario Canvas. In the time-altitude plot, drag the first waypoint vertically to an altitude of 126 meters in the time-altitude plot. Note that you cannot move the waypoint left or right along the Time axis. To change the time value for waypoints, on the app toolstrip, in the Path and Orientation section, set Time to Manual. Then, drag the second waypoint to approximately 125 meters in altitude at 20 seconds. For more information about the other trajectory settings in the Path and Orientation section, see Trajectory.

Note, in the UAV Scenario View pane, that the platform may be too close to one of the buildings at the second waypoint. Adjust this waypoint by dragging it on the UAV Scenario Canvas, or by editing the position of the waypoint in the Trajectory Table. Select Trajectory Table to open the Trajectory Table pane, and click on the second waypoint. The table highlights the data of the selected waypoint in blue. Set the X and Y elements to 65 and 0, respectively. You can edit the data of any waypoint in this table as long as the corresponding Path and Orientation parameters are set to Manual.
Note that you can also delete or insert waypoints by right-clicking a waypoint or a trajectory between waypoints in the UAV Scenario Canvas and clicking Delete Waypoint or Insert Waypoint respectively in the right-click dialog boxes.
Simulate Scenario
In the Scene Browser pane, select the platform. Then select UAV Scenario tab and set Update Rate to 50 Hz. In the Simulate section, select Parameters and set Number of Frames to 30.
Click Simulate to open the Simulate tab.

Run the simulation and click Zoom to Selection to center the camera over the platform as it follows the trajectory.

After the platform completes the trajectory, click Close Simulate to return to the UAV Scenario tab.
Export UAV Scenario
Export the scenario or session to share the scenario or to later modify the scenario in UAV Scenario Designer. Click Export Scenario to open the Export Scenario to Workspace dialog box. Name the scenario and click Export to export the scenario to the MATLAB workspace as a uavScenario object.

To save the session as a MAT file, in the File section, select Save Session.
References
[1] The file was downloaded from https://www.openstreetmap.org, which provides access to crowd-sourced map data all over the world. The data is licensed under the Open Data Commons Open Database License (ODbL), https://opendatacommons.org/licenses/odbl/
Create UAV Scenario
Create a UAV scenario and set its local origin.
scene = uavScenario(UpdateRate=100,StopTime=15,ReferenceLocation=[46 42 0]);
Add an inertial frame, MAP, to the scenario.
scene.addInertialFrame("ENU","MAP",trvec2tform([1 0 0]));
Use the minjerkpolytraj function to generate the piecewise polynomial for the specified waypoints of the trajectory.
waypoints = [0 50 100; 0 -50 0; 0 0 0]; timePoints = [0 3.8596 11.4451]; numSamples = 100; [~,~,~,~,pp,~,~] = minjerkpolytraj(waypoints,timePoints,numSamples);
Generate Trajectory from Piecewise Polynomial Using polynomialTrajectory
Use the polynomialTrajectory System object™ to generate a trajectory from the piecewise polynomial. Specify the sample rate of the trajectory. Set the AutoBank and AutoPitch properties to true.
traj = polynomialTrajectory(pp,SampleRate=100,AutoBank=true,AutoPitch=true);
Create a UAV platform with a specified polynomial trajectory in the scenario. Define the mesh for the UAV platform.
platform = uavPlatform("custom",scene,"Trajectory",traj); updateMesh(platform,"fixedwing",{20},[1 0 0],eul2tform([0 0 pi]))
Import UAV Scenario
Open the UAV Scenario Designer app by selecting the app in the Apps tab, under Robotics and Autonomous Systems or by running uavScenarioDesigner in the command window.
To import a UAV scenario into the UAV Scenario Designer app:
Click Import Scenario to import a scenario from the MATLAB® workspace.
Select
sceneand click Import. The app displays a pop-up window warning you about the limitations of using a platform with polynomial trajectories. For more information see Limitations. Click OK to close the pop-up window.Click the Trajectory tab, and select the
customplatform from the Scene Browser pane.Click Trajectory Table to open the Trajectory Table pane. You cannot edit the data in this table. For more information, see Limitations.
Click Time-Altitude Plot to open the time-altitude plot. You cannot adjust the waypoints in the time-altitude plot. For more information, see Limitations.
You can only rename the platform and change the start time in the Property Panel pane. All other properties are read-only.

Simulate Scenario
To simulate the scenario:
Select the UAV Scenario tab.
In the Simulate section of the app toolstrip, click Simulate to open the Simulate tab.
Run the simulation.
To save the session as a MAT file, in the File section, select Save Session.
Limitations
UAV Scenario Designer app support for the polynomialTrajectory System object is limited to importing the trajectory into a scene and simulating the trajectory. Editing and creation options are not available when using polynomialTrajectory.
Related Examples
Parameters
To add or edit a trajectory and control the trajectory generation, use the trajectory settings.
Click Waypoints to add waypoints to a trajectory of a selected platform.
Click Delete Trajectory to delete an existing trajectory.
Click Trajectory Table to display the trajectory table. See Trajectory Table for more information.
Click Time-Altitude plot to display the time vs altitude plot.
You can also choose to automatically generate the waypoint trajectory or manually input waypoints by changing the selections of the Path and Orientation parameters.
| Parameter | Selection |
|---|---|
| Trajectory Course |
|
| Platform Orientation |
|
| Time |
|
| Ground speed |
Note UAV Scenario Designer does not support negative ground speeds.
|
| Climb Rate |
|
Trajectory information for each waypoint, specified as a table of scalars. When you insert waypoints on the platform canvas, the table is automatically generated. Click Trajectory Table under the Trajectory tab to display the table.
Edit the parameters in the table to adjust or fine-tune the trajectory. After you change the parameter values in the table, the platform trajectory changes accordingly on the canvas. The table includes these trajectory parameters.
| Parameter | Description |
|---|---|
| Times | Time at which the platform visits the waypoint, specified as a scalar in seconds. |
| X | x coordinate of the waypoint in the scenario navigation frame. |
| Y | y coordinate of the waypoint in the scenario navigation frame. |
| Altitude | Altitude of the platform waypoint in the scenario navigation frame. |
| Course | The direction of motion on the x-y plane, specified as an angle measurement from the x direction. |
| Ground speed | Magnitude of the projected velocity on the x-y plane, specified as a nonnegative scalar in meters. |
| Climb Rate | Climb rate of the waypoint, which is the projection of the platform velocity in the z direction. |
| Roll | Orientation angle of the platform about the x-axis of the scenario frame, in degrees, specified as a scalar. |
| Pitch | Orientation angle of the platform about the y-axis of the scenario frame, in degrees, specified as a scalar. |
| Yaw | Orientation angle of the platform about the z-axis of the scenario frame, in degrees, specified as a scalar. |
Click Simulate in the UAV Scenario tab to open the Simulate tab.
Use the toolstrip buttons to control the simulation.
Click
Hide Scene Object Markers in the UAV Scenario
View pane to hide the object markers.
Click
Zoom to Selection in the UAV Scenario
View pane to zoom in on the selected object. Enable Zoom to Selection in
simulation mode to follow the selected object.
Use the Property Panel to edit the properties of a selected platform, such as geometry, body properties, mesh offset, and ego properties.
Platform
| Parameter | Description |
|---|---|
| Name | Name of the platform. |
| Color | Color of the platform and platform trajectory. |
| Reference Frame | Reference frame of the platform, specified as NED
(north-east-down) or ENU (east-north-up). |
| Start Time | Start time of the platform, in seconds. |
| Elevation Control | Select Snap To Ground Elevation to set the elevation of the platform to ground level. |
To edit the geometry of the platform, use the Geometry parameters.
Geometry
| Parameter | Description |
|---|---|
| Scale | Scale of the platform mesh. Default is 1. If the
platform is a cuboid platform, this parameter is read-only. |
| Length | Length of the mesh, in meters. For quadrotor, fixed-wing, and custom platforms, this property is read-only and affected by the Scale parameter. |
| Width | Width of the mesh, in meters. For quadrotor, fixed-wing, and custom platforms, this property is read-only and affected by the Scale parameter. |
| Height | Height of the mesh, in meters. For quadrotor, fixed-wing, and custom platforms, this property is read-only and affected by the Scale parameter. |
To edit the body properties of the scene object, use the Body Properties parameters.
Body Properties
| Parameter | Description |
|---|---|
| Position | Specify the X, Y, and Z positions of the platform in the global coordinate frame, in meters. The properties change depending on the selected reference frame.
|
| Orientation | Specify the Yaw, Pitch, Roll orientation from the world frame to the body frame in Z-Y-X order in degrees.
|
To edit the mesh offset of the scene object, use the Mesh Offset parameters.
Mesh Offset
| Parameter | Description |
|---|---|
| Position Offset | Mesh position offset, in meters, from the platform frame in the X, Y, and Z directions. |
| Orientation Offset | Mesh orientation offset, in degrees, from the platform frame in Roll, Pitch, and Yaw directions. |
To edit the ego properties of the scene object, use the Ego Properties parameters. The ego properties are initial conditions that move the mesh during simulation. If the platform has a trajectory, then these properties are read-only.
Ego Properties
| Parameter | Description |
|---|---|
| Acceleration | Acceleration of the platform, in meters, per second squared. |
| Velocity | Velocity of the platform, in meters, per second. |
| Angular Velocity | Angular velocity of the platform, in degrees, per second. |
Use the Property Panel to edit the scene object parameters and body properties of a selected object. Cylinders, polygons, and custom objects all share these object parameters:
Object Parameters
| Parameter | Description |
|---|---|
| Name | Name of the scene object. |
| Color | Color of the scene object. |
| Elevation Control | Select Snap To Ground Elevation to set the elevation of the scene object to ground level. |
| Use Local Coordinates | Select to use a local coordinate frame, specifying Position as X, Y, and Z. Clear this parameter to specify Position as Longitude, Latitude, and Altitude. |
Note
Scene objects coordinates are always defined in east-north-up (ENU).
The Body Properties contains the position of the scene object, Position. If you select Use Local Coordinates, these values are in Cartesian coordinates, in meters. Otherwise these values are the latitude and longitude of the object, in degrees, and the altitude in meters.
To edit the geometry of the scene object, use the Geometry parameters.
Geometry
| Parameter | Description |
|---|---|
| Radius (Cylinder only) | Radius of the cylinder, in meters. |
| Height | Height of the cylinder or polygon, in meters |
To view and edit sensor properties in the Property Panel,
select a sensor. UAV Scenario Designer supports these three sensors: GPS,
INS, and lidar. These MATLAB object equivalents for these sensors are equivalent to the gpsSensor,
insSensor, and
uavLidarPointCloudGenerator
MATLAB objects respectively.
Use the Sensor Parameters and Mounting Properties to edit sensor parameters and their mounting position on the platform mesh respectively. These properties are the same for all sensor objects.
Sensor Parameters
| Parameter | Description |
|---|---|
| Name | Name of the sensor. |
| Update Rate | Update rate of the sensor, in hertz |
Mounting Properties
| Parameter | Description |
|---|---|
| Position | Mounting position of the sensor with respect to the platform body origin. |
| Orientation | Mounting orientation of the sensor with respect to the platform body orientation. |
To edit the GPS Parameters, select a GPS sensor.
GPS Parameters
| Parameter | Description |
|---|---|
| Reference Location | Reference location of the sensor, specified in geodetic coordinates with latitude and longitude in degrees and altitude in meters. |
| Position Input Format | Position input format of the sensor, specified in local Cartesian or geodetic coordinates. |
| Reference Frame | Reference frame of the sensor, specified as NED
(north-east-down) or ENU (east-north-up). |
| Horizontal Position Accuracy | Horizontal position accuracy of the sensor, specified in meters. |
| Vertical Position Accuracy | Vertical position accuracy of the sensor, specified in meters. |
| Velocity Accuracy | Velocity accuracy of the sensor, specified in meters per second. |
| Decay Factor | Decay factor of the sensor, specified as a number in the range
[0, 1]. |
| Random Stream | Random stream, specified as Global stream or
mt19937ar with seed. |
| Seed | Specify seed random stream. |
To edit the INS Parameters, select an INS sensor.
INS Parameters
| Parameter | Description |
|---|---|
| Position Accuracy | Position accuracy of the INS sensor, specified as X, Y, and Z, in meters. |
| Orientation Accuracy | Orientation accuracy of the INS sensor, specified as Roll, Pitch, and Yaw, in degrees. |
| Position Error Factor | Position error factor of the INS sensor, specified in meters. |
| Velocity Accuracy | Velocity accuracy of the INS sensor, specified in meters per second. |
| Acceleration Accuracy | Acceleration accuracy of the INS sensor, specified in meters per second squared. |
| Angular Velocity Accuracy | Angular velocity accuracy of the INS sensor, specified in degrees. |
| Fix GNSS | Select to lock the GNSS readings of the INS sensor. |
To edit the Lidar Parameters, select a lidar sensor.
Lidar Parameters
| Parameter | Description |
|---|---|
| Max Range | Maximum range of the lidar sensor, in meters. |
| Range Accuracy | Range accuracy of the lidar sensor, in meters. |
| Azimuth Resolution | Azimuth resolution of the lidar sensor, in degrees. |
| Elevation Resolution | Elevation resolution of the lidar sensor, in degrees. |
| Add Noise | Select to add noise to the lidar sensor output. |
| Organize Output | Select to output an organized point cloud. |
| Elevation Limits | Elevation scanning limits of the lidar sensor, in degrees. |
| Azimuth Limits | Azimuth scanning limits of the lidar sensor, in degrees. |
Use the Property Panel to set the terrain import properties for the selected terrain after clicking Import Terrain.
Terrain Properties
| Parameter | Description |
|---|---|
| Name | Name of the terrain file. This parameter is read-only. |
| Import Terrain | Select to import the terrain, once you have set all the parameters. |
| Use Local Coordinates | Select to specify the terrain limits and bounds using local coordinates. To use geodetic coordinates for the terrain limits and bounds, clear this parameter. |
To edit the terrain limits, use the Terrain Limits parameters.
Terrain Limits
| Parameter | Description |
|---|---|
| X (m) and Y (m) | Minimum and maximum X- and Y-axis limits of the terrain. To enable this parameter, select Use Local Coordinates. |
| Latitude Limits (deg) and Longitude Limits (deg) | | Minimum and maximum latitude and longitude limits of the terrain. To enable this parameter, clear Use Local Coordinates. |
To edit the terrain bounds, use the Terrain Bounds parameters.
Terrain Bounds
| Parameter | Description |
|---|---|
| X (m) and Y (m) | Minimum and maximum X- and Y-axis limits of the terrain bounds. To enable this parameter, select Use Local Coordinates. |
| Latitude Limits (deg) and Longitude Limits (deg) | | Minimum and maximum latitude and longitude limits of the terrain bounds. To enable this parameter, clear Use Local Coordinates. |
Programmatic Use
uavScenarioDesigner opens the UAV Scenario Designer
app.
Limitations
UAV Scenario Designer app support for polynomialTrajectory
System object™ is limited to importing the trajectory into a scene and simulating the
trajectory. Edit and create options are not available when using
polynomialTrajectory.
More About
To import 3-D polygons into a scene in UAV Scenario
Designer, define a polygon in MATLAB as an N-by-2 matrix of vertices, where each row represents
the x- and y-position of each vertex. The rows should
be sequential either clockwise or counter-clockwise. When you import a polygon into the app,
the default height of the polygon is set to 10 meters. Select the polygon
to edit the height and center of position of the polygon by using the Property Panel (Scene Objects).
Example: polygon = [0 0; 1 1; 2 0]
Tips
If you hit the maximum frame limit set, click Parameters
in the Simulate tab section in the
toolstrip and increase the Number of Frames parameter in the
Set simulation parameters dialog box.
Version History
Introduced in R2022a
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)