VR-Engage  2.3
Loading...
Searching...
No Matches
vreRtdUtil.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreRtdUtil.h
7//! \ingroup vreVrfRtd
8//! \brief Utility functions for VREngage RTD components
9//!
10//! This file provides common utility functions and macros for coordinate
11//! transformations, terrain queries, and other operations used by the VREngage
12//! Real-Time Dynamics (RTD) components. It includes conversions between
13//! VRF (Virtual Reality Forces) and RTD coordinate systems, orientation
14//! transformations, terrain height calculation, and vehicle property modifiers
15//! such as wind, speed limits, and altitude limits.
16
17#pragma once
18
19#include <Physics/smVec3r.h>
20
22#include <matrix/vltaitbryan.h>
23
24#include <vrfobjcore/localObject.h>
25
26#pragma warning(pop)
27
28
29 class DtVrfObjectStateRepository;
30class DtSimulationServices;
31class DtPhysicalWorld;
32class DtSetDataRequest;
33class DtSimResource;
34
35namespace RTD
36{
37class CGFVehicleBase;
38}
39
40namespace FixedWingLibCGF
41{
42class AirplaneBot;
43}
44
45//! \brief Macro to convert geodetic coordinates to local database coordinates
46//! \param geo The geodetic coordinates to convert
47//! \param local The resulting local database coordinates
48//!
49//! Converts geodetic coordinates (latitude, longitude, altitude) to local
50//! database coordinates using the simulation's physical world.
51#define GEODETIC_TO_LOCAL(geo, local) simulationServices()->physicalWorld()->geodeticToDatabase((geo), (local))
52
53//! \brief Macro to convert local database coordinates to geodetic coordinates
54//! \param local The local database coordinates to convert
55//! \param geo The resulting geodetic coordinates
56//!
57//! Converts local database coordinates to geodetic coordinates (latitude, longitude, altitude)
58//! using the simulation's physical world.
59#define LOCAL_TO_GEODETIC(local, geo) simulationServices()->physicalWorld()->databaseToGeodetic((local), (geo));
60
61//! \brief Version-dependent macro for accessing object name properties
62//!
63//! This macro provides version compatibility between different VRF plugin versions.
64//! In version 4.4.0 and later, we use markingText, while in earlier versions we use objectName.
65#if RTD_VRF_PLUGIN_VER >= 440
66 #define VRF_OBJECT_GET_NAME markingText
67#else
68 #define VRF_OBJECT_GET_NAME objectName
69#endif
70
71//! \brief Macro to get a formatted name for an external entity
72//! \param entity Pointer to the entity object
73//! \return A string containing the marking text and name of the entity
74//!
75//! Creates a formatted display name for an external entity that includes both
76//! the marking text (in single quotes) and the entity name (in parentheses).
77#define GET_EXT_ENTITY_NAME(entity) ("'" + (entity)->getMarkingText() + "'" + " (" + (entity)->getName() + ')')
78
79//! \brief Macro to get a formatted name for a VRF object
80//! \param object Pointer to the VRF object
81//! \return A string containing the marking text and UUID of the object
82//!
83//! Creates a formatted display name for a VRF object that includes both
84//! the marking text (in single quotes) and the object's UUID (in parentheses).
85#define GET_EXT_VRF_OBJ_NAME(object) \
86 ("'" + (object)->markingText().stdString() + "'" + " (" + (object)->uuid().uuidString().stdString() + ')')
87
88
89namespace vreRtd
90{
91//! \brief Synchronizes RTD vehicle fuel with a VR-Forces fuel resource.
92//!
93//! RTD maintains fuel mass in kilograms. This class maps the percentage of
94//! usable RTD fuel to the configured VR-Forces resource while an RTD vehicle
95//! is player controlled and detects external resource changes, such as
96//! refueling, that must be applied to RTD.
98{
99public:
100 //! \brief Constructs a fuel synchronizer with no prior resource state.
102
103 //! \brief Returns the jet-fuel conversion factor used by the VR-Forces aircraft models.
104 //!
105 //! \return Fuel density in kilograms per liter.
106 static constexpr double fuelDensityKgPerLiter()
107 {
108 return 0.804;
109 }
110
111 //! \brief Synchronizes RTD vehicle fuel with a VR-Forces fuel resource.
112 //!
113 //! On the first call after reset, determines RTD's usable fuel capacity
114 //! and initializes RTD at the resource's current percentage. Subsequent
115 //! calls copy RTD's remaining fuel percentage into the resource unless an
116 //! external resource change is detected, in which case the resource
117 //! percentage is applied to RTD. Call when RTD assumes control, during
118 //! every RTD-controlled tick, and immediately before RTD relinquishes
119 //! control.
120 //!
121 //! \param fuelResource VR-Forces resource representing aircraft fuel.
122 //! \param rtdVehicle RTD vehicle whose tank will be synchronized.
123 //! \param fuelLevelsFrozen True when fuel consumption must be suspended.
125 DtSimResource& fuelResource, RTD::CGFVehicleBase& rtdVehicle, bool fuelLevelsFrozen);
126
127 //! \brief Forgets the last synchronized resource amount.
128 //!
129 //! Call this after RTD relinquishes control or when the configured fuel
130 //! resource is unavailable. A subsequently available resource will then
131 //! determine RTD's capacity and initialize its fuel percentage. Restores
132 //! the RTD fuel-consumption factor if it had been frozen.
133 //!
134 //! \param rtdVehicle RTD vehicle whose fuel-consumption factor may be restored.
135 void reset(RTD::CGFVehicleBase& rtdVehicle);
136
137private:
138 bool isFuelAmountValid(double fuelAmount);
139 bool isFuelCapacityValid(double fuelCapacity);
140 bool doesFuelAmountDiffer(double fuelAmount) const;
141 bool setResourceFuelFromRtd(DtSimResource& fuelResource, RTD::CGFVehicleBase& rtdVehicle);
142 bool setRtdFuelFromResource(DtSimResource& fuelResource, RTD::CGFVehicleBase& rtdVehicle);
143 void updateFuelConsumptionFactor(RTD::CGFVehicleBase& rtdVehicle, bool fuelLevelsFrozen);
144
145 //! \brief Resource amount last written by the synchronizer.
147
148 //! \brief Usable RTD fuel capacity determined at the current control handoff, in kilograms.
150
151 //! \brief RTD fuel-consumption factor saved before freezing fuel use.
153
154 //! \brief True while RTD fuel consumption is disabled for frozen fuel levels.
156
157 //! \brief Prevents repeated warnings for a persistent invalid fuel amount.
159};
160
161//! \brief Utility functions for VREngage Real-Time Dynamics (RTD) components
162//!
163//! This namespace contains various utility functions for coordinate transformations,
164//! terrain queries, and other operations used by the VREngage RTD components.
165
166//! \brief Sets dead reckoning thresholds for an entity
167//! \param entity The entity to set thresholds for
168//! \param transThreshold Translational threshold in meters
169//! \param rotationThreshold Rotational threshold in radians
170//!
171//! Sets the translational and rotational thresholds used for dead reckoning
172//! calculations for the specified entity. These thresholds control when
173//! position updates are sent across the network.
174void setDeadreckoningThresholds(DtLocalObject* entity, double transThreshold, double rotationThreshold);
175
176//! \brief Converts from a VRF/DtTaitBryan orientation to RTD/HPR
177//! \param ori The VRF orientation to convert
178//! \return The equivalent RTD HPR orientation
179//!
180//! Converts from a VRF/DtTaitBryan orientation to RTD/HPR orientation.
181//! DtTaitBryan orientation is expected to be a rotation in the coordinate system with x straight, y right, z down.
182//! HPR is expected to be a rotation in the coordinate system with y straight, x right, z up.
183//! A DtTaitBryan(0,0,0) is hpr(0,0,0). A DtTaitBryan(pi/2,0,0) is hpr(-90,0,0) for example.
184smVec3r VRFOriToRTDHPR(const DtTaitBryan& ori);
185//! \brief Converts from an RTD/HPR orientation to VRF/DtTaitBryan
186//! \param hpr The RTD HPR orientation to convert
187//! \return The equivalent VRF/DtTaitBryan orientation
188//!
189//! Inverse transform of VRFOriToRTDHPR, converting from RTD HPR to VRF orientation.
190DtTaitBryan HprToVRFOri(const smVec3r& hpr);
191
192//! \brief Converts airplane world orientation from VRF to RTD HPR
193//! \param ori The VRF world orientation to convert
194//! \return The equivalent RTD world HPR orientation
195//!
196//! Converts airplane world orientation from VRF to RTD HPR. Even if VRF world coordinate
197//! system and RTD world coordinate system are both WGS84, airplanes are differently oriented
198//! in their local coordinate systems:
199//! - In RTD, airplanes point along y-axis with z-axis up
200//! - In VRF, airplanes point along x-axis with z-axis down
201//!
202//! An RTD airplane with zero rotation (in world coordinates) points to WGS84 y-axis with
203//! 'up' pointing along WGS84 z-axis. A VRF airplane with zero rotation (in world coordinates)
204//! points to WGS84 x-axis with 'up' pointing along WGS84 -z-axis (upside down).
205smVec3r VRFWorldOriToRTDWorldHPR(const DtTaitBryan& ori);
206
207//! \brief Converts airplane world orientation from RTD HPR to VRF
208//! \param hpr The RTD world HPR orientation to convert
209//! \return The equivalent VRF world orientation
210//!
211//! Inverse of VRFWorldOriToRTDWorldHPR, converting from RTD world HPR to VRF world orientation.
212DtTaitBryan RTDWorldHprToVRFWorldOri(const smVec3r& hpr);
213
214//! \brief Converts rotational velocity from VRF to RTD world coordinate system
215//! \param entityWorldOrientation The entity's world orientation
216//! \param rotationalVelocity The rotational velocity in VRF coordinate system
217//! \return The equivalent rotational velocity in RTD world coordinate system
218//!
219//! Converts a rotational velocity vector from VRF to RTD world coordinate system.
220smVec3r VRFRotVelToRTDRotVelWCS(const DtTaitBryan& entityWorldOrientation, const DtVector& rotationalVelocity);
221
222//! \brief Converts rotational velocity from RTD to VRF coordinate system
223//! \param entityWorldOrientation The entity's world orientation
224//! \param rotationalVelocity The rotational velocity in RTD world coordinate system
225//! \return The equivalent rotational velocity in VRF coordinate system
226//!
227//! Converts a rotational velocity vector from RTD world coordinate system to VRF.
228DtVector RTDRotVelWCSToVRFRotVel(const DtTaitBryan& entityWorldOrientation, const smVec3r& rotationalVelocity);
229
230//! \brief Converts topographic orientation to local orientation
231//! \param physicalWorld Pointer to the physical world
232//! \param localPosition The local position to convert at
233//! \param topographicOrientation The topographic orientation to convert
234//! \return The equivalent local orientation with respect to the database
235//!
236//! Converts a topographic orientation to a local orientation with respect to the database.
238 DtPhysicalWorld* physicalWorld, const DtVector& localPosition, const DtTaitBryan& topographicOrientation);
239
240//! \brief Converts topographic vector to local vector
241//! \param physicalWorld Pointer to the physical world
242//! \param localPosition The local position to convert at
243//! \param vec The topographic vector to convert
244//! \return The equivalent local vector with respect to the database
245//!
246//! Converts a topographic vector to a local vector with respect to the database.
247DtVector TopoToLocalWrtDatabase(DtPhysicalWorld* physicalWorld, const DtVector& localPosition, const DtVector& vec);
248
249//! \brief Converts local orientation to topographic orientation
250//! \param physicalWorld Pointer to the physical world
251//! \param localPosition The local position to convert at
252//! \param localOrientation The local orientation to convert
253//! \return The equivalent topographic orientation
254//!
255//! Converts a local orientation with respect to the database to a topographic orientation.
257 DtPhysicalWorld* physicalWorld, const DtVector& localPosition, const DtTaitBryan& localOrientation);
258
259//! \brief Computes the 2D distance between two points
260//! \param pnt1 The first point
261//! \param pnt2 The second point
262//! \return The 2D distance between the two points
263//!
264//! Computes the 2D distance between two points.
265smReal compute2DDist(const smVec3r& pnt1, const DtVector& pnt2);
266
267//! \brief Gets the heading-aligned speed vector
268//! \param hpr The heading, pitch, and roll of the entity
269//! \param speed The speed of the entity
270//! \param xyOnly Whether to only consider the x and y components
271//! \return The heading-aligned speed vector
272//!
273//! Gets the heading-aligned speed vector for an entity.
274smVec3r getHeadingAlignedSpeedVector(const smVec3r& hpr, smReal speed, bool xyOnly = false);
275
276//! \brief Gets the heading-aligned speed vector for an airplane
277//! \param bot The airplane entity
278//! \param speed The speed of the airplane
279//! \param xyOnly Whether to only consider the x and y components
280//! \return The heading-aligned speed vector
281//!
282//! Gets the heading-aligned speed vector for an airplane entity.
283smVec3r getHeadingAlignedSpeedVector(FixedWingLibCGF::AirplaneBot* bot, smReal speed, bool xyOnly = false);
284
285//! \brief Gets a vector matching the direction of an entity
286//! \param physicalWorld Pointer to the physical world
287//! \param sr Pointer to the object state repository
288//! \param vecMagnitude The magnitude of the vector
289//! \return The vector matching the direction of the entity
290//!
291//! Gets a vector matching the direction of an entity.
292DtVector getVecMatchingDirection(DtPhysicalWorld* physicalWorld, DtVrfObjectStateRepository* sr, DtReal vecMagnitude);
293
294//! \brief Applies an altitude limit to a vehicle
295//! \param vehicle The vehicle to apply the limit to
296//! \param maxAltitude The maximum altitude
297//!
298//! Applies an altitude limit to a vehicle.
299void applyAltitudeLimit(RTD::VehicleBase* vehicle, const smReal& maxAltitude);
300
301//! \brief Applies a speed limit to a vehicle
302//! \param vehicle The vehicle to apply the limit to
303//! \param maxSpeed The maximum speed
304//!
305//! Applies a speed limit to a vehicle.
306void applySpeedLimit(RTD::VehicleBase* vehicle, const smReal& maxSpeed);
307
308//! \brief Applies wind to a vehicle
309//! \param physicalWorld Pointer to the physical world
310//! \param vehicle The vehicle to apply wind to
311//!
312//! Applies wind to a vehicle.
313void applyWind(DtPhysicalWorld* physicalWorld, RTD::VehicleBase* vehicle);
314
315//! \brief Applies wind to a vehicle
316//! \param vehicle The vehicle to apply wind to
317//! \param vrfWindDir The wind direction in VRF coordinates
318//! \param vrfWindSpeed The wind speed
319//!
320//! Applies wind to a vehicle.
321void applyWind(RTD::VehicleBase* vehicle, double vrfWindDir, double vrfWindSpeed);
322
323//! \brief Macro to convert an RTD heading to a VRF heading
324//! \param hdgInDeg RTD heading in degrees
325//! \return VRF heading in degrees
326//!
327//! Converts a heading from RTD coordinate system to VRF coordinate system.
328//! In VRF, heading increases clockwise from north, while in RTD, heading increases counterclockwise from north.
329#define RTDHeadingToVrfHeading(hdgInDeg) (-hdgInDeg)
330
331//! \brief Macro to convert a VRF heading to an RTD heading
332//! \param hdgInDeg VRF heading in degrees
333//! \return RTD heading in degrees
334//!
335//! Converts a heading from VRF coordinate system to RTD coordinate system.
336//! In VRF, heading increases clockwise from north, while in RTD, heading increases counterclockwise from north.
337#define VrfHeadingToRTDHeading(hdgInDeg) (-hdgInDeg)
338
339//! \brief Macro to convert a vector to DtVector
340//! \param v Vector to convert
341//! \return Equivalent DtVector
342#define toDtVector(v) DtVector((v)[0], (v)[1], (v)[2])
343
344//! \brief Macro to convert a vector to smVec3r (single precision 3D vector)
345//! \param v Vector to convert
346//! \return Equivalent smVec3r
347#define toSmVec3r(v) smVec3r((v)[0], (v)[1], (v)[2])
348
349//! \brief Macro to convert a vector to smVec2r (single precision 2D vector)
350//! \param v Vector to convert
351//! \return Equivalent smVec2r
352#define toSmVec2r(v) smVec2r((v)[0], (v)[1])
353
354//! \brief Macro to convert a vector to smVec3d (double precision 3D vector)
355//! \param v Vector to convert
356//! \return Equivalent smVec3d
357#define toSmVec3d(v) smVec3d((v)[0], (v)[1], (v)[2])
358
359//! \brief Macro to convert a vector to smVec2d (double precision 2D vector)
360//! \param v Vector to convert
361//! \return Equivalent smVec2d
362#define toSmVec2d(v) smVec2d((v)[0], (v)[1])
363
364//! \brief Macro to convert a geodetic coordinate to RTD LLA (Latitude, Longitude, Altitude)
365//! \param geodeticCoord Geodetic coordinate in radians with altitude in meters
366//! \return RTD LLA with latitude and longitude in degrees, altitude in meters
367#define toRTDLLA(geodeticCoord) \
368 smVec3r(smMath::radToDeg(geodeticCoord[0]), smMath::radToDeg(geodeticCoord[1]), geodeticCoord[2])
369
370//! \brief Macro to convert a geodetic coordinate to RTD LL (Latitude, Longitude)
371//! \param geodeticCoord Geodetic coordinate in radians
372//! \return RTD LL with latitude and longitude in degrees
373#define toRTDLL(geodeticCoord) smVec2r(smMath::radToDeg(geodeticCoord[0]), smMath::radToDeg(geodeticCoord[1]))
374
375//! \brief Macro to convert an RTD LLA to geodetic coordinate
376//! \param lla RTD LLA with latitude and longitude in degrees, altitude in meters
377//! \return Geodetic coordinate in radians with altitude in meters
378#define toGeodetic(lla) DtGeodeticCoord(smMath::degToRad(lla[0]), smMath::degToRad(lla[1]), lla[2])
379
380//! \brief Computes the terrain height at a specified local position
381//! \param simMan Pointer to the simulation services
382//! \param localPosition Local position to query terrain height at
383//! \param result Reference where the computed terrain height will be stored
384//! \return True if terrain height computation was successful, false otherwise
385//!
386//! Uses the terrain provider to compute the height of terrain at the specified local position.
387//! Returns false if the terrain query fails or the position is outside the terrain bounds.
388bool computeTerrainHeight(const DtSimulationServices* simMan, const DtVector& localPosition, double& result);
389
390//! \brief Gets the terrain height at a specified local position
391//! \param simMan Pointer to the simulation services
392//! \param localPosition Local position to query terrain height at
393//! \return Terrain height in meters, or 0.0 if computation fails
394//!
395//! Convenience function that calls computeTerrainHeight and returns the result directly.
396//! Returns 0.0 if the terrain height could not be determined.
397double getTerrainHeight(const DtSimulationServices* simMan, const DtVector& localPosition);
398
399//! \brief Gets the height above terrain (HAT) for a geodetic position
400//! \param simMan Pointer to the simulation services
401//! \param pos Geodetic position to query HAT for
402//! \return Height above terrain in meters
403//!
404//! Calculates the height above terrain by converting the geodetic position to local coordinates,
405//! determining the terrain height at that location, and subtracting it from the position's altitude.
406double getHAT(const DtSimulationServices* simMan, const DtGeodeticCoord& pos);
407
408} // namespace vreRtd
409
410//! \brief RTD namespace forward declarations
411namespace RTD
412{
413//! \brief World class for RTD simulation environment
414class World;
415} // namespace RTD
416
417//! \brief Forward declarations for the FixedWingLibCGF namespace
418namespace FixedWingLibCGF
419{
420//! \brief Class representing a fixed-wing aircraft in CGF
421class CGFAirplane;
422} // namespace FixedWingLibCGF
423
424//! \brief Forward declarations for the RotorLibCGF namespace
425namespace RotorLibCGF
426{
427//! \brief Class representing a helicopter in CGF
428class CGFHelicopter;
429} // namespace RotorLibCGF
430
431//! \brief Macro to check an expression and return if false, logging a console warning
432//! \param expression The expression to check
433//! \param complaint The message to log if the expression is false
434//!
435//! Evaluates the given expression and, if false, logs a warning to the object console
436//! and returns from the current function (with no return value).
437#define RTD_CHECK_CONSWARN_RETURN(expression, complaint) \
438 if (!(expression)) \
439 { \
440 objectConsoleWarn() << (complaint) << std::endl; \
441 return; \
442 }
443
444//! \brief Macro to check an expression and return if false, logging a DtWarn
445//! \param expression The expression to check
446//! \param complaint The message to log if the expression is false
447//!
448//! Evaluates the given expression and, if false, logs a warning using DtWarn
449//! and returns from the current function (with no return value).
450#define RTD_CHECK_DTWARN_RETURN(expression, complaint) \
451 if (!(expression)) \
452 { \
453 DtWarn(complaint "\n"); \
454 return; \
455 }
456
457//! \brief Macro to check an expression and return a value if false, logging a console warning
458//! \param expression The expression to check
459//! \param complaint The message to log if the expression is false
460//! \param retVal The value to return if the expression is false
461//!
462//! Evaluates the given expression and, if false, logs a warning to the object console
463//! and returns the specified value from the current function.
464#define RTD_CHECK_CONSWARN_RETURN2(expression, complaint, retVal) \
465 if (!(expression)) \
466 { \
467 objectConsoleWarn() << (complaint) << std::endl; \
468 return retVal; \
469 }
470
471//! \brief Macro to check an expression and return a value if false, logging a DtWarn
472//! \param expression The expression to check
473//! \param complaint The message to log if the expression is false
474//! \param retVal The value to return if the expression is false
475//!
476//! Evaluates the given expression and, if false, logs a warning using DtWarn
477//! and returns the specified value from the current function.
478#define RTD_CHECK_DTWARN_RETURN2(expression, complaint, retVal) \
479 if (!(expression)) \
480 { \
481 DtWarn(complaint "\n"); \
482 return retVal; \
483 }
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