Aero.VirtualRealityAnimation Class
Namespace: Aero
(To be removed) Visualize aerospace animation using virtual reality animation object
Aero.VirtualRealityAnimation
will be removed in a future release.
Description
Aero.VirtualRealityAnimation
objects visualize flight data using a virtual
reality animation object.
The Aero.VirtualRealityAnimation
class is a handle
class.
Class Attributes
GetAccess | public |
SetAccess | private |
Dependent | true |
Transient | true |
Hidden | true |
SetObservable | true |
NonCopyable | true |
For information on class attributes, see Class Attributes.
Creation
Description
h = Aero.VirtualRealityAnimation
constructs a virtual reality
animation object. The animation object is returned to h
.
Properties
Name
— Animation object
''
(default) | character vector | string
Animation object name, specified as a character vector or string.
Attributes:
Transient | true |
SetObservable | true |
Data Types: char
| string
VRWorld
— vrworld
object
[]
(default) | array
vrworld
object associated with the animation object, specified as
an array.
Attributes:
Transient | true |
SetObservable | true |
VRWorldFilename
— vrworld
file name
''
(default) | character vector | string
vrworld
file name, specified as a character vector or
string.
Attributes:
Transient | true |
SetObservable | true |
Data Types: char
| string
VRWorldOldFilename
— Old vrworld
file name
{}
| array
Old vrworld
file name, specified as an array.
Attributes:
Transient | true |
SetObservable | true |
Data Types: char
| string
VRWorldTempFilename
— Temporary vrworld
file name
''
(default) | character vector | string
Temporary vrworld
file name, specified as a character vector or
string.
Attributes:
Transient | true |
SetObservable | true |
Data Types: char
| string
VRFigure
— vrfigure
object
[]
(default) | array
vrfigure
object associated with the animation object, specified
as an array.
Attributes:
Transient | true |
SetObservable | true |
Nodes
— Nodes contained in animation object
{}
(default) | array
Nodes contained in animation object, specified as an array.
Attributes:
Transient | true |
SetObservable | true |
Viewpoints
— Viewpoints contained in animation object
{}
(default) | array
Viewpoints contained in animation object, specified as an array.
Attributes:
Transient | true |
SetObservable | true |
TCurrent
— Current time
0
(default) | scalar
Current time, specified as a scalar, in seconds.
Time source must be a timeseries
or timetable
object.
Attributes:
Transient | true |
SetObservable | true |
Data Types: dobule
ShowSaveWarning
— Save warning display setting
1
(default) | 0
Save warning display setting, specified as a 0
or
1
.
Attributes:
Transient | true |
SetObservable | true |
VideoRecord
— Enable video recording
'off'
(default) | 'on'
| 'scheduled'
Enable video recording, specified as:
'off'
Disable video recording.
'on'
Enable video recording.
'scheduled'
Schedule video recording. Use this property with the VideoTStart and VideoTFinal properties.
Attributes:
Transient | true |
SetObservable | true |
VideoFileName
— Video recording file name
'temp'
(default) | character vector | string
Video recording file name, specified as a character vector or string.
Attributes:
Transient | true |
SetObservable | true |
Data Types: char
| string
VideoCompression
— Video compression file type
'Motion JPEG AVI'
(default) | 'Archival'
| 'Motion JPEG 2000'
| 'MPEG-4'
| 'Uncompressed AVI'
Video recording compression file type, specified as:
'Motion JPEG AVI'
Compressed AVI format file using Motion JPEG codec.
'Archival'
Motion JPEG 2000 format file with lossless compression.
'Motion JPEG 2000'
Compressed Motion JPEG 2000 format file.
'MPEG-4'
Compressed MPEG-4 format file with H.264 encoding (Windows® 7 systems only).
'Uncompressed AVI'
Uncompressed AVI format file with RGB24 video.
For more information on video compression, see VideoWriter
.
Attributes:
Transient | true |
SetObservable | true |
VideoQuality
— Video recording quality
'75'
(default) | between 0
and 100
Video recording quality, specified as a value between 0
and
100
.
Attributes:
Transient | true |
SetObservable | true |
Data Types: double
VideoTFinal
— Video recording stop time
NaN
(default) | value between TStart
and TFinal
Video recording stop time for scheduled recording, specified as a value between
TStart
and TFinal
.
Attributes:
Transient | true |
SetObservable | true |
Data Types: double
TimeScaling
— Time scaling
1
(default) | scalar
Time scaling, specified as a scalar, in seconds.
Attributes:
Transient | true |
SetObservable | true |
Data Types: double
FramesPerSecond
— Frame rate
12
(default) | scalar
Frame rate, specified as a scalar, in frames per second.
Attributes:
Transient | true |
SetObservable | true |
Data Types: double
TStart
— Recording start time
NaN
(default) | scalar
Recording start time, specified as a scalar, in seconds.
Time source must be a timeseries
or timetable
object.
Attributes:
Transient | true |
SetObservable | true |
Data Types: double
TFinal
— Recording stop time
NaN
(default) | scalar
Recording stop time, specified as a scalar, in seconds.
Time source must be a timeseries
or timetable
object.
Attributes:
Transient | true |
SetObservable | true |
Data Types: double
Methods
Public Methods
addNode | (To be removed) Add existing node to current virtual reality world |
addRoute | (To be removed) Add VRML ROUTE statement to virtual reality
animation object |
delete | (To be removed) Destroy virtual reality animation object |
initialize | (To be removed) Create and populate virtual reality animation object |
addViewpoint | (To be removed) Add viewpoint for virtual reality animation |
nodeInfo | (To be removed) Create list of nodes associated with virtual reality animation object |
play | (To be removed) Animate virtual reality world for given position and angle in time series data |
removeNode | (To be removed) Remove node from virtual reality animation object |
removeViewpoint | (To be removed) Remove viewpoint node from virtual reality animation |
saveas | (To be removed) Save virtual reality world associated with virtual reality animation object |
updateNodes | (To be removed) Change virtual reality animation node position and orientation as function of time |
Examples
Record Virtual Reality Animation Object Simulation
This example shows how to
Record the simulation of a virtual reality animation object
Simulate and record flight data
Create an animation object
h = Aero.VirtualRealityAnimation; % Control the frame display rate. h.FramesPerSecond = 10; % Configure the animation object to set the seconds of animation data per % second time scaling (TimeScaling) property. h.TimeScaling = 5; % The combination of FramesPerSecond and TimeScaling property determine the % time step of the simulation. These settings result in a time step of % approximately 0.5 s. % This code sets the .wrl file to use in the virtual reality animation. h.VRWorldFilename = 'asttkoff.wrl'; % Load the animation world described in the 'VRWorldFilename' field of the % animation object. initialize(h); % Set simulation timeseries data. takeoffData.mat contains logged simulated % data. takeoffData is set up as a 'StructureWithTime', which is one of the % default data formats. load takeoffData [~, idxPlane] = find(strcmp('Plane', h.nodeInfo)); h.Nodes{idxPlane}.TimeseriesSource = takeoffData; h.Nodes{idxPlane}.TimeseriesSourceType = 'StructureWithTime'; % Use the example custom function vranimCustomTransform to correctly line % up the position and rotation data with the surrounding objects in the % virtual world. This code sets the coordinate transformation function for % the virtual reality animation. h.Nodes{idxPlane}.CoordTransformFcn = @vranimCustomTransform; % Set up recording properties. h.VideoRecord = 'on'; h.VideoQuality = 50; h.VideoCompression = 'Motion JPEG AVI'; h.VideoFilename = 'astMotion_JPEG_VR'; % Play the animation. play(h); % Wait for the animation to stop running before modifying the object. wait(h); % Verify that a file named astMotion_JPEG_VR.avi was created in the current folder. % Disable recording to preserve the file. h.VideoRecord = 'off';
Record Animation for Four Seconds
Simulate flight data for four seconds.
Use the data to create an animation object.
h = Aero.Animation;
Control the frame display rate.
h.FramesPerSecond = 10;
Configure the animation object to set the seconds of animation data per second time-scaling (TimeScaling
) property.
h.TimeScaling = 5;
The combination of the FramesPerSecond
and TimeScaling
properties determines the time step of the simulation (TimeScaling
/|FramesPerSecond|). These settings result in a time step of approximately 0.5 s.
Create and load a body for the animation object.
idx1 = createBody(h,'pa24-250_orange.ac','Ac3d');
Load simulated flight trajectory data (simdata
).
load simdata;
Set the time series data for the body.
h.Bodies{1}.TimeSeriesSource = simdata;
Create a figure object for the animation object.
show(h);
Set up recording properties.
h.VideoRecord='on'; h.VideoQuality = 50; h.VideoCompression = 'Motion JPEG AVI'; h.VideoFilename = 'astMotion_JPEG';
Play the animation from TStart
to TFinal
.
h.TSTart = 1; h.TFinal = 5; play(h);
Verify that a file named astMotion_JPEG.avi
was created in the current folder. When you rerun the recording, notice that the play time is shorter than that in the previous example when you record for the length of the simulation time.
Wait
Wait for the animation to stop playing before the modifying the object.
wait(h);
Disable recording to preserve the file.
h.VideoRecord = 'off';
Schedule Three Second Recording of Virtual Reality Object Simulation
This example shows how to schedule a three second recording a virtual reality object animation simulation.
% Create an animation object. h = Aero.VirtualRealityAnimation; % Control the frame display rate. h.FramesPerSecond = 10; % Configure the animation object to set the seconds of animation data per % second time scaling (TimeScaling) property. h.TimeScaling = 5; % The combination of FramesPerSecond and TimeScaling properties determines % the time step of the simulation. These settings result in a time step of % approximately 0.5 s. % This code sets the .wrl file to use in the virtual reality animation. h.VRWorldFilename = 'asttkoff.wrl'; % Load the animation world described in the 'VRWorldFilename' field of the % animation object. h.initialize(); % Set simulation timeseries data. takeoffData.mat contains logged % simulated data. takeoffData is set up as a 'StructureWithTime', which is % one of the default data formats. load takeoffData [~, idxPlane] = find(strcmp('Plane', h.nodeInfo)); h.Nodes{idxPlane}.TimeseriesSource = takeoffData; h.Nodes{idxPlane}.TimeseriesSourceType = 'StructureWithTime'; % Use the example custom function vranimCustomTransform to correctly line % up the position and rotation data with the surrounding objects in the % virtual world. This code sets the coordinate transformation function for % the virtual reality animation. h.Nodes{idxPlane}.CoordTransformFcn = @vranimCustomTransform; % Set up recording properties. h.VideoQuality = 50; h.VideoCompression = 'Motion JPEG AVI'; h.VideoFilename = 'astMotion_JPEG'; % Set up simulation time from TFinal to TStart. h.TSTart = 1; h.TFinal = 5; % Set up to record between two and four seconds of the four second % simulation. h.VideoRecord='scheduled'; h.VideoTSTart = 2; h.VideoTFinal = 4; % Play the animation. h.play(); % Wait for the animation to stop running before modifying the object. h.wait(); % Verify that a file named astMotion_JPEG_VR.avi was created in the % current folder. When you rerun the recording, notice that the play time % is faster than when you record for the length of the simulation time. % Disable recording to preserve the file. h.VideoRecord = 'off';
Limitations
The Aero.VirtualRealityAnimation
object is not supported in MATLAB Online.
Version History
Introduced in R2007bR2024b: To be removed
Aero.VirtualRealityAnimation
will be removed in a future release.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)