VR-Vantage
Loading...
Searching...
No Matches
exampleGimbalPlugin

Overview

Create a simulated gimbaled camera and attached an observer to it.

Expected Result

Gimbal Plugin Result

Example details

DtGimbalDriver looks for the UAV element created by DtExampleDriver and implements a gimbal attached to that plane at a specified offset. It shows how to use the DtGeoReference class to position and orient the gimbal using the plane's position and orientation; and how to find azimuth and elevation angles to a target in the gimbal's local coordinate system. It attaches the observer named "Observer 1" to the gimbal, and uses the azimuth and elevation angles determined to lock the observer onto the target location.

The example also creates a sensor overlay based on the overlay used with the VR-Forces Sensor Field Of View overlay. It shows how to create and update the display. It also demonstrates the mechanism for changing one of the overlay section creators (in this case, the compass display).

Building the Example

VR-Vantage includes pre-built versions of the example plug-in. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.

Running the Example

This example is a plug-in. You can run it by running ./bin64/exampleGimbalPlugin_stealth.bat or ./bin64/exampleGimbalPlugin_stealth.sh (on Linux). For more information about running examples, please see Running Applications and Examples.

Example Source Files

DtGimbalDriver.h

/*****************************************************************************
* Copyright (c) 2024 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#pragma once
#include <string>
namespace makVrv
{
class DtGeoReference;
class DtSceneObjectAgent;
class DtSceneObject;
}
class DtGeodeticCoord;
{
public:
DtGimbalDriver() = delete;
virtual ~DtGimbalDriver();
virtual const std::string& className() const;
protected:
virtual bool onStart();
virtual bool onStop();
virtual bool onTick();
virtual void attachObserverToEntity(const std::string& observerName, const std::string& entityName );
virtual void slot_displayEngineAdded( const makVrv::DtDeRecord& igRecord );
virtual bool initialize();
protected:
DtGeodeticCoord* myTargetLocation;
};
Contains makVrv:DtDriver class.
Base class to provide boost signal/slot management.
Definition DtGimbalDriver.h:39
makVrv::DtSceneObjectAgent * myGimbalSceneObjectAgent
Definition DtGimbalDriver.h:111
makVrv::DtSceneObject * myPlaneSceneObject
Definition DtGimbalDriver.h:112
virtual void slot_displayEngineAdded(const makVrv::DtDeRecord &igRecord)
virtual void slot_coordinateSystemChanged()
makVrv::DtGeoReference * myGimbalGeoRef
Definition DtGimbalDriver.h:110
virtual const std::string & className() const
DtGeodeticCoord * myTargetLocation
Definition DtGimbalDriver.h:115
makVrv::DtElementID myGimbalId
Definition DtGimbalDriver.h:113
virtual bool onTick()
makVrv::DtGeoReference * myPlaneGeoRef
Definition DtGimbalDriver.h:109
makVrv::DtSignalConnectionManager mySignalConnections
Definition DtGimbalDriver.h:114
virtual bool onStart()
virtual ~DtGimbalDriver()
Virtual DTOR.
makVrv::DtElementID myPlaneElementId
Definition DtGimbalDriver.h:116
DtGimbalSensorOverlay * myGimbalSensorOverlay
Definition DtGimbalDriver.h:118
virtual void attachObserverToEntity(const std::string &observerName, const std::string &entityName)
DtGimbalDriver()=delete
Unimplemented CTOR to prevent auto-creation.
virtual bool initialize()
virtual bool onStop()
DtGimbalSensorOverlay is a wrapper around the two primary classes used to create a DtSensorViewOverla...
Definition DtGimbalSensorOverlay.h:34
The DtAgentManager manages the distributed scene object framework. This includes the objects and upda...
Definition DtAgentManager.h:39
A Record of an IG instance.
Definition DtDeRecord.h:25
The DtDriver is an abstract class. Developers derive from this to create logic that "directs" things ...
Definition DtDriver.h:32
Definition DtGeoReference.h:29
Agent class for the scene object class: DtSceneObject.
Definition DtSceneObjectAgent.hpp:32
A DtSceneObject represents an object that can be positioned in the scene by (possibly) attaching it t...
Definition DtSceneObject.h:45
Class to manage disconnection of boost connections on deletion.
Definition DtSignalConnectionManager.h:21
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
DtUniqueID DtElementID
Definition DtUniqueID.h:23

DtGimbalDriver.cxx

/*****************************************************************************
* Copyright (c) 2024 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#include "DtGimbalDriver.h"
#include <vrvCore/DtDe.h>
#include <vlutil/vlUtil.h>
// Use the VR-Vantage namespace.
// All classes in VR-Vantage are in this namespace.
using namespace makVrv;
// Tower Roof Location on GroundDB-II
const double DtTargetLatitude = DtDeg2Rad( -0.00542 );
const double DtTargetLongitude = DtDeg2Rad( -0.00168 );
const double DtTargetAltitude = 25.00;
// Gimbal position on attached-to platform
const double DtGimbalForwardOffset = 2.0;
const double DtGimbalDownOffset = 2.5;
const double DtGimbalRightOffset = 0.;
// Window/channel to control (and draw the sensor overlay on)
const std::string DtWindowName = "Window 1";
const std::string DtChannelName = "Channel 1";
// Platform Entity Name; this is the correct name when using exampleDriverPlugin (when
// 'SIM_IS_SHIP' is not defined). If using exampleDriver instead, change to "Entity From Facade"
const std::string DtPlatformName = "UAV 1";
// Gimbal Entity Name
const std::string DtGimbalName = "Gimbal";
// Observer attached to the Gimbal entity. Note that this is the observer currently attached
// to the window/channel named above (it could be looked up from the window/channel names,
// but keeping the example simple)
const std::string DtObserverName = "Observer 1";
// String placed in the 'tracking mode' slot of the sensor overlay
const std::string DtSensorOverlayInfoString = "Example Gimbal";
: makVrv::DtDriver( am, "DtGimbalDriver" )
, myPlaneGeoRef(nullptr)
, myGimbalGeoRef(nullptr)
, myGimbalSceneObjectAgent(nullptr)
, myTargetLocation(nullptr)
, myPlaneSceneObject(nullptr)
, myGimbalId( 0 )
, myGimbalSensorOverlay( nullptr )
{
myTargetLocation = new DtGeodeticCoord( DtTargetLatitude, DtTargetLongitude, DtTargetAltitude,
myAgentManager.de().sharedState().coordinateSystem().referenceEllipsoid() );
mySignalConnections += DtDeSharedStateSignaler::instance( myAgentManager.de() )
.signal_coordinateSystemChanged.connect( boost::bind(
}
{
{
}
DtDELETE( myPlaneGeoRef );
DtDELETE( myGimbalGeoRef );
DtDELETE( myTargetLocation );
}
{
DtDELETE( myTargetLocation );
myTargetLocation = new DtGeodeticCoord( DtTargetLatitude, DtTargetLongitude, DtTargetAltitude,
}
const std::string& DtGimbalDriver::className() const
{
static std::string name = "DtGimbalDriver";
return name;
}
{
DtDe& de = myAgentManager.de();
// look up the plane from exampleDriver (or exampleDriverPlugin)
// It has display name <DtPlatformName>
bool found = false;
// Iterate through all the elements
DtElementData& elemData = de.dataBank().elementData();
DtElementData::ElementEntryMap::const_iterator curIter = elemData.elements().begin();
DtElementData::ElementEntryMap::const_iterator endIter = elemData.elements().end();
for( ; curIter != endIter; ++curIter )
{
std::string entityName;
if (elemData.attributeManager().getElementDisplayName(curIter->first, entityName) && entityName == DtPlatformName)
{
// Found it. Look up the scene object id used to visualize this element
// in the 3D model set. We can use that scene object to get the position
// and orientation of the plane
myPlaneElementId = curIter->first;
DtElementData::SceneObjectIdList sceneObjectIds;
elemData.getSceneObjectIds(myPlaneElementId, sceneObjectIds, DtModelSetId::Models3D );
// getSceneObjectIds() can return multiple scene object ids if multiple model sets
// are specified. Since we only asked for the 3D model set scene object,
// sceneObjectIds.size() should be 1.
// It *should* be one, but because ExampleDriverPlugin DtExampleSimEngine::init
// adds a hatlinefacade to the element there are two scene objects on the element
if ( sceneObjectIds.size() == 2 )
{
DtAgentUpdateResolverInterface* updater = agentManager().findUpdater( sceneObjectIds.front() );
if(updater)
{
myPlaneSceneObject = updater->castObjectTypeFromUpdater<DtSceneObject>("DtSceneObject");
found = true;
}
}
}
}
// If we didn't find it, assume it hasn't been created yet. Return false, and we'll
// try again next tick
if (! found )
{
return false;
}
// We have the plane's scene object. Now we can create GeoReferences for the
// plane and the Gimbal
myPlaneGeoRef = new DtGeoReference( de.sharedState().coordinateSystem() );
myGimbalGeoRef = new DtGeoReference( de.sharedState().coordinateSystem() );
// We create a scene object (and associate it with an element) for the Gimbal so that
// our observer can be attached to it. When an observer is attached to an element in
// Mimic mode, it effectively uses that element's coordinate system; so attaching to
// this Gimbal gives us an observer in Gimbal coordinates. Note that no models are
// added to the scene object, so this element will be invisible (but if you had a 3D
// gimbal model you could create and add it here
myGimbalSceneObjectAgent = DtSceneObjectAgent::create( myAgentManager );
myGimbalSceneObjectAgent->setModelSet( DtModelSetId::Models3D );
// Set up the element
myGimbalId = myAgentManager.createNewUniqueId();
reportElementCreated( myGimbalId, 0, DtElementEntry::Entity );
// Give the element a name that we can use to attach to it
DtElementAttributeDriverType* driverType = new DtElementAttributeDriverType( "Gimbal Driver");
// Now set up the sensor overlay
myGimbalSensorOverlay = new DtGimbalSensorOverlay(de);
// Sensor View Data - only needs to be set once
// Used only for getting data, e.g. heading/location of the sensor platform, for most of the sensor view overlay
// Only needs to be set once
myGimbalSensorOverlay->fovData().setHostId(myPlaneElementId);
// Used only for rendering informational text and does not have an impact on the channel or observer
// Only needs to be set once
myGimbalSensorOverlay->fovData().setTrackingMode(DtSensorOverlayInfoString);
// Used for determining how to size certain visuals in the overlay
// Only needs to be set once
myGimbalSensorOverlay->fovData().setXHalfAngle(0.33);
myGimbalSensorOverlay->fovData().setYHalfAngle(0.587);
// These are for determining the range to use for the elevation tape on the left side of the sensor view overlay
// Only needs to be set once
myGimbalSensorOverlay->fovData().setMinimumElevationAngle(-M_PI);
myGimbalSensorOverlay->fovData().setMaximumElevationAngle(M_PI);
// Used for determining how to size certain visuals in the overlay and for simulating the sensor's maximum zoom level.
// Only needs to be set once
myGimbalSensorOverlay->fovData().setMaximumZoomLevel(200000.0);
return true;
}
{
return true;
}
{
return true;
}
{
if ( myGimbalSceneObjectAgent == nullptr)
{
if ( ! initialize() )
{
// Everything needed to initialize hasn't been discovered yet. This is not a failure, it just
// means we need to wait.
return true;
}
// The plane was found. Attach to it.
attachObserverToEntity( DtObserverName, DtGimbalName );
if (myGimbalSensorOverlay != nullptr)
{
myGimbalSensorOverlay->initialize(DtObserverName, DtWindowName, DtChannelName);
}
}
// Set up a GeoRef for the plane. We use this to find the Gimbal position
// and orientation for the Gimbal scene object (and Gimbal GeoRef)
DtVector planePosition;
DtTaitBryan planeOrientation;
// Drivers are ticked early in the frame. Entities are dead-reckoned later.
// So at this point, we only have the position and orientation of where the entity
// was last frame, not necessarily where it will be this frame. However, we can
// directly request that it update NOW rather than when all the other entities
// update.
DtSceneObjectUpdater* updater = myPlaneSceneObject->findUpdater();
if (updater)
{
if (updater->lastUpdateTime() < myAgentManager.de().simulationTime())
{
updater->update(myAgentManager.de().simulationTime());
}
}
// Now we can get the entity's position and orientation for this frame.
myPlaneSceneObject->getPosition( 0, planePosition );
myPlaneSceneObject->getTopographicOrientation( 0, planeOrientation );
myPlaneGeoRef->setLocationAndOrientation( DtLocalToGeodetic( planePosition,
myAgentManager.de().sharedState().coordinateSystem() ), planeOrientation );
// Find the position and orientation of the gimbal in geodetic coordinates, using
// the GeoRef placed above;
DtGeodeticCoord gimbalGeod;
DtTaitBryan gimbalOri;
myPlaneGeoRef->topoToGeodetic(
DtVector( DtGimbalForwardOffset, DtGimbalRightOffset, DtGimbalDownOffset),
DtTaitBryan(0., 0., 0.),
gimbalGeod, gimbalOri );
// The gimbal's georef is now positioned and oriented with the UAV. But we want to point the gimbal
// at the target (without any roll component) so starting with a 'level' gimbal will make that easier.
gimbalOri = DtTaitBryan(0.0, 0.0, 0.0);
// Set up the GeoRef for our Gimbal
myGimbalGeoRef->setLocationAndOrientation( gimbalGeod, gimbalOri );
// Position our gimbal scene object (this is what the observer is attached to)
myGimbalSceneObjectAgent->setPosition( 0, DtGeodeticToLocal( gimbalGeod,
myAgentManager.de().sharedState().coordinateSystem() ) );
// Get tower location in gimbal's topocentric system. (We don't need the tower's orientation)
DtVector targetTopo;
DtTaitBryan unused( 0., 0., 0. );
myGimbalGeoRef->geodeticToTopo( *myTargetLocation, unused, targetTopo, unused );
// find azimuth and elevation angles to our target
double azimuthAngle = atan2( targetTopo[1], targetTopo[0] );
double xyPlaneDistance = sqrt( targetTopo[0] * targetTopo[0] + targetTopo[1] * targetTopo[1] );
double elevationAngle = DtDeg2Rad( 90. ) - atan2( xyPlaneDistance, -targetTopo[2] );
// Set the gimbal scene object to point at the target
myGimbalSceneObjectAgent->setTopographicOrientation(0, DtTaitBryan(azimuthAngle, elevationAngle, 0.));
// Finally, update the sensor overlay
if (myGimbalSensorOverlay != nullptr)
{
myGimbalSensorOverlay->setPlatformTopoOrientation(planeOrientation.psi());
myGimbalSensorOverlay->setGimbalOrientation(azimuthAngle);
}
return true;
}
void DtGimbalDriver::attachObserverToEntity(const std::string& observerName, const std::string& entityName )
{
DtObserver* observer = myAgentManager.de().driverManager().inputDriver().findObserverByName(observerName);
if ( observer )
{
// Start by getting the existing observer state record for this observer.
// We can modify it and then set it back. We use the observer record
// mechanism because it will allow the observer to attach even if the
// plane hasn't been created yet (the observer will retry attaching when
// an observer record is used until the attach succeeds
makArchives::DtObserverStateRecord observerState;
observer->getRecord( observerState );
// Attach to the plane
std::set<std::string> displayNames;
displayNames.insert( entityName );
observerState.setAttachedToDisplayNames( displayNames );
// We want no offset
observerState.setObserverOffsetVector( 0., 0., 0. );
observerState.setObserverRotationOffset(0., 0., 0., 1.);
// Get the observer settings record associated with this observer state record
// so we can force the attach type to mimic
makArchives::DtObserverSettingsRecord settingsRec = observerState.observerSettingsRecord();
// Add the modified settings record back to the observer state record
observerState.setObserverSettingsRecord( settingsRec );
// Set a view magnification
observerState.setViewMagnification( 100. );
// ... and then add the observer state to the observer
observer->setFromRecord( observerState );
}
}
{
stop();
start();
}
Contains makVrv:DtAgentManager class.
Contains makVrv::DtDataBank class.
Contains makVrv::DtDe class.
Contains makVrv::DtDeSharedState class.
Contains makVrv::DtDeSharedStateSignaler class.
Contains makVrv:DtMasterScene class.
Contains the DtElementAttributeManager class declaration.
Contains makVrv::DtElementData class.
Contains makVrv::DtGeoReference class.
Contains the DtGimbalDriver class declaration.
Contains the DtGimbalSensorOverlay class declaration.
Contains makVrv::DtInputDriver class.
Contains makVrv::DtObserver class.
Contains vrvCore::DtObserverMode class.
Contains makVrv::DtScene class.
Contains makVrv::DtSceneObject class.
Contains the declaration for makVrv::DtSceneObjectUpdater.
@ AttachTypeMimic
Definition DtObserverSettingsRecord.h:27
void setAttachType(AttachType type)
void setViewMagnification(double magnification)
Set magnification given to all 3D cameras controlled by this observer.
void setObserverSettingsRecord(const DtObserverSettingsRecord &rec)
Set observer settings from another DtObserverSettingsRecord.
void setAttachedToDisplayNames(const std::set< std::string > &displayNames)
Set names display for attached components.
const DtObserverSettingsRecord & observerSettingsRecord() const
Retrieve the observer settings from the observer state.
void setObserverRotationOffset(double x, double y, double z, double w)
Save the offset rotation from the attachment point.
void setObserverOffsetVector(double x, double y, double z)
Save the offset position from the attachment point.
DtDe & de()
Get the scene manager's Ig object.
Definition DtAgentManager.h:107
virtual DtAgentUpdateResolverInterface * findUpdater(DtUniqueID id)
Find the update handler for a particular object id.
ObjectType * castObjectTypeFromUpdater(const std::string &className)
Attempt to cast an object from an updater using the className. It is vital that the class name is the...
Definition DtAgentUpdateResolverInterface.h:35
static const DtReferenceEllipsoid * referenceEllipsoid()
Return the (static) reference ellipsoid, suitable for use with DtGeodeticCoord.
DtElementData & elementData()
Get element data. DtElementData contains data that is common to all VR-Vantage elements,...
virtual DtDataBank & dataBank()
The DtDataBank accessor.
virtual DtDeSharedState & sharedState()
Returns the DtDeSharedState object.
const DtCoordinateSystem & coordinateSystem() const
Get the coordinate system.
static DtDeSharedStateSignaler & instance(DtDe &de)
Get an instance used to emit, or to connect.
DtAgentManager & myAgentManager
Definition DtDriver.h:190
void reportElementCreated(DtElementID id, DtElementID parentId, DtElementEntry::ElementType type)
Report an element created.
void start()
Start the driver. Called by the Master Scene. Calls installAccessories().
void stop()
Stop the driver. Called by the Master Scene. Calls uninstallAccessories().
DtAgentManager & agentManager()
Get the master scene for this host. Do not create drivers using this agentManager,...
void reportElementDestroyed(DtElementID id)
Report an element destroyed.
void reportElementAttribute(DtElementID id, DtElementAttribute *attribute)
Report an element attribute changed.
virtual bool getElementDisplayName(DtElementID elementId, std::string &value) const
Optional Attributes.
virtual void getSceneObjectIds(const DtElementID &elementID, SceneObjectIdList &outputList, DtModelSetId modelSet=DtModelSetId::Unspecified) const
Get the scene object ID from the specified modelset that is associated with an element ID (or all sce...
const ElementEntryMap & elements() const
Get the element map.
virtual const DtElementAttributeManager & attributeManager() const
Get a const reference to the.
bool getRecord(makArchives::DtObserverStateRecord &recOut) const
Returns true if recOut was filled with all the state of this object.
void setFromRecord(const makArchives::DtObserverStateRecord &rec)
Fill out this object's state from the record.
virtual DtTime lastUpdateTime() const
virtual void update(DtTime tNow)
Contains additional coordinate system related utilities.
T atan2(const T v0, const T v1)
Definition exprtk.hpp:1472
DT_DLL_VRVUTIL DtGeodeticCoord DtLocalToGeodetic(const DtVector &localLocation, const DtCoordinateSystem &coordSystem)
Convert between local and geodetic locations.
DtUniqueElementAttribute< std::string, DtElementAttributes::DisplayName > DtElementAttributeDisplayName
Definition DtElementAttributes.h:88
DT_DLL_VRVUTIL DtVector DtGeodeticToLocal(const DtGeodeticCoord &geodeticLocation, const DtCoordinateSystem &coordSystem)
DtUniqueElementAttribute< std::string, DtElementAttributes::DriverType > DtElementAttributeDriverType
Definition DtElementAttributes.h:118

DtGimbalSensorOverlay.h

/*****************************************************************************
* Copyright (c) 2024 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#pragma once
namespace makVrv
{
class DtOsgSensorViewCompassOverlaySection;
class DtObserver;
}
{
public:
virtual void initialize(const std::string& observerName, const std::string& windowName, const std::string& channelName);
virtual void update();
virtual void setPlatformTopoOrientation(double ori);
virtual void setGimbalOrientation(double ori);
protected:
std::string myObserverName;
};
Contains makVrv::DtSensorFieldOfViewData class.
Contains makVrv::DtVirtualBaseClass class.
DtGimbalCompassOverlaySection extends DtOsgSensorViewCompassOverlaySection so that it can override it...
Definition DtGimbalCompassOverlaySection.h:30
virtual ~DtGimbalSensorOverlay()
Virtual DTOR.
DtGimbalCompassOverlaySection * mySensorViewCompassOverlaySection
Definition DtGimbalSensorOverlay.h:66
makVrv::DtDe & myDe
Definition DtGimbalSensorOverlay.h:61
DtGimbalSensorOverlay()=delete
Deleted default constructor.
virtual void setPlatformTopoOrientation(double ori)
Pass the current topocentric platform orientation down to the DtGimbalCompassOverlaySection,...
makVrv::DtSensorFieldOfViewData & fovData()
Return a reference to the DtSensorFieldOfViewData object, which holds the static information about th...
virtual void initialize(const std::string &observerName, const std::string &windowName, const std::string &channelName)
Set up the sensor overlay drawer; look up and cache a pointer to the DtGimbalCompassOverlaySection.
makVrv::DtSensorFieldOfViewData myGimbalSensorViewData
Definition DtGimbalSensorOverlay.h:63
virtual void update()
Set the current zoom level and then call the sensor overlay drawer.
makVrv::DtObserver * myObserver
Definition DtGimbalSensorOverlay.h:65
std::string myObserverName
Definition DtGimbalSensorOverlay.h:64
virtual void setGimbalOrientation(double ori)
Pass the current the topocentric orientation of the gimbal down to the DtGimbalCompassOverlaySection,...
makVrv::DtOsgSensorViewOverlay * mySensorOverlayDrawer
Definition DtGimbalSensorOverlay.h:62
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
A facade for a DtObserverObject.
Definition DtObserver.h:39
DtOsgSensorViewOverlay is responsible for creating and updating the overlay information on a sensor v...
Definition DtOsgSensorViewOverlay.h:36
Definition DtSensorFieldOfViewData.h:24

DtGimbalSensorOverlay.cxx

/*****************************************************************************
* Copyright (c) 2024 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#include <vrvCore/DtDe.h>
#include <vector>
: myGimbalSensorViewData()
, mySensorOverlayDrawer(nullptr)
, mySensorViewCompassOverlaySection(nullptr)
, myObserverName()
, myObserver(nullptr)
, myDe(de)
{
// Register section creators on our own so we can specify our compass overlay creator instead of the default
sectionCreators.push_back(new makVrv::DtOsgSensorViewPitchOverlaySectionCreator);
sectionCreators.push_back(new DtGimbalCompassOverlaySectionCreator);
}
{
}
{
}
void DtGimbalSensorOverlay::initialize(const std::string& observerName, const std::string& windowName, const std::string& channelName)
{
myObserverName = observerName;
{
mySensorOverlayDrawer->initialize(windowName, channelName);
// Once the drawer is created and initialized we can look up / cache a pointer to the DtOsgSensorViewCompassOverlaySection
// which we will use to update the azimuth scale
{
DtWarn << "DtGimbalSensorOverlay::initialize: failed to find DtGimbalCompassOverlaySection" << std::endl;
}
}
}
{
mySensorViewCompassOverlaySection->setPlatformTopoOrientation(ori);
}
{
mySensorViewCompassOverlaySection->setGimbalOrientation(ori);
}
{
myGimbalSensorViewData.setZoomLevel(myObserver->viewMagnification());
}
Contains makVrv:DtDisplay class.
Contains the DtGimbalCompassOverlaySection class declaration.
Contains makVrv::DtOsgChannel class.
Contains makVrv::DtOsgObserverObject class.
Contains makVrv::DtIgView class.
Contains makVrv::DtWindowManager class.
Creator class for an instance of a DtGimbalCompassOverlaySection. An instance of this creator is regi...
Definition DtGimbalCompassOverlaySection.h:70
virtual DtDriverManager & driverManager()
The DtMasterScene accessor. The function will throw before the initialize function is called.
DtInputDriver & inputDriver()
Return the DtInputDriver associated with the master scene.
virtual DtObserver * findObserverByName(const std::string &name)
Find an observer by its name.
static const std::string SectionName
Definition DtOsgSensorViewCompassOverlaySection.h:82
Responsible for creating new DtOsgSensorViewCrossHairOverlaySections.
Definition DtOsgSensorViewCrossHairOverlaySection.h:67
Responsible for creating new DtOsgSensorViewDisplayInfoOverlaySections.
Definition DtOsgSensorViewDisplayInfoOverlaySection.h:67
static void registerInstance(DtDe &de, DtOsgSensorViewOverlaySectionCreators *sectionCreators=0)
Registers this class to be used as the creator for any DtSensorViewOverlays. Optionally allows a list...
virtual void initialize(const std::string &windowName, const std::string &channelName)
Initializes the overlay. Must be called prior to update.
virtual DtOsgSensorViewOverlaySection * findOverlaySection(const std::string &name)
Responsible for creating new DtOsgSensorViewPitchOverlaySections.
Definition DtOsgSensorViewPitchOverlaySection.h:90
Responsible for creating new DtOsgSensorViewPlatformInfoOverlaySections.
Definition DtOsgSensorViewPlatformInfoOverlaySection.h:90
Responsible for creating new DtOsgSensorViewReticleOverlaySections.
Definition DtOsgSensorViewReticleOverlaySection.h:73
Responsible for creating new DtOsgSensorViewTargetInfoOverlaySections.
Definition DtOsgSensorViewTargetInfoOverlaySection.h:85
static DtSensorViewOverlayCreator & instance(DtDe &de)
Check for a creator instance by looking up "DtSensorViewOverlayCreator" in the DtDe....
virtual DtSensorViewOverlay * create(DtDe &de)=0
Creates a DtSensorViewOverlay.
std::list< DtOsgSensorViewOverlaySectionCreator * > DtOsgSensorViewOverlaySectionCreators
Definition DtOsgSensorViewOverlaySection.h:97

DtGimbalCompassOverlaySection.h

DtGimbalCompassOverlaySection.cxx

/*****************************************************************************
* Copyright (c) 2024 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#include <vrvCore/DtDe.h>
#include <matrix/vlMath.h>
, myPlatformOrientation(0.0)
, myGimbalOrientation(0.0)
{
}
{
//Intentional nop
}
{
double azimuthScale = DtRad2Deg(myGimbalOrientation) - DtRad2Deg(myPlatformOrientation);
if (azimuthScale < -180.0)
{
azimuthScale += 360.0;
}
updateAzimuthScale(azimuthScale);
}
{
}
{
}
{
return new DtGimbalCompassOverlaySection(de);
}
{
return new DtGimbalCompassOverlaySectionCreator;
}
virtual makVrv::DtOsgSensorViewOverlaySectionCreator * clone() const override
virtual makVrv::DtOsgSensorViewCompassOverlaySection * create(makVrv::DtDe &de) override
Create an instance of a DtOsgSensorViewCompassOverlaySection.
DtGimbalCompassOverlaySection()=delete
Deleted Default Constructor.
double myGimbalOrientation
Definition DtGimbalCompassOverlaySection.h:61
virtual ~DtGimbalCompassOverlaySection()
Virtual DTOR.
virtual void setPlatformTopoOrientation(double ori)
Set the topocentric orientation of the platform, in radians (0 to 2*PI).
double myPlatformOrientation
Definition DtGimbalCompassOverlaySection.h:60
virtual void update(const makVrv::DtOsgObserverObject &, const makVrv::DtSensorFieldOfViewData &) override
virtual void setGimbalOrientation(double ori)
Set the topocentric orientation of the gimbal, in radians (0 to 2*PI).
This abstract base class defines the interface for OS-specific keyboard and mouse event listeners.
Definition DtOsgObserverObject.h:50
Responsible for displaying the compass and heading display on the sensor view overlay....
Definition DtOsgSensorViewCompassOverlaySection.h:45
virtual void updateAzimuthScale(int relHeading)
virtual void updateNorthIndicator(double cameraHeading)
Takes the (topocentric) heading of the camera, in radians from 0 to 360.
virtual void updateEntityHeading(double entityHeading)
Takes the (topocentric) heading of the platoform entity, in radians fro 0 to 360.
Responsible for creating new DtOsgSensorViewOverlaySections.
Definition DtOsgSensorViewOverlaySection.h:84