|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.nps.moves.deadreckoning.DIS_DeadReckoning
public abstract class DIS_DeadReckoning
The root super class for all DIS Dead-Reckoning algorithms. Based on the algrorithms from the IEEE 1278_1-1995_DIS standards found in Annex B.
Final project presentation
Creates an abstract instance of a Dead Reckoning (DR) algorithm, defined by the concrete Dead Reckoning algorithm on the right hand side.
At each PDU update received, call the set function to update the DR algorithm with the most accurance and update information. Expected to receive a new update approx every 5 seconds or so. Each PDU is essentally a restart or reset of the DR state.
The DR wroks off the last good state (origin) and extrapulates out from that point based on the velocity and acceleration parameters from the set function.
The DR algorithm updates 30 times a second. The instantiating entity can get updated DR states at its leasure upto 30 times a second by calling the get function, which returns an array of 6 doubles 3 x location and 3 x orientation. With these 6 parameters the entity can redraw itslef in an updatedloation and orientsation based on its projected path.
DRM notation shall consist of three elements.
5.2.1 Angle representation
5.2.2 Angular Velocity Vector record
5.2.17 Euler Angles record
5.2.33 Vector record
a) Entity Coordinate Vector. Location with respect to a particular entity
shall be specified with respect to three orthogonal axes whose origin shall
be the geometric center of the bounding volume of the entity excluding its
articulated and attached parts (see figure 2). The x-axis extends in the
positive direction out the front of the entity. The y-axis extends in the
positive direction out the right side of the entity as viewed from above,
facing in the direction of the positive x-axis. The z-axis extends in the
positive direction out the bottom of the entity. Each vector component
shall represent meters from the origin (see figure 2).
b) Linear Acceleration Vector. Linear acceleration shall be represented as a
vector with components in either world coordinate system or entity's
coordinate system depending on the value in the Dead Reckoning Algorithm
field. Each vector component shall represent acceleration in meters per
second squared.
c) Linear Velocity Vector. Linear velocity shall be represented as a vector
with three components in either world coordinate system or entity's
coordinate system depending on the value in the Dead Reckoning Algorithm
field. Each vector component shall represent velocity in meters per
second. The format of the Vector record shall be as shown in
table 30. (page 73)
5.2.34 World Coordinates record The format of the World Coordinates record shall be as shown in table
31. (page 73)
The Dead Reckoning parameters captured from each PDU
The Position portion of the algorithms
Ultimately, the PSI (rotation about the y-axis), THETA (rotation about the
z-axis), PHI (rotation about the x-axis) need to be in the range
of 0 - 2PI since the fields are in radians.
The Orientation portion of the algorithms
The angular velocity Magnitude
NOTE - It was mentioned above that the angular velocities are contained in
the Entity State PDU as body axis velocities. However, if the angular
velocities are in terms of the Euler angles, then a transformation to body
axis angular velocities is needed. Thus the following transformation
formulas are given:
Note: the Rotaion formula
where applicable is the same as that used in the Primary Methods Group (1-5),
as well is the equation for getting the
revised orientations.
R1 vector (though I am not sure what its really calculating)
R2 vector (though I am not sure what its really calculating)
An Example:
Reset to 0 with each call to setAll()
the delta between calls...how fast an entity will be updated
Note from Java Doc for JDK:
Each subclass DR algorithm has a no arguments constructor, but all it
does is call the super, i.e. this constructor, which establishes the
Thread
Applies the required DR formula to the initial position and orientation
of this entity and returns the updated locaiton and position.
This function does not actually perform the computations, it only returns
the current state of the entity. The entity state is updated byt the
specified DR alorithm within the DR class behind the scenes. Updates are
crated every 1/30 seconds.
Only returns an array of location and orientation because that
is all that is needed to update the location of the entity. All other
DR inputs are parameters for solving the locaiton and orientation and so
are not returned, only set.
Order of the retruned array elements
Default is 30 but can be changed throught this function call
This ic called by the entity anytime the entity receives an updated
ESPDU for this entity.
This can be the first and initialization call or update.
The folowing (triples) are set with each call:
entityLocation_X = allDis[0];
entityOrientation_psi = (float)allDis[3];
entityLinearVelocity_X = (float)allDis[6];
entityLinearAcceleration_X = (float)allDis[9];
entityAngularVelocity_X = (float)allDis[12];
DR fields from a PDU update or initial
Updates are not included in this call, this is only the state.
Angles shall be specfified as 32-bit floating point numbers expressed
in radians.(page 55)
The angular velocity of simulated entities shall be represented by the Angular
Velocity Vector record. This record shall specify the rate at which an
entity's orientation is changing. The angular velocity shall be measured
in radians per second measured about each of the entity's own
coordinate axes. The record shall consist of three fields. The first field
shall represent velocity about the x-axis, the second about the y-axis, and
the third about the z-axis [see 5.2.33 item a)]. The positive direction of
the angular velocity is defined by the right-hand rule. The format of the
Angular Velocity Vector record shall be shown as in table 5. (Page 55)
Orientation of a simulated entity shall be specified by the Euler Angles
record. This record shall specify three angles as described in figure 3 and
3.1.13. These angles shall be specified with respect to the entity's
coordinate system. The three angles shall each be specified by a 32-bit
floating point number representing radians. The format of the Euler
Angles record shall be as shown in table 19. (page 65)
Vector values for entity coordinates, linear acceleration, and linear
velocity, shall be represented using a Vector record. This record shall
consist of three fields, each a 32-bit floating point number. The unit of
measure represented by these fields shall depend on the information
represented. The values utilizing the Vector record are as follows:
Location of the origin of the entity's coordinate system shall be specified
by a set of three coordinates: X, Y, and Z. The shape of the earth shall be
specified using DMA TR 8350.2, 1987. The origin of the world coordinate
system shall be the centroid of the earth, with the X-axis passing through
the prime meridian at the equator, the Y-axis passing through 90° east
longitude at the equator, and the Z-axis passing through the north pole
(see figure 1). These coordinates shall represent meters from the centroid
of the earth. A 64-bit double precision floating point number shall represent
the location for each coordinate.
The IEEE specified algorithms to compute the DR for Primary
Methods Group (1-5)
= [DR]
ultimately what this is DR equation is doing but with a change of basis
from world to entity coordinates.
The angular velocity Matrix
World to Body Transformation
The IEEE specified algorithms to compute the DR for Secondary
Methods Group (6-9)
import DIS.DeadReconing.*;
public class runTest
{
public static void main(String s[])
{
// create a DeadReconing Entity
DIS_DeadReckoning dr = new DIS_DR_FPW_02();
// make the arrays of location and other parameters
// loc orien lin V Accel Ang V
double[] locOr = {2,3,4, 5,6,1, 1,2,1, 0,0,0, 0,0,0};
// set the parameters
dr.setNewAll(locOr);
// Print out the current state
System.out.println(dr.toString());
System.out.println();
try
{
// wait 1 second
Thread.sleep(1000);
// request an update from the DR algorith
// should be original + 1 full value of other parameters
// new position should be (3, 5, 5)
double[] update = dr.getUpdatedPositionOrientation();
// print the update to the screen
System.out.println(dr.toString());
}
catch(Exception e)
{
System.out.println("Unknow Error...?\n " + e);
}
// terminate with exit to get out of the inf while loop
System.exit(0);
}
}
Resulting Output:
Current State of this Entity:
Entity Location = (2.0, 3.0, 4.0)
Entity Orientation = (5.0, 6.0, 1.0)
Entity Linear Velocity = (1.0, 2.0, 1.0)
Entity Linear Acceleration = (0.0, 0.0, 0.0)
Entity Angular Velocity = (0.0, 0.0, 0.0)
Delta between updates = 0.033333335
Current State of this Entity:
Entity Location = (3.000000052154064, 5.000000104308128, 5.000000052154064)
Entity Orientation = (5.0, 6.0, 1.0)
Entity Linear Velocity = (1.0, 2.0, 1.0)
Entity Linear Acceleration = (0.0, 0.0, 0.0)
Entity Angular Velocity = (0.0, 0.0, 0.0)
Delta between updates = 0.033333335
Field Summary
protected java.lang.Thread
aThread
Thread for the DR algorithm update timing (1/30 second)
protected float
changeDelta
How far to change the location/orientation per update
protected int
deltaCt
How many updates have occured ...
protected float
entityAngularVelocity_X
The X angular velocity 32bit float
protected float
entityAngularVelocity_Y
The Y angular velocity 32bit float
protected float
entityAngularVelocity_Z
The Z angular velocity 32bit float
protected float
entityLinearAcceleration_X
The linear X acceleration 32bit float
protected float
entityLinearAcceleration_Y
The linear Y acceleration 32bit float
protected float
entityLinearAcceleration_Z
The linear Z acceleration 32bit float
protected float
entityLinearVelocity_X
The X linear velocity 32bit float
protected float
entityLinearVelocity_Y
The Y linear velocity 32bit float
protected float
entityLinearVelocity_Z
The Z linear velocity 32bit float
protected double
entityLocation_X
The entity's X coordinate location with double percision 64bit
protected double
entityLocation_Y
The entity's Y coordinate location with double percision 64bit
protected double
entityLocation_Z
The entity's Z coordinate location with double percision 64bit
protected float
entityOrientation_phi
The Z orientation of the entity with 32bit float
protected float
entityOrientation_psi
The X orientation of the entity with 32bit float
protected float
entityOrientation_theta
The Y orientation of the entity with 32bit float
protected float
fps
how may times per second to update this entity's positon
protected long
stall
How long to wait between updates
Constructor Summary
DIS_DeadReckoning()
Constructor for all DR algorithms...
Method Summary
double[]
getUpdatedPositionOrientation()
Gets the revised position and orientation of this entity
void
setFPS(int frames)
Sets the refresh rate for the scene.
void
setNewAll(double[] allDis)
Set the parameters for this entity's DR function based on the most
recent PDU.
java.lang.String
toString()
Pretty print the current state of this Dead Reckoning object
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Runnable
run
Field Detail
entityLocation_X
protected double entityLocation_X
entityLocation_Y
protected double entityLocation_Y
entityLocation_Z
protected double entityLocation_Z
entityOrientation_psi
protected float entityOrientation_psi
entityOrientation_theta
protected float entityOrientation_theta
entityOrientation_phi
protected float entityOrientation_phi
entityLinearVelocity_X
protected float entityLinearVelocity_X
entityLinearVelocity_Y
protected float entityLinearVelocity_Y
entityLinearVelocity_Z
protected float entityLinearVelocity_Z
entityLinearAcceleration_X
protected float entityLinearAcceleration_X
entityLinearAcceleration_Y
protected float entityLinearAcceleration_Y
entityLinearAcceleration_Z
protected float entityLinearAcceleration_Z
entityAngularVelocity_X
protected float entityAngularVelocity_X
entityAngularVelocity_Y
protected float entityAngularVelocity_Y
entityAngularVelocity_Z
protected float entityAngularVelocity_Z
fps
protected float fps
changeDelta
protected float changeDelta
deltaCt
protected int deltaCt
stall
protected long stall
Causes the currently executing thread to sleep (temporarily cease
execution) for the specified number of milliseconds, subject to the
precision and accuracy of system timers and schedulers. The thread does
not lose ownership of any monitors.
aThread
protected java.lang.Thread aThread
Constructor Detail
DIS_DeadReckoning
public DIS_DeadReckoning()
Method Detail
getUpdatedPositionOrientation
public double[] getUpdatedPositionOrientation()
setFPS
public void setFPS(int frames)
frames
- - the number of updats per second to make
setNewAll
public void setNewAll(double[] allDis)
throws java.lang.Exception
entityLocation_Y = allDis[1];
entityLocation_Z = allDis[2];
entityOrientation_theta = (float)allDis[4];
entityOrientation_phi = (float)allDis[5];
entityLinearVelocity_Y = (float)allDis[7];
entityLinearVelocity_Z = (float)allDis[8];
entityLinearAcceleration_Y = (float)allDis[10];
entityLinearAcceleration_Z = (float)allDis[11];
entityAngularVelocity_Y = (float)allDis[13];
entityAngularVelocity_Z = (float)allDis[14];
allDis
- - 15 double percisions representing the above in order of the above
java.lang.Exception
toString
public java.lang.String toString()
toString
in class java.lang.Object
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD