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.
#include <vrvCore/DtSceneObjectAgent.hpp>
#include <vlutil/vlUtil.h>
using namespace makVrv;
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";
: 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(
}
{
{
}
}
{
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;
{
if ( sceneObjectIds.size() == 2 )
{
if(updater)
{
found = true;
}
}
}
}
if (! found )
{
return false;
}
myGimbalSceneObjectAgent->setModelSet( DtModelSetId::Models3D );
myGimbalSceneObjectAgent->setElementID(
myGimbalId );
return true;
}
{
return true;
}
{
return true;
}
{
if ( myGimbalSceneObjectAgent == nullptr)
{
{
return true;
}
{
}
}
DtVector planePosition;
DtTaitBryan planeOrientation;
if (updater)
{
{
}
}
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] );
myGimbalSceneObjectAgent->setTopographicOrientation(0, DtTaitBryan(azimuthAngle, elevationAngle, 0.));
{
}
return true;
}
{
if ( observer )
{
std::set<std::string> displayNames;
displayNames.insert( entityName );
}
}
{
}