19#include <Physics/smVec3r.h>
22#include <matrix/vltaitbryan.h>
24#include <vrfobjcore/localObject.h>
29 class DtVrfObjectStateRepository;
30class DtSimulationServices;
32class DtSetDataRequest;
51#define GEODETIC_TO_LOCAL(geo, local) simulationServices()->physicalWorld()->geodeticToDatabase((geo), (local))
59#define LOCAL_TO_GEODETIC(local, geo) simulationServices()->physicalWorld()->databaseToGeodetic((local), (geo));
65#if RTD_VRF_PLUGIN_VER >= 440
66 #define VRF_OBJECT_GET_NAME markingText
68 #define VRF_OBJECT_GET_NAME objectName
77#define GET_EXT_ENTITY_NAME(entity) ("'" + (entity)->getMarkingText() + "'" + " (" + (entity)->getName() + ')')
85#define GET_EXT_VRF_OBJ_NAME(object) \
86 ("'" + (object)->markingText().stdString() + "'" + " (" + (object)->uuid().uuidString().stdString() + ')')
125 DtSimResource& fuelResource, RTD::CGFVehicleBase& rtdVehicle,
bool fuelLevelsFrozen);
135 void reset(RTD::CGFVehicleBase& rtdVehicle);
238 DtPhysicalWorld* physicalWorld,
const DtVector& localPosition,
const DtTaitBryan& topographicOrientation);
257 DtPhysicalWorld* physicalWorld,
const DtVector& localPosition,
const DtTaitBryan& localOrientation);
313void applyWind(DtPhysicalWorld* physicalWorld, RTD::VehicleBase* vehicle);
321void applyWind(RTD::VehicleBase* vehicle,
double vrfWindDir,
double vrfWindSpeed);
329#define RTDHeadingToVrfHeading(hdgInDeg) (-hdgInDeg)
337#define VrfHeadingToRTDHeading(hdgInDeg) (-hdgInDeg)
342#define toDtVector(v) DtVector((v)[0], (v)[1], (v)[2])
347#define toSmVec3r(v) smVec3r((v)[0], (v)[1], (v)[2])
352#define toSmVec2r(v) smVec2r((v)[0], (v)[1])
357#define toSmVec3d(v) smVec3d((v)[0], (v)[1], (v)[2])
362#define toSmVec2d(v) smVec2d((v)[0], (v)[1])
367#define toRTDLLA(geodeticCoord) \
368 smVec3r(smMath::radToDeg(geodeticCoord[0]), smMath::radToDeg(geodeticCoord[1]), geodeticCoord[2])
373#define toRTDLL(geodeticCoord) smVec2r(smMath::radToDeg(geodeticCoord[0]), smMath::radToDeg(geodeticCoord[1]))
378#define toGeodetic(lla) DtGeodeticCoord(smMath::degToRad(lla[0]), smMath::degToRad(lla[1]), lla[2])
406double getHAT(
const DtSimulationServices* simMan,
const DtGeodeticCoord& pos);
437#define RTD_CHECK_CONSWARN_RETURN(expression, complaint) \
440 objectConsoleWarn() << (complaint) << std::endl; \
450#define RTD_CHECK_DTWARN_RETURN(expression, complaint) \
453 DtWarn(complaint "\n"); \
464#define RTD_CHECK_CONSWARN_RETURN2(expression, complaint, retVal) \
467 objectConsoleWarn() << (complaint) << std::endl; \
478#define RTD_CHECK_DTWARN_RETURN2(expression, complaint, retVal) \
481 DtWarn(complaint "\n"); \
bool isFuelCapacityValid(double fuelCapacity)
void updateFuelConsumptionFactor(RTD::CGFVehicleBase &rtdVehicle, bool fuelLevelsFrozen)
double myRtdFuelCapacity
Usable RTD fuel capacity determined at the current control handoff, in kilograms.
Definition vreRtdUtil.h:149
double myFuelConsumptionFactor
RTD fuel-consumption factor saved before freezing fuel use.
Definition vreRtdUtil.h:152
bool setRtdFuelFromResource(DtSimResource &fuelResource, RTD::CGFVehicleBase &rtdVehicle)
bool doesFuelAmountDiffer(double fuelAmount) const
static constexpr double fuelDensityKgPerLiter()
Returns the jet-fuel conversion factor used by the VR-Forces aircraft models.
Definition vreRtdUtil.h:106
double myLastSynchronizedFuelAmount
Resource amount last written by the synchronizer.
Definition vreRtdUtil.h:146
RtdFuelSynchronizer()
Constructs a fuel synchronizer with no prior resource state.
bool isFuelAmountValid(double fuelAmount)
void reset(RTD::CGFVehicleBase &rtdVehicle)
Forgets the last synchronized resource amount.
void synchronize(DtSimResource &fuelResource, RTD::CGFVehicleBase &rtdVehicle, bool fuelLevelsFrozen)
Synchronizes RTD vehicle fuel with a VR-Forces fuel resource.
bool myFuelSynchronizationErrorReported
Prevents repeated warnings for a persistent invalid fuel amount.
Definition vreRtdUtil.h:158
bool setResourceFuelFromRtd(DtSimResource &fuelResource, RTD::CGFVehicleBase &rtdVehicle)
bool myFuelLevelsFrozen
True while RTD fuel consumption is disabled for frozen fuel levels.
Definition vreRtdUtil.h:155
Forward declarations for the FixedWingLibCGF namespace.
Definition vreFwlActuator.h:32
RTD namespace forward declarations.
Definition vreRtdUtil.h:36
Forward declarations for the RotorLibCGF namespace.
Definition vreRlActuator.h:37
Definition vreRtdConfigFileReader.h:18
DtTaitBryan TopoToLocalWrtDatabase(DtPhysicalWorld *physicalWorld, const DtVector &localPosition, const DtTaitBryan &topographicOrientation)
Converts topographic orientation to local orientation.
bool computeTerrainHeight(const DtSimulationServices *simMan, const DtVector &localPosition, double &result)
Computes the terrain height at a specified local position.
void applyAltitudeLimit(RTD::VehicleBase *vehicle, const smReal &maxAltitude)
Applies an altitude limit to a vehicle.
smVec3r VRFWorldOriToRTDWorldHPR(const DtTaitBryan &ori)
Converts airplane world orientation from VRF to RTD HPR.
void applySpeedLimit(RTD::VehicleBase *vehicle, const smReal &maxSpeed)
Applies a speed limit to a vehicle.
DtTaitBryan LocalWrtDatabaseToTopo(DtPhysicalWorld *physicalWorld, const DtVector &localPosition, const DtTaitBryan &localOrientation)
Converts local orientation to topographic orientation.
DtTaitBryan RTDWorldHprToVRFWorldOri(const smVec3r &hpr)
Converts airplane world orientation from RTD HPR to VRF.
smVec3r getHeadingAlignedSpeedVector(const smVec3r &hpr, smReal speed, bool xyOnly=false)
Gets the heading-aligned speed vector.
smReal compute2DDist(const smVec3r &pnt1, const DtVector &pnt2)
Computes the 2D distance between two points.
smVec3r VRFOriToRTDHPR(const DtTaitBryan &ori)
Converts from a VRF/DtTaitBryan orientation to RTD/HPR.
void applyWind(DtPhysicalWorld *physicalWorld, RTD::VehicleBase *vehicle)
Applies wind to a vehicle.
double getTerrainHeight(const DtSimulationServices *simMan, const DtVector &localPosition)
Gets the terrain height at a specified local position.
DtVector getVecMatchingDirection(DtPhysicalWorld *physicalWorld, DtVrfObjectStateRepository *sr, DtReal vecMagnitude)
Gets a vector matching the direction of an entity.
DtTaitBryan HprToVRFOri(const smVec3r &hpr)
Converts from an RTD/HPR orientation to VRF/DtTaitBryan.
smVec3r VRFRotVelToRTDRotVelWCS(const DtTaitBryan &entityWorldOrientation, const DtVector &rotationalVelocity)
Converts rotational velocity from VRF to RTD world coordinate system.
void setDeadreckoningThresholds(DtLocalObject *entity, double transThreshold, double rotationThreshold)
Utility functions for VREngage Real-Time Dynamics (RTD) components.
double getHAT(const DtSimulationServices *simMan, const DtGeodeticCoord &pos)
Gets the height above terrain (HAT) for a geodetic position.
DtVector RTDRotVelWCSToVRFRotVel(const DtTaitBryan &entityWorldOrientation, const smVec3r &rotationalVelocity)
Converts rotational velocity from RTD to VRF coordinate system.
RTDVRFConfigWarnsForExternalIncludes() class DtVrfObjectStateRepository