Playback Mode
Previous Top Next

Playback Mode
QuatView provides the capability to read a quaternion history file and display the contents of that file.  This playback display capability allows the user to visualize the quaternion components, Euler Angles, DCM components, and object orientation as a function of time.  The quaternion time history file that QuatView reads can be generated by a 6 DOF simulation program or by actual measurements. 
Most 6 DOF simulation programs can provide an output file that contains all of the kinematic results from the simulation including the position, velocity, acceleration, orientation, rotational velocity, and rotational acceleration at each simulated time step.  Certain fields in this output file will contain the four quaternion components and another field will have the time.  QuatView allows the user to specify which fields have the quaternion components and the time.  Note that the time is optional and is only required for real-time playback.  QuatView currently requires that the time, if used, must be in units of seconds.  Support for other time formats can be added in the future if needed. 
Playback Dialog
Pressing the Play link will display the Playback dialog as shown in Figure 13.  This dialog allows the user to enable or disable the player.  It also allows the user to specify the playback file path, the playback file format, the playback speed, and the quaternion format. 
The playback file format options include the field delimiter character and the field index for the first quaternion component.  Note that the field index numbering starts at 1.  The number of header and tail lines in the file can also be specified.  These header and tail lines will be ignored when the file is processed. 
The playback speed can be entered as a frame rate, a frame delay time, or as "real time".  When playing in non real-time mode, the frame rate time is constant.  When playing in real-time mode, the frame rate is a variable that is determined from the time field that is read from the playback file.  So a playback file that is suitable for real-time playback does require a minimum of 5 fields:  four for the quaternion and one for time.  A non-realtime playback file, on the other hand, requires only four fields for the quaternion. 
The Playback dialog has two radio buttons to specify the quaternion format.  The format can be specified as either of the two most common conventions: scalar first or scalar last. 
The Playback dialog also includes two radio buttons for enabling or disabling the player.  Once playback mode has been selected, QuatView will attempt to read the playback file and load the quaternion history into memory.  If this read attempt fails for any reason, then an error message will be displayed and playback mode will be disabled.  If the quaternion file is successfully loaded, then playback mode is enabled and the GUI is ready for player operation. 

graphic
Figure 13.  Playback Dialog

Player Operation
Once playback mode has been enabled, the GUI becomes read-only and is ready to start displaying the quaternion file contents.  This means that no user input is allowed for the Euler angles or the quaternion components since the quaternion input data will come from the playback file.  The conversion tab is also disabled so that no other GUI input can interfere with the playback.  The only user input allowed during playback mode is from the three playback control buttons and the associated trackbar that appear at the bottom of the GUI.  These playback control buttons consist of a Play button, a Pause button, and a Stop button.  An elapsed time display also becomes visible along with a frame counter.  Figure 14 shows how the GUI looks in playback mode. 

graphic
Figure 14.  GUI With Playback Mode Enabled
Playback begins once the Play button is pressed.  During playback the overall progress is shown graphically by the trackbar and the frame counter.  The 3D orientation display gets updated with each playback frame along with all the quaternion, Euler Angle, and DCM displays.  Pressing the Stop button stops the playback and resets the elapsed time counter back to zero.  Pressing the Pause button stops the playback but does not reset the time counter back to zero.  Once paused, any subsequent press of the play button will resume playback from the paused frame.  Note that during playback the elapsed time display will always show the total elapsed time which includes any pause time. 
QuatView keeps track of the timing error during playback, and if this error gets above 50 milliseconds, then the elapsed time display will turn red.  This means one of two things depending on whether the playback is at a constant frame rate or the playback is in real-time.  If the playback is real-time, then a red time display means that the playback time is behind the desired elapsed time.  In this case the player will speed up in an attempt to "catch up" and re-synchronize with real time.  If the player does catch back up to real time, then the display goes back to its normal color.  If the playback is at a constant frame rate, then a red display means that the desired frame delay time was not achieved for that particular frame.  In this case no timing changes are made, and if the next frame delay time is back within the 50 ms error tolerance, then the display color will go back to normal.  So for constant frame rate playback, only individual frames can be in error, whereas for real-time playback it is the cumulative elapsed time that can be in error. 
QuatView is currently limited to maximum a playback speed of 60 Hz which corresponds to a frame time of 0.017 sec.  This limitation is an operating system limitation due to the resolution of the Windows system timer.  Higher playback speeds can be achieved by using the low level Windows multimedia timer which can deliver resolutions as low as 10 microseconds.  This high speed playback capability may be added in the future, if necessary.  However, no matter how low the timer resolution is, if the operating system is not a real-time operating system, then there is no guarantee that a given frame will execute on time. 
The quaternion player also provides an interactive capability that allows the user to select any particular state by manually sliding the trackbar.  With this capability, the user can take control of the player at any time, whether the player is stopped, paused, or playing.  Once the user clicks on the slider control, the player will pause and give control to the user who can then move back and forth between the frames interactively.  The user can then restart the player from this paused state and the player will continue to play at the proper frame rate.  Note that once a real-time playback has been interrupted by the user, it must restart from frame 1.  However, if a constant rate playback gets interrupted then it can restart from the current selected frame. 
In summary, the quaternion player operates in one of three modes: constant rate, real time, or user.  As Figure 14 shows, the current playback mode is displayed in the bottom left corner of the GUI as CONST, REAL, or USER respectively.  Double clicking on this mode indicator will display a dialog box that summarizes all of the playback settings as shown in Figure 15.  The constant and real-time modes are selected using the Playback dialog, while the user mode becomes active any time the user takes control of the player by clicking on or sliding the trackbar. 

graphic
Figure 15.  Playback Information Dialog