The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathW orks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern
theuse,modification,reproduction,release,performance,display,anddisclosureoftheProgramand
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the
government’s needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Docu mentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
September 2006 Online onlyNew for Version 1.0 (Release 2006b)
March 2007Online onlyRevised for Version 1.1 (Release 2007a)
September 2007 First printingRevised for Version 2.0 (Release 2007b)
March 2008Online onlyRevised for Version 2.1 (Release 2008a)
October 2008Online onlyRevised for Version 2.2 (Release 2008b)
March 2009Online onlyRevised for Version 2.3 (Release 2009a)
September 2009 Online onlyRevised for Version 2.4 (Release 2009b)
March 2010Online onlyRevised for Version 2.5 (Release 2010a)
Exploring the Toolbox
Using the MATLAB Help System for Documentation and
Demos
........................................1-5
..................................1-4
...............................1-5
..............................1-5
Using Aerospace Toolbox
2
Defining Coordinate Systems .......................2-2
Fundamental Coordinate System Concepts
Coordinate System s for Modeling
Coordinate System s for Navigation
Coordinate System s for Display
References
Defining Aerospace Units
.......................................2-11
.......................... 2-12
....................2-4
...................... 2-10
...................2-7
............2-2
Importing Digital DATCOM Data
Overview
Example of a USAF Digital DATCOM File
Importing Data from DATCOM Files
Examining Imported DATCOM Data
Filling in Missing DATCOM Data
Plotting Aerodynamic Coefficients
The Aerospace Toolbox product extends the MATL AB®technical computing
environment by providing reference standards, environment models, and
aerodynamic coefficient importing for performing advanced aerospace analysis
to develop and evaluate your designs. The toolbox provides the following to
enable you to visualize flight data in a three-dimensional environment and
reconstruct behavioral anomalies in flight-test results:
• Aero.Animation, Aero.Body, Aero.Camera, and Aero.Geometry objects and
• An interface to the FlightGear flight simulator
• AninterfacetotheSimulink
To ensure design consistency, the Aerospace Toolbox software provides
utilities for unit conversions, coordinate transformations, and quaternion
math, as well as standards-based environmental models for the atmosphere,
gravity, and magnetic fields. You can import aerodynamic coefficients directly
from the U.S. Air Force Digital Data Compendium (DATCOM) to carry out
preliminary control design and vehicle performance analysis.
associated methods
®
3D Animation™ software
1-2
The toolbox provides you with the following main features:
• Provides standards-based environmen ta l models for atmosphere, gravity,
and magnetic fields.
• Converts units and transforms coordinate systems and spatial
representations.
• Implements predefined utilities for aerospace parameter calcu lat io ns, tim e
calculations, and quaternion math.
• Imports aerodynamic coefficients directly from DATCOM.
• Interfaces to the FlightGear flight simulator, enabling visualization of
vehicle dynamics in a three-dimensional environment.
Product Overview
The Aerospace Toolbox functions can be used in applications such as aircraft
technology, telemetry data reduction, flig ht control analysis, navigation
analysis, visualization for flight simulation, and environmental modeling, and
can help you perform the following tasks:
• Analyze, initialize, and visualize a broad range of large aerospace system
architectures, including aircraft, missiles, spacecraft (probes, satellites,
manned and unmanned), and propulsion systems (engines and rockets),
while reducing development time.
• Support and define new requirem ents for a ero space systems.
• Perform complex calculations and analyze data to optimize and implement
your designs.
• Test the performance of flight tests.
The Aerospace Toolbox software main tains and updates the algorithms,
tables, and standard environmental models, eliminating the need to provide
internal maintenance and verification of the models and reducing the cost of
internal software maintenance.
1-3
1 Getting Started
Related Products
The Aerospace Toolbox software requires the MATLAB software.
In addition to Aerospace Toolbox, the Aerospace product family includes
the Aerospace Blockset product. The toolbox provides s tatic data analysis
capabilities, while blockset provides an environment for dynamic modeling
and vehicle component modeling and simulation. The Aerospace Blockset™
software uses part of the functionality of the toolbox as an engine. Use these
products together to model aerospace systems in the MATLAB and Simulink
environments.
Other related products are listed in the Aerospace Toolbox product page at
the MathWorks Web site. They include toolboxes and blocksets that extend
the capabilities of the MATLAB and Simulink products. These products will
enhance your use of the toolbox in various applications.
For more information about any MathWorks™ software products, see either
®
1-4
• The online documentation for that product if it is installed
• The MathWorks Web site at
www.mathworks.com
Getting Online Help
In this section...
“Exploring the Toolbox” on page 1-5
“Using the MATLAB Help System for Documentation and Demos” on page
1-5
Exploring the Toolbox
A list of the toolbox functions is available to you by typing
help aero
You can view the code for any function by typing
type function_name
Getting Online Help
Using the MATLAB Help System for Documentation
and Demos
TheMATLABHelpbrowserallowsyoutoaccessthedocumentationanddemo
models for all the MATLAB and Simulink based products that you have
installed. The online Help includes an online search system.
Consult the Help for Using MATLAB section of the MATLAB Desktop Tools
and Development Environment documentation for more information about
the MATLAB Help system.
1-5
1 Getting Started
1-6
Using Aerospace Toolbox
• “Defining Coordinate Systems” on page 2-2
• “Defining Aerospace Units” on page 2-12
• “Importing Digital D ATC OM Data” on page 2-14
• “3-D Flight Data Playback” on page 2-26
2
2 Using Aerospace Toolbox
Defining Coordinate Systems
In this section...
“Fundamental Coordinate System Concepts” on page 2-2
“Coordinate Systems for Modeling” on page 2-4
“Coordinate Systems for Navigation” on page 2-7
“Coordinate Systems forDisplay”onpage2-10
“References” on page 2-11
Fundamental Coordinate System Concepts
Coordinate systems a llow you to keep track of an aircraft or spacecraft’s
position and orientation in space. The Aerospace Toolbox coordinate sy stems
are based on these underlying concepts from geodesy, astronomy, and physics.
Definitions
The Aerospace Toolbox software uses right-handed (RH) Cartesian coordinate
systems. The right-hand rule establishes the
axes.
x-y-z sequence of coordinate
2-2
An inertial frame is a nonaccelerating motion reference frame. Loosely
speaking, acceleration is defined with respect to the distant cosmos. In an
inertial frame, Newton’s second law (force = m ass X acceleration) holds.
Strictly defined, an inertial frame is a member of the set of all frames not
accelerating relative to one another. A noninertial frame is any frame
accelerating relative to an inertial frame. Its acceleration, in general, includes
both translational and rotational components, resulting in pseudoforces
(pseudogravity,aswellasCoriolis and centrifugal forces).
The toolbox mo dels the Earth’s shape (the geoid) as an oblate spheroid, a
special type of ellipsoid with two longer axes equal (defining the equatorialplane) and a third, slightly shorter (geopolar) axis of symmetry. The equator
is the intersection of the equatorial plane and the Earth’s surface. The
geographic poles are the intersection o f the Earth’s surface and the geopolar
axis. In general, the Earth’s geopo lar and rotation axes are not identical.
Defining Coordinate Systems
Latitudes parallel the equator. Longitudes parallel the geopolar axis. The
zero longitude or prime meridian passes through Greenwich, England.
Approximations
The Aerospace Toolbox software m ak e s three standard approximations in
defining coordinate systems relative to the Earth.
• The Earth’s surface or geoid is an oblate spheroid , defined by its lo nger
equatorial and shorter geopolar axes. In reality, the Earth is slightly
deformed with respect to the standard geoid.
• The Earth’s rotation axis and equatorial plane are perpendicular, so that
the rotation and geopolar axes are identical. In reality, these axes are
slightly misaligned, and the equatorial plane wobbles as the Earth rotates.
This effect is negligible in most applications.
• The only noninertial effect in Earth-fixed coordinates is due to the Earth’s
rotation about its axis. This is a rotating, geocentric system . The toolbox
ignores the Earth’s motion around the Sun, the Sun’s motion in the Galaxy,
and the Galaxy’s motion through cosmos. In most applications, only the
Earth’s rotation matters.
This approximation must be changed for spacecraft sent into deep space,
i.e., outside the Earth-Moon system, and a heliocentric system is preferred.
Motion with Respect to Other Planets
The Aerospace Toolbox software uses the standard WGS-84 geoid to model
the Earth. You can change the equatorial axis length, the flattening, and
the rotation rate.
You can represent the motion of spacecraft with respect to any celestial body
that is well approximated by an oblate spheroid by changing the spheroid
size, flattening, and rotation rate. If the celestial body is rotating westward
(retrogradely), make the rotation rate negative.
2-3
2 Using Aerospace Toolbox
Coordinate Systems for Modeling
Modeling aircraft and spacecraft is simplest if you use a coordinate system
fixed in the body itself. In the case of aircraft, the forward direction is
modified by the presence of wind, and the craft’s motion through the air is
not the same as its motion relative to the ground.
Body Coordinates
The noninertial body coordinate system is fixed in both origin and orientation
to the moving craft. The craft is assumed to be rigid.
The orientation of the body coordinateaxesisfixedintheshapeofbody.
• The
• The
• The
Translational Degrees of Freedom. Translations are defined by moving
along these axes by distances
Rotational Degrees of Freedom. Rotations are defined by the Euler angles
P, Q, R or Φ, Θ, Ψ.Theyare
•
•
•
x-axis points through the nose of the craft.
y-axis points to the right of the x-axis (facing in the pilot’s direction of
view), perpendicular to the
z-axis points down through the bottom of the craft, perpendicular to
the
x-y plane and satisfying the RH rule.
P or Φ: Roll about the x-axis
Q or Θ:Pitchaboutthey-axis
R or Ψ: Yaw about the z-axis
x-axis.
x, y,andz from the origin.
2-4
Defining Coordinate Systems
Wind Coordinates
The noninertial wind coordinate system has its origin fixed in the rigid
aircraft. The coordinate system orientation is defined relative to the craft’s
velocity V.
The o rientation of the wind coordinate axes is fixed by the velocity V.
• The
• The
• The
x-axis points in the direction of V.
y-axis points to the right of the x-axis (facing in the direction of V),
perpendicular to the
z-axis points perpendicular to the x-y plane in whatever way needed to
satisfy the RH rule with respect to the
x-axis.
x-andy-axes.
Translational Degrees of Freedom. Translations are defined by moving
along these axes by distances
x, y,andz from the origin.
2-5
2 Using Aerospace Toolbox
Rotational Degrees of Freedom. Rotations are defined by the Euler
angles Φ, γ, χ.Theyare
• Φ: Bank angle about the
• γ: Flight path about the
• χ:Headingangleaboutthe
x-axis
y-axis
z-axis
2-6
Defining Coordinate Systems
Coordinate Systems for Navigation
Modeling aerospace trajectories requires positioning and orienting the aircraft
or spacecraft with respect to the rotating Earth. Navigation coordinates are
defined with respect to the center and surface of the Earth.
Geocentric and Geodetic Latitudes
The geocentric latitude λ on the Earth’s surface is defined by the angle
subtended by the radius vector from the Earth’s center to the surface point
with the equatorial plane.
The geodetic latitude μ on the Earth’s surface is defined by the angle
subtended by the surface normal vector
n and the equatorial plane.
2-7
2 Using Aerospace Toolbox
NED Coordinates
The north-east-down (NED) system is a noninertial system with its origin
fixed at the aircraft or spacecraft’s center of gravity. Its axes are oriented
along the geodetic directions defined by the Earth’s surface.
• The
• The
• The
x-axis points north parallel to the geoid surface, in the polar direction.
y-axis points east parallel to the geoid surface, along a latitude curve.
z-axis points downward, toward the Earth’s surface, antiparallel to the
surface’s outward normal
Flying at a constant altitude means flying at a constant
surface.
n.
z above the Earth’s
2-8
Defining Coordinate Systems
ECI Coordinates
The Earth-centered inertial (ECI) system is a mixed inertial system. It is
oriented with respect to the Sun. Its origin is fixed at the center of the Earth.
• The
• The
z-axis p oints northward along the Earth’s rotation axis.
x-axis points outward in the Earth’s equatorial plane exactly at the
Sun. (This rule ignores the Sun’s oblique angle to the equator, which varies
with season. The actual Sun always remains in the
• The
y-axis points into the eastward quadrant, perpendicular to the x-z
x-z plane.)
planesoastosatisfytheRHrule.
Earth-Centered Coordinates
2-9
2 Using Aerospace Toolbox
ECEF Coordinates
The Earth-center, Earth-fixed (ECEF) system is a noninertial system that
rotates with the Earth. Its origin is fixed at the center of the Earth.
• The
• The
• The
z-axis p oints northward along the Earth’s rotation axis.
x-axis points outward along the intersection of the Earth’s equatorial
planeandprimemeridian.
y-axis points into the eastward quadrant, perpendicular to the x-z
planesoastosatisfytheRHrule.
Coordinate Systems for Display
The Aerospace Toolbox software lets you use FlightGear coordinates for
rendering motion.
FlightGear is an open-source, third-party flight simulator with an interface
supported by the Aerospace Toolbox product.
• “Working with the Flight Simulator Interface” on page 2-53 discusses the
toolbox interface to FlightGear.
• See the FlightGear documentation at www.flightgear.org for complete
information about this flight simulator.
The FlightGear coordinates form a special body-fixed system, rotated from the
standard bo dy coordinate system about the
• The
x-axis is positive toward the back of the vehicle.
y-axis by -180 degrees:
2-10
• The
• The
values.
y-axisispositivetowardtherightofthevehicle.
z-axis is positive upward, e.g., wheels typically have the lowest z
Defining Coordinate Systems
References
Recommended Practice for Atmospheric and Space Flight Vehicle Coordinate
Systems, R-004-1992, ANSI/AIAA, February 1992.
Mapping Toolbox User’s Guide, The MathWorks, Inc., Natick, Massachusetts.
Rogers, R. M., Applied Mathematics in Integrated Navigation Systems,AIAA,
Reston, Virginia, 2000.
Stevens, B. L., and F. L. Lewis, Aircraft Control and Simulation,2nded.,
Wiley-Interscience, New York, 2003.
Thomson, W. T., Introduction to Space Dynamics, John Wiley & Sons, New
York, 1961/Dover Publications, Mineola, New York, 1986.
World Geodetic System 1984 (WGS 84),
http://earth-info.nga.mil/GandG/wgs84.
2-11
2 Using Aerospace Toolbox
Defining Aerospace Units
The Aerospace Toolbox functions support standard measurement system s.
The Unit Conversion functions provide means for converting common
measurement units from one system to another, such as converting velocity
from feet per second to meters per second and vice versa.
The unit conversion functions support all units listed in this table.
“Example of a USAF Digital DATC OM File” on page 2-14
“Importing Data from DATCOM Files” on page 2-15
“Examining Imported DATCOM Data” on page 2-15
“Filling in Miss ing DATCOM D a t a” on page 2-17
“Plotting Aerodynamic Coefficients” on page 2-22
Overview
The Aerospace Toolbox product enables bringing United States Air Force
(USAF) Digital DATCOM files into the MATLAB environment by using
the
datcomimport function. For more information, see the datcomimport
function reference page. This section explains how to import data from a
USAF Digital DATCOM file.
2-14
TheexampleusedinthefollowingtopicsisavailableasanAerospaceToolbox
demo. You can run the demo either by entering
astimportddatcom in the
MATLAB Command Window or by finding the demo entry (Importing from
USAF Digital DATCOM Files) in the MATLAB Online Help and clicking Runin the Comm a nd Window on its demo page.
Example of a USAF Digital DATCOM File
The following is a sample input file for USAF Digital DATCOM for a
wing-body-horizontal tail-vertical tail configuration running over five alphas,
two Mach numbers, and two altitudes and calculating static and dynamic
derivatives. You can also view this file by entering
MATLAB Command Window.
The output file generated by USAF Digital DATCOM for the same
wing-body-horizontal tail-vertical tail configuration running over five alphas,
two Mach numbers, and two altitudes can be viewed by entering
astdatcom.out
in the MATLAB Command Window.
type
Importing Data from DATCOM Files
Use the datcomimport function to bring the Digital DATCOM data into the
MATLAB environment.
alldata = datcomimport('astdatcom.out', true, 0);
Examining Imported DATCOM Data
The datcomimport function creates a cell array of structures containing the
data from the Digital DATCOM output file.
“Aerospace Toolbox Animation Objects” on page 2-26
“Using Aero.Animation Objects” on page 2-26
“Using Aero.VirtualRealityAnimation Objects” on page 2-35
“Using A ero.FlightG earAnim ation Objects” on page 2-48
Aerospace Toolbox Animation Objects
To visualize flight data in the Aerospace Toolbox environment, you can
use the following animation objects and their asso ciated methods. These
animation objects use the MATLAB time series object,
visualize flight data.
•
Aero.Animation — You can use this animatio n object to visualize flight
data w ithout any other tool or toolbox. The follo wing objects support this
object.
timeseries to
2-26
- Aero.Body
- Aero.Camera
- Aero.Geometry
• Aero.VirtualRealityAnimation — Y ou can use this animation object
to visualize flight data with the Simulink 3D Animation product. The
following objects support this object.
- Aero.Node
- Aero.Viewpoint
• Aero.FlightGearAnimation
You can use this animation object to visualize flight data with the
FlightGear simulator.
Using Aero.Animation Objects
ThetoolboxinterfacetoanimationobjectsusestheHandleGraphics®product.
The demo, Overlaying Simulated and Actual Flight Data (
astmlanim), visually
3-D Flight Data Playback
compares simulated and actual flight trajectory data. It does this by creating
animation objects, creating bodies for those objects, and loading the flight
trajectory data. This section describes what happens when the demo runs.
1 Create and configure an animation object.
a Configure the animation object.
b Create and load bodies for that object.
2 Load recorded data for flight trajectories.
3 Displaybodygeometriesinafigurewindow.
4 Play back flight trajectories using the animation object.
5 Manipulate the camera.
6 Manipulate bodies, as follows:
a Move and reposition bodies.
b Create a transparency in the first body.
c Change the color o f the second body.
d Turn off the landing gear of the second body.
Running the Demo
1 Start the MATLAB software.
2 Run the demo either by entering astmlanim in the MATLAB Command
Window or by finding the demo entry (Overlaying Simulated and Actual
Flight Data) in the MATLAB Online Help and clicking RunintheCommand Window on its demo page.
While running, the demo performs several steps by issuing a series of
commands, as explained below.
Creating and Configuring an Animation Object
This series of commands creates an animation object and configures the object.
2-27
2 Using Aerospace Toolbox
1 Create an animation object.
h = Aero.Animation;
2 Configure the animation object to set the number of frames per second
(
FramesPerSecond) property. This controls the rate at which frames are
displayed in the figure window.
h.FramesPerSecond = 10;
3 Configure the animation object to set the seconds of animation data per
second time scaling (
h.TimeScaling = 5;
TimeScaling) property.
The combination of FramesPerSecond and TimeScaling property determine
the time step of the simulation. The settings in this demo result in a time
step of approximately 0.5 s.
4 Create and load bodies for the animation object. The demo will use these
bodies to work with and display the simulated and actual flight trajectories.
The first body is orange; it represents simul ate d data. The second body is
blue; it represents the actual flight data.
Both bodies are AC3D format files. AC3D is one of several file formats that
the a nimation objects support. FlightGear uses the same file format. The
animation object reads in the bodies in the AC3D format and stores them
as patches in the geometry object within the animation object.
Loading Recorded Data for Flight Trajectories
This series of commands loads the recorded flight trajectory data, which is
contained in files in the
•
simdata – Contains simulated flight trajectory data, which is set up as a
6DoF array.
•
fltdata – Contains actual flight trajectory data, which is set up in a
custom format. To access this custom format data, the demo needs to
matlabroot\toolbox\aero\astdemos folder.
3-D Flight Data Playback
set the body object TimeSeriesSourceType parameter to Custom,then
specify a custom read function.
This command creates a figure object for the animation object.
h.show();
Playing Back Flight Trajectories Using the Animation Object
This command plays the animation bodies for the duration of the time series
data. This illustrates the differences between the simulated and actual flight
data.
h.play();
2-29
2 Using Aerospace Toolbox
2-30
Manipulating the Camera
This command series describes how you can manipulate the camera on the two
bodies, and redisplay the animation. The
object controls the camera position relative to the bodies in the animation. In
the section “Playin g Back Flight Trajectories Usin g the Animation Object”
on page 2-29, the camera obje ct uses a default value for the
property. In this command series, the demo references a custom PositionFcn
function, which uses a static position based on the position of the bodies; no
dynamics are involved. The custom
matlabroot\toolbox\aero\astdemos folder.
1 Set the camera PositionFcn to the custom function
staticCameraPosition.
h.Camera.PositionFcn = @staticCameraPosition;
PositionFcn property of a camera
PositionFcn
PositionFcn function is located in the
3-D Flight Data Playback
2 Run the animation again.
h.play();
Manipulating Bodies
This sectio n illustrates some of the actions you can perform on bodie s.
Moving and Reposition ing Bodies. This series of commands illustrates
how to move and reposition bodies.
1 Set the starting time to 0.
t=0;
2 Move the body to the starting position that is based on the time series data.
Use the Aero.Animation object
h.updateBodies(t);
Aero.Animation.updateBodies method.
3 Update the camera position using the custom PositionFcn
function set in the previous section. Use the Aero.Animation object
Aero.Animation.updateCamera method.
h.updateCamera(t);
4 Reposition the bodies by first getting the current body position, then
separating the bodies.
a Get the current body positions and rotations from the objects of both
Creating a Transparency in the First Body. This series of commands
illustrates how to create and attach a t ransparency to a body. The animation
object stores the body geometry as patches. This example manipulates the
transparency properties of these patches (see “Creating 3-D Models with
Patches” in the MATLAB documentation).
Note The use of transparencies might decrease animation speed on
platforms that use software OpenGL
®
rendering (see opengl in the MATLAB
documentation).
1 Change the body patch properties. Use the Aero.Body PatchHandles
property to get the patch handles for the first body.
patchHandles2 = h.Bodies{1}.PatchHandles;
2 Set the desired face and edge alpha values for the transparency.
Note If you cannot access the name property to determine the parts of
the vehicle to color, you must use an alternative way to se lectively c olor
your vehicle.
Turning Off the Landing Gear of the Second Body. This command series
illustrates how to turn off the landing g ea r on the second body by turning off
the visibility of all the vehicle parts associated with the landing gear.
Note The indices into the patchHandles3 vector are determined from the
name property. If you cannot access the name property to determine the
indices, you must use an alternative way to determine the indices that
correspond to the geometry parts.
for k = [1:8,11:14,52:57]
set(patchHandles3(k),'Visible','off')
end
Using Aero.VirtualRealityAnimation Objects
The A eros pace Toolbox interface to virtual reality animation objects uses the
Simulink 3D Animation software. See
Aero.Node,andAero.Viewpoint for details.
Aero.VirtualRealityAnimation,
1 Create and configure an animation object.
a Configure the animation object.
b Initialize that object.
2 Enable the tracking of changes to virtual worlds.
3 Load the animation world.
4 Load time series data for simulation.
5 Set coordination information for the object.
6 Add a chase helicopter to the object.
7 Load time series data for chase helicopter simulation.
8 Set coordination information for the new object.
9 Add a new viewpoint for the helicopter.
2-35
2 Using Aerospace Toolbox
10 Play the animation.
11 Create a new viewpoint.
12 Add a route.
13 Add another helicopter.
14 Remove bodies.
15 Revert to the original world.
Running the Demo
1 Start the MATLAB software.
2 Run the demo either by entering astvranim in the MATLAB Command
Window or by finding the demo entry (Visualize Aircraft Takeoff via the
Simulink 3D Animation product) in the MATLAB Online Help and clicking
RunintheCommandWindowon its demo page.
2-36
While running, the demo performs several steps by issuing a series of
commands, as explained below.
Creating and Configuring a Virtual Reality Animation Object
This series of commands creates an animation object and configures the object.
1 Create an animation object.
h = Aero.VirtualRealityAnimation;
2 Configure the animation object to set the number of frames per second
(
FramesPerSecond) property. This controls the rate at which frames are
displayed in the figure window.
h.FramesPerSecond = 10;
3 Configure the animation object to set the seconds of animation data per
second time scaling (
h.TimeScaling = 5;
TimeScaling) property.
3-D Flight Data Playback
The combination of FramesPerSecond and TimeScaling property determine
the time step of the simulation. The settings in this demo result in a time
step of approximately 0.5 s.
2 Set the asttkoff.wrl world filename to the copied .wrl file.
h.VRWorldFilename = [tempdir,'asttkoff.wrl'];
Loading the Animation World
Load the animation world described in the VRWorldFilename field of the
animation object. When parsing the world, this method creates node objects
for existing nodes with
Simulink 3D Animation Viewer.
h.initialize();
DEF nam e s. The initialize method also opens the
2-37
2 Using Aerospace Toolbox
2-38
Displaying Figures
While working with this demo, you can capture a view of a scene with the
takeVRCapture tool. This tool is specific to the astvranim demo. To display
the initial scene, type
takeVRCapture(h.VRFigure);
3-D Flight Data Playback
A MATLAB figu r e window displays with the initial scene.
Aligning the Position and Rotation Data with Surrounding
Virtual World Objects
The virtual reality animation object expects positions and rotations in
aerospace body coordinates. If the input data coordinate system is different, as
isthecaseinthisdemo,youmustcreateacoordinate transformation function
to correctly line up the position and rotation data with the surrounding objects
in the virtual world. This code should set the coordinate transformation
function for the virtual reality animation. The custom transfer function for this
demo is
In this demo, if the input translation coordinates are
transform function must adjust them as:
To add a viewpoint for the chase helicopter, use the addViewpoint method.
New viewpoints appear in the Viewpoints menu of the Simulink 3D
Animation Viewer. Type the following to add the viewpoint
Helicopter
h.addViewpoint(h.Nodes{2}.VRNode,'children','chaseView','View From Helicopter');
to the Viewpoints menu.
View From
3-D Flight Data Playback
Playing Back the Simulation
The play command animates the virtual reality world for the given position
and angle for the duration of the time series data. Set the orientation of the
viewpoint first.
1 Set the orientat ion of the viewpoint via the vrnode object associated with
set(h.VRFigure,'Viewpoint','View From Helicopter');
2 Play the animation.
h.play();
Adding a Route to the Camera1 Node
The vrworld has a Ride on the Plane viewpoint. To enable this viewpoint to
function as intended, connect the plane position to the Camera1 node with the
addRoute method. This method add s a VRML ROUTE statement.
The following figure is a view of the entire trajectory with the third body
removed.
Reverting to the Original World
Theoriginalfilenameisstoredinthe'VRWorldOldFilename' property
of the virtual reality animation object. To display the original world, set
'VRWorldFilename' to the original name and reinitialize it.
2-47
2 Using Aerospace Toolbox
1 Revert to the original world, 'VRWorldFilename'.
h.VRWorldFilename = h.VRWorldOldFilename{1};
2 Reinitialize the restored world.
h.initialize();
Closing and Deleting Worlds
To close and delete a world, use the delete method.
h.delete();
Using Aero.FlightGearAnimation Objects
The Aerospace Toolbox interface to the FlightGear flight simulator enables
you to visualize flight data in a three-dimensional environment. The
third-party FlightGear simulator is an open source software package available
through a GNU
obtain and install the third-party FlightGear flight simulator. It then explains
how to play back 3-D flight data by using a FlightGear demo, provided with
your Aerospace Toolbox software, as an example.
®
General Public License (GPL). This section explains how to
2-48
• “About the FlightGear Interface” on page 2-48
• “Configuring Your Computer for FlightGear” on page 2-49
• “Installing and Starting FlightGear” on page 2-52
• “Working with the Flight Simulator Interface” on page 2-53
• “Running the Demo” on page 2-56
About the FlightGear Interface
The FlightGear flight simulator interface included with the Aerospace Toolbox
product is a unidirectional transmission link from the MATLAB software
to FlightGear using FlightGear’s published
protocol. Data is transmitted via UDP network packets to a running instance
of FlightGear. The toolbox supports multiple standard binary distributions of
FlightGear. See “Working with the Flight Simulator Interface” on page 2-53
for interface details.
net_fdm binary data exchange
3-D Flight Data Playback
FlightGear is a separate software entity neither created, owned, nor
maintained by The MathWorks.
• To report bugs in or request enhancements to the Aerospace Too lbox
FlightGear interface, contact MathWorks Technical Support at
http://www.mathworks.com/contact_TS.html.
• To report bugs or request enhancements to FlightGear itself, visit
www.flightgear.org and use the contact page.
Obtaining FlightG ear. You can obtain FlightGear from
www.flightgear.org in the download area or by ordering CDs from
FlightGear. The download area contains extensive documentation for
installation and configuration. Because FlightGear is an open source project,
source downloads are also available for customization and porting to custom
environments.
Configuring Your Computer for FlightGear
You must have a high performance graphics card with stable drivers to use
FlightGear. For more information, see the FlightGear CD distribution or the
hardware requirements and documentation areas of the FlightGear Web
site,
www.flightgear.org.
The MathWorks tests of FlightGear’s performance and stability indicate
significant sensitivity to computer video cards, driver versions, and driver
settings. You need OpenGL support with hardware acceleration activated.
The OpenGL settings are particularly important. Withoutpropersetup,
performance can drop from about a 3 0 frames-per-second (fps) update rate to
less than 1 f ps.
Graphics Recommendations for Microsoft Windows. The MathWorks
recommends the following for Windows
®
users:
• Choose a graphics card with good OpenGL performance.
• Always use the latest tested and stable driver release for your video card.
Test the driver thoroughly on a few computers before deploying to others.
For Microsoft
®
Windows XP systems running on x86 (32-bit) or
AMD-64/EM64T chip architectures, the graphics card operates in the
unprotected kernel space known as Ring Zero. This means that glitches in
2-49
2 Using Aerospace Toolbox
the driver can cause the Windows operating system to lock or crash. Before
buying a large number of computers for 3-D applications, test, with your
vendor, one or two computers to find a combination of hardware, operating
system, drivers, and settings that are stable for you r applications.
Setting Up OpenGL Graphics on Windows. For complete information on
Silicon Graphics OpenGL settings, refer to the documentation at the OpenGL
Web site,
Follow these steps to optimize your video card settings. Your driver’s panes
might look different.
1 Ensure that you have activated the OpenGL hardware acceleration on
your video card. On Windows, access this configuration through Start >
Settings > Control Panel > Display, which opens the following dialogbox. Select the Settings tab.
www.opengl.org.
2-50
2 Click the Advanced button in the lower right of the dialog box, which
opens the graphics card’s custom configuration dialog box, and go to the
3-D Flight Data Playback
OpenGL tab. For an ATI Mobility Radeon 9000 video card, the OpenGL
pane looks like this:
3 For best performance, move the Main Settings slider near the top of the
dialog box to the Performance end of the slider.
4 If stability is a problem, try other screen resolutions, other color depths in
the Displays pane, and other OpenGL acceleration modes.
Many cards perform m uch better at 16 bits-per-pixel color depth (also known
as 65536 color mode, 16-bit color). For example, on an ATI Mobility Radeon
9000 running a given model, 30 fps are achieved in 16-bit color mode, while 2
fps are achieved in 32-bit color mode.
2-51
2 Using Aerospace Toolbox
Setup on Linux®,MacOS®X, and Other Platforms. FlightGear
distributions are available for Linux, Mac OS X, and other UNIX
from the FlightGear Web site,
platforms, like Windows, requires careful configuration of graphics cards and
drivers. Consult the documentation and hardware requirements sections
at the FlightG ear Web site.
Using MATLAB Graphics Controls to Configure Your OpenGL Settings.
You can also control your OpenGL rendering from the MATLAB command
line with the MATLAB Graphics
command reference for more information.
www.flightgear.org. Installationonthese
opengl command. Consult the opengl
®
platforms
Installing and Starting FlightGear
The extensive FlightGear documentation guides you through the installation
in detail. Consult the documentation section of the FlightGear Web site for
complete installation instructio n s:
Keep the following points in mind:
• Generous central processor speed, system and video R AM, and virtual
memory are essential for good flight simulator performance.
The MathWorks recommends a minimum of 512 megabytes of system RAM
and 128 megabytes o f video RAM for reasonable performance.
www.flightgear.org.
2-52
• Be sure to have sufficient disk space for the FlightGear download a nd
installation.
• The MathWorks recommends configuring your computer’s graphics card
before you install FlightGear. See the preceding section, “Configuring Your
Computer for FlightGear” on page 2-49.
• Shutting down all running applications (including the MATLAB software)
before installing FlightGear is recommended.
• The MathWorks tests indicate that the operational stability of FlightGear
is especially sensitive during startup. It is best to not move, resize,
mouse over, overlap, or cover up the FlightGear window until the initial
simulation scene appears after the startup splash screen fades out.
3-D Flight Data Playback
• The current releases of FlightGear are optimized for flight visualization at
altitudes below 100,000 feet. FlightGear does not work well or at all with
very high altitude and orbital views.
The Aerospace Toolbox product supports FlightGear on a number of platforms
(
http://www.mathworks.com/products/aerotb/requirements.html). The
following table lists the properties you should be aware of before you start to
use FlightGear.
FlightGear
Property
FlightGearBaseDirectory
GeometryModelName
Folder Description
FlightGear
installation folder.
Platforms
Windows
Sun™
Solaris™ or
Typica l Lo cation
C:\Program Files\FlightGear
(default)
Directory into which you installed
FlightGear
Linux
Mac
®
/Applications
(folder to which you d ragged the
FlightGear icon)
The Aerospace Toolbo x product provides a demo named Displaying Flight
Trajectory Data, which shows you how you can visualize flight trajectories
withFlightGearAnimationobject. Thedemoisintendedtobemodified
depending on the particulars of your FlightGear installation. This section
explains how to run this demo. Use this demo as an example to play back your
own 3-D flight d ata with FlightGear.
2-53
2 Using Aerospace Toolbox
YouneedtohaveFlightGearinstalledand configured before attempting to
simulate this model. See “About the FlightGear Interface” on page 2-48.
To run the demo:
1 Import the aircraft geometry into FlightGear.
2 Run the demo. The demo performs the following steps:
a Loads recorded trajectory data
b Creates a time series object from trajectory data
c Creates a FlightGearAnimation object
3 Modify the animation object properties, if needed.
4 Create a run script for launching FlightGear flight simulator.
5 Start FlightGear flight simulator.
6 Play back the flight trajectory.
2-54
The following sections describe howtoperformthesestepsindetail.
Importing the Aircraft G e ometry into FlightGear. Before running the
demo, copy the aircraft geometry model into FlightGear. From the following
procedures, choose the one appro priate for your platform. This section
assumes that you have read “Installing and Starting FlightGear” on page 2-52.
If your platform is Windows:
1 Go to your installed FlightGear folder. O pen the data folder, then the
Aircraft folder: FlightGear\data\Aircraft\.
2 You may already have an HL20 subfolder there, if you have previously run
the Aerospace Blockset NASA HL-20 with FlightGear Interface demo. In
this case, you don’t have to do anything, because the geometry model
is the same.
Otherwise, copy the
matlabroot\toolbox\aero\aerodemos\ folder to the
FlightGear\data\Aircraft\ folder. This folder contains the
HL20 folder from the
3-D Flight Data Playback
preconfigured geometries for the HL-20 simulation and HL20-set.xml.
The file
2 List the contents of the Aircraft folder. For example, type
ls $FlightGearBaseDirectory/data/Aircraft/
3 You may already have an HL20 subfolder there, if you have previously run
the Aerospace Blockset NASA HL-20 with FlightGear Interface demo. In
this case, you do not have to do anything, because the geometry model is
the same. Continue to “Running the Demo” on page 2-27.
You can now set the object properties for data playback (see “Modifying the
FlightGearAnimation Object Properties” on page 2-58).
Modifying the FlightGearAnimation Object Properties. Modify the
FlightGearAnimation object properties as needed. If your FlightGear
installation folder is other thanthatinthedemo(forexample,
modify the
FlightGearBaseDirectory property by issuing the following
Similarly,ifyouwanttouseaparticularfilenamefortherunscript,modify
the
OutputFileName property.
Verify the FlightGearAnimation object properties:
get(h)
You can now generate the run script (see “Generating the Run Script” on
page 2-58).
Generating the Run Script. To start FlightGear with the desired initial
conditions (location, date, time, weather, operating modes), it is best to create
a run script by using the
GenerateRunScript(h)
GenerateRunScript command:
By default, GenerateRunScript saves the run script as a text file
named
runfg.bat. You can specify a different name by modifying the
3-D Flight Data Playback
OutputFileName property of the FlightGearAnimation object, as described
in the previous step.
This file does not need to be generated each time the data is viewed, only
when the desired initial conditions or FlightGear information changes.
You are now ready to start FlightGear (see “Starting the FlightGear Flight
Simulator” on page 2-59).
Starting the FlightGear Flight Simula tor. To start FlightGear from the
MATLAB command prompt, use the
system command to execute the run
script. Provide the name of the output file created by GenerateRunScript
as the argument:
system('runfg.bat &');
FlightGear starts in a separate window.
Tip With the FlightGear window in focus, press the V key to alternate
between the different aircraft views: cockpit view, helicopter view, chase
view, and so on.
You are now ready to play back data (see “Playing Back the Flight Trajectory”
on page 2-59).
Playing Back the Flight Trajectory. Once FlightGear is running, the
FlightGearAnimation object can start to communicate with FlightGear. To
animate the flight trajectory data, use the play command:
play(h)
The following illustration shows a snapshot of flight data playback in tower
view without yaw.
Change virtual reality animation
node position and orientation as
function of time
Construct virtual reality animation
object
3-9
3 Function Reference
Axes Transformations
angle2dcm
angle2quat
dcm2alphabeta
dcm2angle
dcm2latlon
dcm2quat
dcmbody2wind
dcmecef2nedConvert geodetic latitude and
ecef2llaConvert Earth-centered Earth-fixed
geoc2geod
Create direction cosine matrix from
rotation angles
Convert rotation angles to
quaternion
Convert direction cosine matrix to
angle of attack and sideslip angle
Create rotation angles from direction
cosine matrix
Convert direction cosine matrix to
geodetic latitude and longitude
Convert direction cosine matrix to
quaternion
Convert angle of attack and sideslip
angletodirectioncosinematrix
longitude to direction cosine matrix
(ECEF) coordinates to geo detic
coordinates
Convert geocentric latitude to
geodetic latitude
3-10
geod2geoc
lla2ecefConvert geodetic coordinates to
quat2angle
quat2dcm
Convert g eodetic latitude to
geocentric latitude
Earth-centered Earth-fixed (ECEF)
coordinates
Convert quaternion to rotation
angles
Convert quaternion to direction
cosine matrix
Environment
Environment
atmoscira
atmoscoesa
atmosisa
atmoslapse
atmosnonstd
atmosnrlmsise00Implement mathematical
atmospa
geoide
gravitycentrifugalImplement centrifugal effect of
grav
lt
gm96
itysphericalharmonic
Use COSPAR International
Reference Atmos phere 1986 model
Use 1976 COESA model
Use International Standard
Atmosphere model
Use Lapse Rate Atmosphere model
Use climatic data from MIL-STD-210
or MIL-HDBK-310
representation of 2001 United
States Naval Research Laboratory
Mass Spectrometer and Incoherent
Scatter Radar Exosphere
Calculate pressure altitude based on
ambient pressure
Calculate geoid height as determined
from EGM96 Geopotential Model
planetary gravity
ement spherical harmonic
Impl
resentation of planetary gravity
rep
gravitywgs84
gravityzonalImplement zonal harmonic
wrldmagmUse World Magne t ic Model
lement 1984 World Geodetic
Imp
tem (WGS84) representation of
Sys
rth’s gravity
Ea
representation of planetary gravity
3-11
3 Function Reference
File Reading
datcomimport
Flight Parame
airspeed
alphabetaIncidence a
dpressure
geocradius
machnumber
rrdelta
rrsigma
rrtheta
ters
Bring DATCOM file into MATLAB
environment
Airspeed from velocity
nd sideslip angles
Compute dyn
velocity a
Estimate r
at geocent
Compute M
y and speed of sound
velocit
Compute
Comput
Compu
amic pressure using
nd density
adius of ellipsoid p lanet
ric latitude
ach number using
relative pressure ratio
erelativedensityratio
te relative temperature ratio
Gas Dynamics
3-12
flowfannoFanno line f low relations
flowisentropicIsentropic flow ratios
flownormalshock
flowprandtlmeyerCalculate Prandtl-Meyer functions
flowrayleighRayleigh line flow relations
Normal shock relations
for expansion waves
Quaternion Math
Quaternion Math
Time
quatconj
quatdivideDivide quaternion by another
quatinv
quatmod
quatmultip
quatnorm
quatnorma
quatrota
decyea
ndate
julia
year
leap
mjuliandate
ly
lize
te
r
Calculate conjugate of quaternion
quaternion
Calculate inverse of quaternion
Calculate modulus of quaternion
Calculate product of two quaternions
Calculate norm of quaternion
Normalize
Rotate vector by quaternion
Calculate decimal year
Calculate Julian date
Dete
ulate modified Julian date
Calc
quaternion
rmine leap year
Unit Conversion
convacc
convang
convangacc
Convert from acceleration units to
desired acceleration units
Convert from angle units to desired
angle units
Convert from angular acceleration
units to desired angular acceleration
units
3-13
3 Function Reference
convangvel
convdensity
convforceConvert from force units to desired
convlength
convmass
convpres
convtemp
Convert from angular velocity units
to desired angular velocity units
Convert from density units to desired
density units
force units
Convert from length units to desired
length units
Convert from mass units to desired
mass units
Convert from pressure units to
desired pressure units
Convert from temperature units to
desired temperature units
3-14
Alphabetical List
4
Aero.Animation.addBody
PurposeAdd loaded body to animation object and generate its patches
Syntaxidx = addBody(h,b)
idx = h.addBody(b)
Descriptionidx = addBody(h,b) and idx = h.addBody(b) add a loaded body, b,
to the animation object
thebodytobeadded.
h and generates its patches. idx is the index of
Input
Arguments
Output
h
b
idx
Animation object.
Loaded body.
Index of the body to be added.
Arguments
ExamplesAdd a second body to the list that is a pointer to the first body. This
means that if you change the properties of one body, the properties of
the other body change correspondingly.
h = Aero.Animation;
idx1 = h.createBody('pa24-250_orange.ac','Ac3d');
b = h.Bodies{1};
idx2 = h.addBody(b);
4-2
addNode (Aero.VirtualRealityAnimation)
PurposeAdd existing node to current virtual reality world
SyntaxaddNode(h, node_name, wrl_file)
h.addNode(node_name, wrl_file)
DescriptionaddNode(h, node_name, wrl_file) and h.addNode(node_name,
wrl_file)
reality world. The
taken.
points to) the
names in the same
added. You must specify the full path for this file. The vrnode object
associated with the node object must be defined using a
in the
Transform.
add an existing node, node_name, to the current virtual
wrl_file isthefilefromwhichthenewnodeis
addNode adds a new node named node_name, which contains (or
wrl_file. node_name must be unique from other node
.wrl file. wrl_file must contain the node to be
DEF statement
.wrl file. This method creates a node object on the world of type
When you use the
.wrl file will be added to the virtual reality animation object under one
addNode method to add a node, all the objects in the
node. If you want to add separate nodes for the objects in the
placeeachnodeinaseparate
DescriptionaddViewpoint(h, parent_node, parent_field, node_name) and
h.addViewpoint(parent_node, parent_field, node_name) add a
viewpoint named
field of the vrnode object and whose
field of the vrnode object to the virtual world animation object,
node_name whose parent_node is the parent node
parent_field is a valid parent
h.
addViewpoint(h, parent_node, parent_field, node_name,
description)
node_name, description)
parent_node is the parent node field of the vrnode object and whose
parent_field is a valid parent field of the vrnode object to the virtual
object and whose
object to the virtual world animation object,
you want to describe the viewpoint,
viewpoint, and
position using VRML coordinates (xyz). Specify orientation in a
VRML axes angle format (
Note If you call addViewpoint with only the description argument,
you must set the position and orientation of the viewpoint with the
Simulink 3D Animation
to use VRML coo rdinates.
xyz).
add a viewpoint named
parent_field is a valid parent field of the vrnode
h. description is the string
position is the position of the
orientation is the orientation of the viewpoint. Specify
Descriptionh = Aero.Animation constructs an animation object. The animation
object is returned to
Note The Aero.Animation constructor does not retain the properties
of previously created animation objects, even those that you have saved
to a MAT-file. This means that subsequent calls to the animation object
constructor always create animation objects with default properties.
Examplesh=Aero.Animation
h.
4-9
Aero.Body
PurposeCreate body object for use with animation object
Syntaxh = Aero.Body
Descriptionh = Aero.Body constructs a body for an animation object. The
animation object is returned in
typically:
1 Create the animation body.
2 Configure or customize the body object.
3 Load the body.
4 Generate patches for the body (requires an axes from a figure).
5 Set time series data sou rce.
6 Move or update the body.
h. TousetheAero.Bodyobject,you
Constructor
Summary
4-10
By default, an Aero.Body object natively uses aircraft
for the body geometry and the time series data. It expects the rotation
order
z-y-x (psi,theta,phi).
Convert time series data from other coordinate systems on the fly by
registering a different
Constructor
Body
CoordTransformFcn function.
Description
Construct body object for use with animation
object.
x-y-z coordinates
Aero.Body
Method
Summary
Property
Summary
Method
findstartstoptimes
generatePatches
load
move
update
Property
CoordTransformFcn
Name
Position
Rotation
Geometry
PatchGenerationFcn
PatchHandles
ViewingTransform
TimeseriesSource
Description
Return start and stop times of time series
data.
Generate patches for body with loaded face,
vertex, and color data.
Get geometry data from source.
Change Aero.Body position and orientation.
Changes body position and orientation
versus time data.
Description
Specify a function that
controls the coordinate
transformation.
Specify name of body.
Specify position of
body.
Specify rotation of
body.
Specify geometry of
body.
Specify patch
generation function.
Specify patch handles.MATLAB array
Specify viewing
transform.
Specify time series
source.
Values
string
MATLAB array
MATLAB array
handle
MATLAB array
MATLAB array
MATLAB array
4-11
Aero.Body
Property
TimeseriesSourceType
Description
Specify the type of time
series data stored in
'TimeseriesSource'.
Values
string
Five values are
available. They are
listed in the following
table. The default
TimeseriesReadFcn
value is
Specify time series
'Array6DoF'.
MATLAB array
read function.
Thetimeseriesdata,storedintheproperty'TimeseriesSource',is
interpreted according to the
'TimeseriesSourceType' property, which
can be one of:
'Timeseries'
MATLAB time series data with six
values per time:
lat lon alt phi theta psi
The values are resampled.
'StructureWithTime'
Simulink struct with time (for
example, Simulink root outport
logging
'Structure with time'):
4-12
•
signals(1).values:lat lon
alt
• signals(2).values:phi theta
psi
Signals are linearly interpolated vs.
time using
interp1.
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.