Main Content

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

  1. Create or log into your Cesium Ion account at https://ion.cesium.com/.

  2. On the Cesium Ion page, click Access Tokens.

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

  4. Click Create.

To create a model to visualize a simulation using Cesium Ion, see Create a Model for Visualization.

Create a Model for Visualization

  1. Create a Simulink model and add these blocks:

    • Simulation 3D UAV Vehicle block

    • Simulation 3D Scene Configuration block

    • Two Constant blocks

  2. Open the Simulation 3D UAV Vehicle block and set Color to Orange.

  3. Connect one Constant block to the Translation input port of the Simulation 3D UAV Vehicle block. Set Constant value to [0 0 0].

  4. Connect the second Constant block to the Rotation input port of the Simulation 3D UAV Vehicle block. Set Constant value to [0 0 0].

    Model containing blocks and connections as described in the procedure.

  5. Set the model Stop time to inf.

Configure the Geospatial Configuration Parameters and Run the Simulation

  1. In the model created from Create a Model for Visualization, open the Simulation 3D Scene Configuration block:

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

      Manage access tokens dialog box.

      The Create new token dialog box appears.

    2. 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 IonPaste To Authentication Manager > Create new token Dialog Box
      NameToken ID
      TokenToken value

      For example, for token ID MyNewUserToken, enter these values.

      Create new token dialog box with MyNewUserToken token ID.

    3. To store the token ID and value, click OK.

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

      Access token ID filled with MyNewUserToken

    5. In the rest of the Geospatial tab, set these values.

      ParameterValue
      Origin height50
      Origin latitude40.707088
      Origin longitude-74.012146
      Map styleAerial
      Additional asset IDs[96188]
      Use advanced Sun SkySelected
      Solar time11
      Time zone-5
      Day21
      Month9
      Year2022
      Use daylight saving timeSelected
      DST start day10
      DST start month3
      DST end day3
      DST end month11
      DST switch hour2

  2. Run the simulation.

    The simulation streams the aircraft with the 3D map and terrain data in an Unreal Engine executable window.

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

    Visualization of aircraft in Unreal Engine executable window with Cesium at preset view 4.

See Also

|

Related Topics