QUARC
Getting Started with QUARC
Upgrading QUARC
User's Guide
QUARC Basics
Using Windows Explorer to Manage Models
Command Line Tools
QUARC Console - Model Standard I/O
QUARC Monitor - the Tray Icon
Accessing Hardware
Communications
Using Devices
Multithreading
Multiprocessing
Partition Scheduling
Dynamic Reconfiguration
QUARC External Interfaces
Debugging a Model
Achieving Optimal Performance
Creating User Interfaces
QUARC Targets
Configuration Parameters
QUARC Communications Protocols
QUARC Data Acquisition Card Support
QUARC MATLAB Functions
QUARC Menu
QUARC Preferences Dialog
Quanser Error Codes
Blocks
Release Notes
License Information
Demos
Web Resources
-
QUARC Visualization Airplane
This is an advanced visualization example that combines many different effects. There are a number of examples of inheritance including the airplane, camera, skybox, and the various propellers. Dummy actors are used for the aerial ring propellers. There are numerous actors attached to the camera which use the emissive lighting property to make them independent of the surrounding light sources.
The "infinite" terrain is created by a 3x3 grid of repeating terrain sections. The Terrain Movement embedded Matlab block uses a modulus of the current airplane position to move sections of terrain that are behind the airplane to in front. Fog is used to hide this motion. Note that the skybox actor has the "Disable Fog" property checked so it is not affected by the fog.
Although you can freely fly around the environment using the arrow keys (driven by the Host Keyboard blocks), the Flight Controls embedded Matlab block is designed to limit the maximum and minimum altitude. Use the "R" key to start and restart the simulation. A triggered subsystem is used to keep the airplane speed at zero until the "R" key has been pushed the first time. This allows the visualization time to load while the model may already be running.
In order to make things easier to understand conceptually, the sections of terrain are moved for the ever-increasing airplane position rather than leaving the terrain fixed and using a modulus of the airplane position as in the Visualization Homogeneous Transformation demo. The consequence of this though is that if you fly far enough, you will start to see the user interface elements jittering due to numerical accuracy issues as demonstrated in the Visualization Numerical Accuracy demo. A better implementation of traveling over a large distance is to keep the airplane at the origin and move the world instead so it is not subject to the numerical accuracy limitations.
Demonstration
To start the model, click the Run button on the toolbar, select Run from the Simulation menu of the diagram, or press Ctrl+T while the diagram is the active window.The keyboard and mouse controls (other than the "R" key and arrow keys) have been disabled. If you wish to freely navigate around the scene independent of the airplane, you can re-enable keyboard and mouse controls either from the 3D viewer or the Visualization Initialize block.
If you would like to run the model in external mode, then select External from the Simulation/Mode menu of the diagram, or select External from the simulation mode combo box on the toolbar.
Then select Build from the QUARC menu of the diagram, or press Ctrl+B while the diagram is the active window. A great deal of output will appear in the Diagnostic Viewer about the progress of the build. If you cannot see the Diagnostic Viewer, you can open it by selecting View/Diagnostic Viewer from the menu of the diagram, or clicking on the View Diagnostics hyperlink at the bottom of the diagram. If you have MATLAB R2013b or earlier then the output will appear in the MATLAB Command Window.
When the build is complete, click on the Connect to Target button or select Connect to Target from the Simulation menu of the diagram to connect to the model. This will load the code on the target and automatically open the visualization window on the host.
Finally, start the model by clicking on the Run button or selecting Run from the Simulation menu of the diagram. The Start item of the QUARC menu may also be used to both connect and start the model in one operation.
Click on the Stop button or select Stop from the Simulation menu of the diagram to stop the model. The Stop item of the QUARC menu may also be used.
Running the example on a different target
To run the example on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.
QUARC
最新推荐文章于 2024-04-15 07:00:00 发布