Simulating Aircraft in Unreal Engine-based 3D Environment - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 4:47
Loaded: 3.44%
Stream Type LIVE
Remaining Time 4:47
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 4:47

    Simulating Aircraft in Unreal Engine-based 3D Environment

    Aerospace Blockset provides a couple of methods to visualize aircraft simulations. Starting from R2021b, you can use Aircraft Scenario blocks to simulate aircraft models in a 3D environment powered by Unreal Engine®. You can modify the "asbSkyHogg" model from the Lightweight Airplane Design example to co-simulate an aircraft with a prebuilt scene shipped with Aerospace Blockset. In addition to the prebuilt scenes, you can create or customize scenes using the Aerospace Blockset Interface for Unreal Engine projects.

    Published: 16 Feb 2022

    Let's say you have implemented a model for an aircraft using Simulink and you want to visualize the simulated flight data. Aerospace Blockset provides a couple of methods to achieve this. You can use MATLAB based animation blocks or use FlightGear blocks to interface with FlightGear flight simulator. Starting from release 2021b, you can also use Aircraft Scenario blocks to simulate aircraft models in a 3D environment powered by Unreal Engine.

    Let's implement this scenario simulation to visualize an example aircraft flight simulation. We'll start with the asbSkyHogg Simulink model that comes shipped with the Aerospace Blockset. We'll replace the FlightGear based visualization interface implemented in the model with Unreal Engine based scenario simulation. Navigate to the visualization subsystem and remove the Mux block and blocks related to flight gear interface. Then open Library Browser, navigate to Aerospace Blockset, Animation, Simulation 3D, and drag the aircraft and scene configuration blocks into the model.

    Simulation 3D aircraft block takes as inputs the translation and rotation of various components of the aircraft. It outputs values from the altitude sensor as a 1 by 4 matrix. It also provides a Boolean output, weight on wheels, which is true when one of the wheels is on the ground and false otherwise. Since the aircraft is in cruise throughout the simulation, we'll terminate this output.

    Let's configure the parameters of this block. You can add two types of aircraft to the scene, SkyHogg and Airliner. The type parameter not only determines the visualization, but also the input that the block accepts. Translation and rotation specifications required by the block depending upon the type is shown on the screen. We'll set the type to SkyHogg here. You can also set the color of the aircraft and name the aircraft which we will keep as the default here.

    Specify the initial rotation and translation in the Initial Values tab. As mentioned, this value must be specified considering the type of the aircraft. Translation and rotation specifications are with respect to NED frame, and rotation must be specified as roll-pitch-yaw Euler angles. Here we'll specify the initial z translation of the aircraft to negative 2000 and let all other values be zero. Toggle and configure the altitude sensor using the Altitude Sensor tab. These values will be default for now.

    Now let's configure the Scene Configuration block. We'll use the only default scene, the airport scene here. We'll view the scene from the aircraft SimulinkVehicle1 For smooth simulation, specify a sample time of one over 60. You can override and configure weather parameters in the Weather tab. We'll change the sun altitude to 25 degrees and increase the cloud opacity to 20% for the scene.

    Now we'll connect the output of the model to the input of the aircraft block, which requires an 11 by 3 matrix for translation and rotation for SkyHogg type. Open the BusSelector block and select signals Xe and body angles as output from the model. We'll use two subsystems-- one for each input to transform the signal. The subsystems reshape the input signal and concatenate it with the 0's matrix to get appropriately sized output. The scenario simulation is now ready, so let's simulate the model to see the aircraft flying in the scene.

    While the scenario simulation runs, you can use the numeric keys 0 through 9 to view the scene from different viewpoints. During the scene simulation, we'll notice that the propeller is not rotating. Also, the altitude sensor is returning a value of negative 1 throughout the simulation. Let's fix these. The model does not return propeller rotation, so for visualization purposes, we'll rotate the propeller at a constant rate of 1,500 RPM using a ramp block.

    For the altitude sensor, let's reconfigure the sensor parameters. The "length of rays" parameter limits the maximum altitude that can be detected by the sensor. The sensor returns a value of negative 1 for values greater than this parameter. We'll change this to 2,500. Let's also enable the rays to be visible during scene simulation. Now let's simulate the model again. We see the propeller now rotates and the sensor light rays are visible during the scene simulation. Also, the altitude sensor is now returning correct values.

    All these steps have been completed for you in the example using Simulation 3D Visualization with Aerospace Blockset. The aircraft scenario simulation comes by default with the airport scene. However, you are not restricted to use this default scene, and if you want to create or customize scenes, you can do so by installing the Aerospace Blockset interface for Unreal Engine Projects support package. For more information on aircraft scenario simulation workflow, refer to the links below.

    View more related videos