VR-Link API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
4.9 - Coordinate Views

Table of Contents

DtEntityStateRepository's mutators and inspectors send position and orientation and their derivatives in geocentric coordinates and expect to receive data in geocentric coordinates.

If you want to use a different coordinate system in your application, you can use VR-Link's explicit coordinate conversion routines to convert outgoing data to a geocentric form before setting values in an entity publisher's DtEntityStateRepository, and to convert incoming data obtained from a reflected entity's DtEntityStateRepository from geocentric to the coordinate system of choice. However, there is an easier way.

VR-Link provides several "view" classes that you can create on a DtEntityStateRepository. These views provide access to the data in coordinate systems other than geocentric. After creating the appropriate view, simply use its mutators and inspectors, rather than directly calling the DtEntityStateRepository's functions. The view's functions call down to the DtEntityStateRepository's functions before or after doing the conversions, so that the DtEntityStateRepository always stores geocentric data.

VR-Link has three view classes:

For more information about these coordinate systems, please see 13.3 - Coordinate Conversions.

The DtEntityStateRepository inspector and mutator functions that you can circumvent using views are:

However, since rotationalVelocity() is always specified in body rather than geocentric coordinates, the views' rotationalVelocity() and setRotationalVelocity() functions pass the DtEntityStateRepository values through without any conversion.

4.9.1 Topographic Coordinate Views

The DtTopoView constructor takes a pointer to the DtEntityStateRepository that you will be accessing, and a latitude and longitude (in radians) that define the particular topographic coordinate system you want to work in, for example:

DtEntityPublisher entPub(...);
DtEntityStateRepository* esr = entPub.entityStateRep();
DtTopoView topoView(esr, DtDeg2Rad(36.0), DtDeg2Rad(-121.0));

The following example uses DtTopoView's mutators to set positions and orientations specified with respect to a topographic coordinate system whose origin is at latitude/longitude {36.0, -121.0}.

Note
Topographic Euler angles correspond to heading, pitch and roll.
// Topographic coordinates
topoView.setLocation(DtVector(100.0, 100.0, 0.0));
topoView.setVelocity(DtVector(10.0, 10.0, 0.0));
topoView.setAcceleration(DtVector(1.0, 1.0, 0.0));
// Topographic Euler angles - heading, pitch and roll
topoView.setOrientation(DtTaitBryan(0.0, DtDeg2Rad(10.0), 0.0);
// Rotational velocity is always in body coordinates
topoView.setRotationalVelocity(DtVector(0.0, 0.10, -0.125);

The following example uses a DtTopoView to inspect a remote entity's data in topographic coordinates:

...
DtReflectedEntity* ent = rel.first();
DtTopoView topoView(esr, DtDeg2Rad(36.0), DtDeg2Rad(-121.0));

The final examples uses DtTopoView's inspectors to get positions and orientations specified with respect to the topographic coordinate system.

// Topographic coordinates
DtVector topoLoc = topoView.location();
DtVector topoVel = topoView.velocity();
DtVector topoAccel = topoView.acceleration();
// Topographic Euler angles - heading, pitch and roll
DtTaitBryan topoOrient = topoView.orientation();
// Or choose a matrix representation of orientation
DtDcm bodyToLocal = topoView.bodyToLocal();
// Rotational velocity is always in body coordinates
DtVector angVel = topoView.rotationalVelocity();

4.9.2 UTM Coordinate Views

DtUtmView is a view that lets you work in UTM coordinates. Its constructor takes only a DtEntityStateRepository, but relies on the fact that you have already initialized VR-Link's UTM coordinate system using DtUtmInit. (For more information, please see 13.3 - Coordinate Conversions.) Once you have chosen a particular UTM coordinate system in this way, you can use the inspectors and mutators like you do with DtTopoView.

Locations and their derivatives are in UTM coordinates, and are expressed as DtUtmCoords (defined in utmCoord.h). UTM orientations are treated in the same way as topographic orientations. The three Euler angles represent heading, pitch, and roll, while bodyToLocal() returns a rotation matrix that can rotate a vector from the body frame to a topographic frame centered at the entity's current location. As always, rotational velocity is represented in body coordinates.

4.9.3 Cartesian Coordinate Views

DtCartesianView allows the creation of a view defined by any Cartesian coordinate system. Along with a DtEntityStateRepository, its constructor takes a DtVector, indicating the origin of the new system expressed in geocentric coordinates, and a DtDcm representing a rotation matrix that can rotate a vector from the geocentric frame to the frame we are defining.

Alternatively, you can use the constructor that takes only a DtEntityStateRepository, and initialize the view by passing the two parameters to the setOffset() and setRotation() member functions.

Since DtTopoView inherits its inspectors and mutators from DtCartesianView, the descriptions of these functions in "Topographic Coordinate Views," on page 5-58, applies here, except that Euler angles do not correspond to heading, pitch, and roll when expressed with respect to an arbitrary Cartesian system.

[<< Working with Other Types of Objects] [Home] [Top of Page] [Articulated Parts >>]


Document ID: Generated on Tue Aug 10 00:12:31 EDT 2021 from SVN revision 232765
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)