Create a simulated gimbaled camera and attached an observer to it.
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).
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.
#pragma once
#include <string>
{
class DtGeoReference;
class DtSceneObjectAgent;
class DtSceneObject;
}
class DtGeodeticCoord;
{
public:
virtual const std::string&
className()
const;
protected:
protected:
};
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
makVrv::DtGeoReference * myPlaneGeoRef
Definition DtGimbalDriver.h:109
makVrv::DtSignalConnectionManager mySignalConnections
Definition DtGimbalDriver.h:114
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()
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
#include <vlutil/vlUtil.h>
const double DtTargetLatitude = DtDeg2Rad( -0.00542 );
const double DtTargetLongitude = DtDeg2Rad( -0.00168 );
const double DtTargetAltitude = 25.00;
const double DtGimbalForwardOffset = 2.0;
const double DtGimbalDownOffset = 2.5;
const double DtGimbalRightOffset = 0.;
const std::string DtWindowName = "Window 1";
const std::string DtChannelName = "Channel 1";
const std::string DtPlatformName = "UAV 1";
const std::string DtGimbalName = "Gimbal";
const std::string DtObserverName = "Observer 1";
const std::string DtSensorOverlayInfoString = "Example Gimbal";
, 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() );
.signal_coordinateSystemChanged.connect( boost::bind(
}
{
{
}
}
{
myTargetLocation =
new DtGeodeticCoord( DtTargetLatitude, DtTargetLongitude, DtTargetAltitude,
}
{
static std::string name = "DtGimbalDriver";
return name;
}
{
bool found = false;
DtElementData::ElementEntryMap::const_iterator curIter = elemData.
elements().begin();
DtElementData::ElementEntryMap::const_iterator endIter = elemData.
elements().end();
for( ; curIter != endIter; ++curIter )
{
std::string entityName;
{
DtElementData::SceneObjectIdList sceneObjectIds;
if ( sceneObjectIds.size() == 2 )
{
if(updater)
{
found = true;
}
}
}
}
if (! found )
{
return false;
}
return true;
}
{
return true;
}
{
return true;
}
{
{
{
return true;
}
{
}
}
DtVector planePosition;
DtTaitBryan planeOrientation;
if (updater)
{
{
}
}
myAgentManager.de().sharedState().coordinateSystem() ), planeOrientation );
DtGeodeticCoord gimbalGeod;
DtTaitBryan gimbalOri;
DtVector( DtGimbalForwardOffset, DtGimbalRightOffset, DtGimbalDownOffset),
DtTaitBryan(0., 0., 0.),
gimbalGeod, gimbalOri );
gimbalOri = DtTaitBryan(0.0, 0.0, 0.0);
DtVector targetTopo;
DtTaitBryan unused( 0., 0., 0. );
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] );
{
}
return true;
}
{
DtObserver* observer =
myAgentManager.de().driverManager().inputDriver().findObserverByName(observerName);
if ( observer )
{
makArchives::DtObserverStateRecord observerState;
std::set<std::string> displayNames;
displayNames.insert( entityName );
}
}
{
}
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::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
#include <vector>
: myGimbalSensorViewData()
, mySensorOverlayDrawer(nullptr)
, mySensorViewCompassOverlaySection(nullptr)
, myObserverName()
, myObserver(nullptr)
, myDe(de)
{
}
{
}
{
}
{
{
{
DtWarn << "DtGimbalSensorOverlay::initialize: failed to find DtGimbalCompassOverlaySection" << std::endl;
}
}
}
{
}
{
}
{
}
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.
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 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