Visualize with Cesium
UAV Toolbox can now stream 3D map and terrain data of a location using Cesium Ion®. UAV Toolbox uses Unreal Engine® to build an executable window that visualizes your simulation and uses Cesium® to create a scene for that visualization at runtime. To customize scenes, download the Cesium for Unreal® plugin and use the UAV Toolbox Interface for Unreal Engine Projects. For information on installing Cesium for Unreal, see Install Cesium for Unreal Plugin. For more information on customizing scenes, see Customize Unreal Engine Scenes for UAVs.
Simulating models in the 3D visualization environment requires Simulink® 3D Animation™.
Note
To visualize with Cesium, you must start MATLAB® as administrator.
The folder installed with your product must be writeable.
matlabroot\toolbox\shared\sim3d_projects\automotive_project_windows\ UE\WindowsNoEditor\Engine
This example has you create a Cesium Ion, then create a model and configure it for simulation.
Set Up a Cesium Ion Account
Create or log into your Cesium Ion account at https://ion.cesium.com/.
On the Cesium Ion page, click Access Tokens.
On the Access Tokens page, click Create token to create a new access token. Enter a unique name and note it. Leave the other settings at their default values.
You use this access token ID in the Access token ID parameter of the Simulation 3D Scene Configuration block. For more information on creating access tokens, see https://cesium.com/learn/ion/cesium-ion-access-tokens/.
Click Create.
To create a model to visualize a simulation using Cesium Ion, see Create a Model for Visualization.
Create a Model for Visualization
Create a Simulink model and add these blocks:
Simulation 3D UAV Vehicle block
Simulation 3D Scene Configuration block
Two Constant blocks
Open the Simulation 3D UAV Vehicle block and set Color to
Orange
.Connect one Constant block to the Translation input port of the Simulation 3D UAV Vehicle block. Set Constant value to
[0 0 0]
.Connect the second Constant block to the Rotation input port of the Simulation 3D UAV Vehicle block. Set Constant value to
[0 0 0]
.Set the model Stop time to
inf
.
Configure the Geospatial Configuration Parameters and Run the Simulation
In the model created from Create a Model for Visualization, open the Simulation 3D Scene Configuration block:
In the Geospatial tab, select Enable geospatial configuration to enable the geospatial configuration parameters.
To configure this block for geospatial configuration, click the Authentication Manager button at the bottom of the pane. The Manage access tokens dialog box displays. Click Create token.
The Create new token dialog box appears.
In the Create new token dialog box, enter the unique token ID string and copy and paste the access token created from the Cesium Ion page.
Copy From Cesium Ion Paste To Authentication Manager > Create new token Dialog Box Name Token ID Token Token value For example, for token ID
MyNewUserToken
, enter these values.To store the token ID and value, click OK.
In the Access token ID parameter of the Geospatial tab, enter the same unique token ID string you specified in the Token ID parameter of the Authentication Manager > Create new token dialog box.
In the rest of the Geospatial tab, set these values.
Parameter Value Origin height 50
Origin latitude 40.707088
Origin longitude -74.012146
Map style Aerial
Additional asset IDs [96188]
Use advanced Sun Sky Selected Solar time 11
Time zone -5
Day 21
Month 9
Year 2022
Use daylight saving time Selected DST start day 10
DST start month 3
DST end day 3
DST end month 11
DST switch hour 2
Run the simulation.
The simulation streams the aircraft with the 3D map and terrain data in an Unreal Engine executable window.
To view the aircraft from a preset view, left-click in the executable window and select a number from 1 to 9.
This view is from preset view 3.
See Also
Simulation 3D UAV Vehicle | Simulation 3D Scene Configuration