Main Content

UAV Scenario Designer

Design UAV scenarios with terrain, platforms, and sensors

Since R2022a

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

UAV Scenario Designer app preview showing the property panel, scenario canvas, and scenario view

Open the UAV Scenario Designer App

  • MATLAB® Toolstrip: On the Apps tab, under Robotics And Autonomous Systems, click UAV Scenario Designer UAV Scenario Designer app icon.

  • MATLAB command prompt: Enter uavScenarioDesigner.

Examples

expand all

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.

image_1.png

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.

image_2.png

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.

image_3.png

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.

image_4.png

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.

image_1.png

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.

image_2.png

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.

image_3.png

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.

image_4.png

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.

image_5.png

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.image_7.png

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.

image_8.png

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.

image_10.png

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:

  1. Click Import Scenario to import a scenario from the MATLAB® workspace.

  2. Select scene and 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.

  3. Click the Trajectory tab, and select the custom platform from the Scene Browser pane.

  4. Click Trajectory Table to open the Trajectory Table pane. You cannot edit the data in this table. For more information, see Limitations.

  5. 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.

  6. You can only rename the platform and change the start time in the Property Panel pane. All other properties are read-only.

image_1.png

Simulate Scenario

To simulate the scenario:

  1. Select the UAV Scenario tab.

  2. In the Simulate section of the app toolstrip, click Simulate to open the Simulate tab.

  3. 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

expand all

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.

ParameterSelection
Trajectory Course

  • Auto: When selected, the app generates the course by fitting all the waypoints with a smooth curve.

  • Table: When selected, you can manually edit the trajectory course at each waypoint using the Trajectory Table.

Platform Orientation

  • Auto: When selected, the app calculates the yaw and pitch angles of the platform to align the platform with the trajectory and calculates the roll angle to cancel the centripetal acceleration.

  • Table: When selected, you can manually edit the yaw, pitch, and roll angles at each waypoint using the Trajectory Table.

Time

  • Auto: When selected, the app calculates the visiting time at all the waypoints.

  • Table: When selected, you can manually edit the visiting time at each waypoint using the Trajectory Table.

Ground speed

  • Auto: When selected, the app uses the default ground speed for each platform class at each waypoint.

  • Table: When selected, you can manually edit the ground speed at each waypoint using the Trajectory Table.

Note

UAV Scenario Designer does not support negative ground speeds.

Climb Rate

  • Auto: When selected, the app calculates the climb rate at each waypoint to smoothly fit all the waypoints.

  • Table: When selected, you can manually edit the climb rate at each waypoint using the Trajectory Table.

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.

ParameterDescription
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 object markers button Hide Scene Object Markers in the UAV Scenario View pane to hide the object markers.

Click Zoom to selection button 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

ParameterDescription
NameName of the platform.
ColorColor of the platform and platform trajectory.
Reference FrameReference frame of the platform, specified as NED (north-east-down) or ENU (east-north-up).
Start TimeStart time of the platform, in seconds.
Elevation ControlSelect 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

ParameterDescription
ScaleScale of the platform mesh. Default is 1. If the platform is a cuboid platform, this parameter is read-only.
LengthLength of the mesh, in meters. For quadrotor, fixed-wing, and custom platforms, this property is read-only and affected by the Scale parameter.
WidthWidth of the mesh, in meters. For quadrotor, fixed-wing, and custom platforms, this property is read-only and affected by the Scale parameter.
HeightHeight 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

ParameterDescription
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.

  • ENUX (East), Y (North), Z (Up)

  • NEDX (North), Y (East), Z (Down)

Orientation

Specify the Yaw, Pitch, Roll orientation from the world frame to the body frame in Z-Y-X order in degrees.

  • ENUYaw (East), Pitch (North), Roll (Up)

  • NEDYaw (North), Pitch (East), Roll (Down)

To edit the mesh offset of the scene object, use the Mesh Offset parameters.

Mesh Offset

ParameterDescription
Position OffsetMesh position offset, in meters, from the platform frame in the X, Y, and Z directions.
Orientation OffsetMesh 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

ParameterDescription
AccelerationAcceleration of the platform, in meters, per second squared.
VelocityVelocity of the platform, in meters, per second.
Angular VelocityAngular 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

ParameterDescription
NameName of the scene object.
ColorColor of the scene object.
Elevation ControlSelect Snap To Ground Elevation to set the elevation of the scene object to ground level.
Use Local CoordinatesSelect 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

ParameterDescription
Radius (Cylinder only)Radius of the cylinder, in meters.
HeightHeight 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

ParameterDescription
NameName of the sensor.
Update RateUpdate rate of the sensor, in hertz

Mounting Properties

ParameterDescription
PositionMounting position of the sensor with respect to the platform body origin.
OrientationMounting orientation of the sensor with respect to the platform body orientation.

To edit the GPS Parameters, select a GPS sensor.

GPS Parameters

ParameterDescription
Reference LocationReference location of the sensor, specified in geodetic coordinates with latitude and longitude in degrees and altitude in meters.
Position Input FormatPosition input format of the sensor, specified in local Cartesian or geodetic coordinates.
Reference FrameReference frame of the sensor, specified as NED (north-east-down) or ENU (east-north-up).
Horizontal Position AccuracyHorizontal position accuracy of the sensor, specified in meters.
Vertical Position AccuracyVertical position accuracy of the sensor, specified in meters.
Velocity AccuracyVelocity accuracy of the sensor, specified in meters per second.
Decay FactorDecay factor of the sensor, specified as a number in the range [0, 1].
Random StreamRandom stream, specified as Global stream or mt19937ar with seed.
SeedSpecify seed random stream.

To edit the INS Parameters, select an INS sensor.

INS Parameters

ParameterDescription
Position AccuracyPosition accuracy of the INS sensor, specified as X, Y, and Z, in meters.
Orientation AccuracyOrientation accuracy of the INS sensor, specified as Roll, Pitch, and Yaw, in degrees.
Position Error FactorPosition error factor of the INS sensor, specified in meters.
Velocity AccuracyVelocity accuracy of the INS sensor, specified in meters per second.
Acceleration AccuracyAcceleration accuracy of the INS sensor, specified in meters per second squared.
Angular Velocity AccuracyAngular velocity accuracy of the INS sensor, specified in degrees.
Fix GNSSSelect to lock the GNSS readings of the INS sensor.

To edit the Lidar Parameters, select a lidar sensor.

Lidar Parameters

ParameterDescription
Max RangeMaximum range of the lidar sensor, in meters.
Range AccuracyRange accuracy of the lidar sensor, in meters.
Azimuth ResolutionAzimuth resolution of the lidar sensor, in degrees.
Elevation ResolutionElevation resolution of the lidar sensor, in degrees.
Add NoiseSelect to add noise to the lidar sensor output.
Organize OutputSelect to output an organized point cloud.
Elevation LimitsElevation scanning limits of the lidar sensor, in degrees.
Azimuth LimitsAzimuth 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

ParameterDescription
NameName of the terrain file. This parameter is read-only.
Import TerrainSelect to import the terrain, once you have set all the parameters.
Use Local CoordinatesSelect 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

ParameterDescription
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

ParameterDescription
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

expand all

uavScenarioDesigner opens the UAV Scenario Designer app.

Limitations

  • UAV Scenario Designer may run slowly if MATLAB is using a software implementation of OpenGL®. To solve the problem, upgrade your graphics hardware driver or use opengl to switch to a hardware-accelerated implementation of OpenGL. See Resolving Low-Level Graphics Issues for more information.

  • 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

expand all

Tips

  • If you hit the maximum frame limit set, click Parameters Parameters icon 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