14#include <vrfobjcore/actuatorComponent.h>
15#include <vrfobjcore/platformLocalObjectFacade.h>
19#include <Vx/VxTransform.h>
21#include <VxSim/VxSmartInterface.h>
22#include <VxSim/VxVHLInterface.h>
23#include <VxSim/IDynamics.h>
24#include <VxSim/VxSimulationFileManagerFacade.h>
25#include <VxDynamics/Mechanism.h>
26#include <VxData/Delegate.h>
30#include <terrainInterface/terrainImplementation.h>
32#include <readerWriter/symbolString.h>
33#include <vrfobjcore/localObject.h>
34#include <vrftasks/vrfObjectMessageTypeTemplate.h>
35#include <vlpi/articulatedPartCollection.h>
37#include <boost/signals2/connection.hpp>
41class DtUpdateRepositoryOutputPortGroup;
47class DtInputPortGroup;
48class DtOutputPortGroup;
49class DtAnalogInputPort;
50class DtBooleanInputPort;
51class DtSingleConnectionInputPort;
52class DtSingleConnectionOutputPort;
53class DtGroundVehicleStateRepository;
55class DtStringOutputPort;
62class VxPluginExtension;
64class VxSimulationState;
84class DtArticulatedPartStateRepository;
114 DtLocalObject* owner,
115 DtSimulationServices* simManager,
116 DtComponentDescriptor* desc = 0,
117 DtReaderWriterRegistry* parentRegistry = 0);
142 virtual const char*
type()
const override;
166 static DtSimComponent*
creator(
const DtString& name,
167 DtLocalObject* owner,
168 DtSimulationServices* simManager,
169 DtComponentDescriptor* desc = 0,
170 DtReaderWriterRegistry* parentRegistry = 0);
182 virtual const std::vector<DtVortexBasePart*>&
getParts()
const;
335 const makVrf::DtArticulatedPartStateRepository* partRepository,
342 VxData::FieldBase* sprocket,
343 const makVrf::DtArticulatedPartStateRepository* partRepository,
350 const makVrf::DtArticulatedPartStateRepository* partRepository);
356 const makVrf::DtArticulatedPartStateRepository* partRepository);
360 const makVrf::DtArticulatedPartStateRepository* partRepository,
361 const char* trackName);
365 const makVrf::DtArticulatedPartStateRepository* partRepository,
366 const char* trackName);
649 const DtVector& localPosition,
650 const DtAttachedTerrain& terrain,
651 bool& dataAvailable)
const;
685 const VxSim::VxWeakInterface<VxSim::IObject>& objectToLookThroughWeak,
686 const std::vector<std::string>& pathToLookForPart,
710 Vx::VxSmartPtr<DtVxSimulationFileManagerFacadeListener>
myListener;
814 const VxSim::VxUuid& requestId,
const std::string& name, RequestResult result)
override;
822 const VxSim::VxUuid& requestId,
const std::string& name, RequestResult result)
override;
832class DtMechAddon :
public VxSim::IExtension,
public VxSim::IDynamics,
public VxDynamics::IMechanismAddOn
Addon extension for Vortex mechanisms.
Definition vortexMovementActuator.h:833
void setUpdatingFromCGF(bool cgfDriven)
Sets whether updates come from CGF.
DtMechAddon(VxSim::VxExtension *proxy)
Constructor.
static const VxSim::VxFactoryKey kFactoryKey
Factory key for creating instances of this addon.
Definition vortexMovementActuator.h:836
void setVortexMovementActuator(DtVortexMovementActuator *obj)
Sets the movement actuator to communicate with.
virtual ~DtMechAddon() override
Destructor.
DtVortexMovementActuator * myMovementActuator
The movement actuator.
Definition vortexMovementActuator.h:863
bool myUpdatingFromCGF
Flag indicating if updates come from CGF.
Definition vortexMovementActuator.h:864
virtual void preStep() override
Called before each physics step.
Base class for Vortex parts in the physics simulation.
Definition vortexPart.h:87
Dynamics-based Vortex part implementation.
Definition vortexPart.h:314
Class for managing Vortex interfaces.
Definition vortexInterface.h:232
Descriptor for Vortex physics-based movement simulation.
Definition vortexMovementActuatorDescriptor.h:35
Actuator component that integrates Vortex physics for vehicle dynamics.
Definition vortexMovementActuator.h:98
virtual void setThresholdsFromDescriptor()
Sets precision thresholds based on the descriptor.
void processStartupDynamicsWarmupStep()
Applies the deferred startup dynamics disable after one physics step.
bool myAutoParkButtonDown
Definition vortexMovementActuator.h:726
virtual void processSetVortexWhileUntasked(DtSimMessage *msg)
Processes a set data request to enable/disable high-fidelity physics.
bool myWasInVortexWorldLastTick
Definition vortexMovementActuator.h:719
virtual void checkTaskStatus(bool vortexActive)
Cancels CGF tasks that conflict with Vortex control.
virtual double fuelLeft() const
Gets the current fuel level.
double myPartAngularVelocityThreshold
Definition vortexMovementActuator.h:756
void disableVehicleDynamics()
Disables the vehicle dynamics.
bool myWasBeingTowedLastTick
Definition vortexMovementActuator.h:720
VxMath::Matrix44 getNextFrameVortexTransform() const
Gets the next frame's location and orientation as a VxMatrix.
virtual void connectInterfacesToPorts()
Connects interfaces to ports.
static void setHeadingCallback(DtReal heading, void *usrData)
Callback for heading changes.
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
Definition vortexMovementActuator.h:700
virtual void addSetCallbacks()
Adds set callbacks for location and heading.
virtual bool createPortGroups() override
Creates the port groups for the actuator.
VxSim::VxSmartInterface< DtMechAddon > myMechAddon
Definition vortexMovementActuator.h:705
Vx::VxEulerAngles getNextFrameVortexOrientation() const
Gets the next frame Vortex orientation from the entity.
virtual void initTrackWheelPositionFromArticulatedPart(DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository, const char *trackName)
Initializes a track-wheel position from an articulated part.
makVre::DtVortexPhysicalWorld * myVortexPhysicalWorld
Definition vortexMovementActuator.h:746
static void setLocationCallback(const DtVector &location, void *usrData)
Callback for location changes.
virtual void createVortexPartsFromDescriptor()
Creates all Vortex parts defined in the descriptor.
DtStringOutputPort * myAimingModePort
Definition vortexMovementActuator.h:717
virtual void initTrackIdlerDistanceFromArticulatedPart(DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository, const char *trackName)
Initializes a track idler's distance from its sprocket.
std::shared_ptr< makVre::DtVortexConfiguration > myConfiguration
Definition vortexMovementActuator.h:713
virtual void createVortexConfigurationsFromDescriptor()
Creates Vortex configurations from the descriptor.
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Factory method for creating instances of this actuator.
bool myPendingVortexPhysicsState
Definition vortexMovementActuator.h:732
MechanismLoadStatus myMechanismLoadStatus
Definition vortexMovementActuator.h:743
virtual void manageWheelPartStateTransitions(bool inVortexWorld)
Manages wheel part state transitions when entering or exiting Vortex world.
virtual DtUUID towingTargetUuid() const
Gets the entity currently attached to this vehicle's tow hook.
virtual void sendVehicleDynamicsUpdate(bool enable)
Sends a vehicle dynamics update event.
DtTaitBryan myPreviousOrientation
Definition vortexMovementActuator.h:788
double myPartPositionThreshold
Definition vortexMovementActuator.h:753
DtVortexStateRepository * myVehicleRepository
Definition vortexMovementActuator.h:699
virtual void handleSetHeading(DtReal heading)
Handles a heading change request.
void resetTowingHookGroup()
Resets the Vortex tow-hook group extension.
virtual const std::vector< DtVortexBasePart * > & getParts() const
Gets the list of all Vortex parts in this actuator.
DtVortexMovementActuator & operator=(const DtVortexMovementActuator &orig)=delete
Assignment operator and copy constructor not implemented.
bool myHaveVortexTurretInterface
Definition vortexMovementActuator.h:728
virtual void updateState()
Updates state properties.
void tagDynamicsPartGeometries()
Tags the geometries of all dynamics parts for collision detection.
virtual bool init() override
Initializes the actuator.
virtual const char * trackNameForPart(const DtVortexDynamicsPart &dynamicsPart) const
Gets the Vortex track parameter name for a dynamics part.
VxSim::VxUuid myLoadObjectRequestId
Definition vortexMovementActuator.h:744
double myVortexPhysicsDisableDelaySeconds
Definition vortexMovementActuator.h:758
VxSim::VxSmartInterface< VxDynamics::Mechanism > myMechanism
Definition vortexMovementActuator.h:704
VxSim::VxSmartInterface< VxDynamics::Mechanism > getMechanism()
Gets the current mechanism associated with the actuator.
virtual void sendExtensionUpdate(VxSim::VxExtension *extension, bool enable)
Sends a Vortex extension update event.
virtual bool isVortexMechanismValid() const
Checks if the Vortex mechanism is valid.
virtual bool initWheelPositionFromArticulatedPart(DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository)
Initializes a conventional wheel position from an articulated part.
virtual void handleSetLocation(const DtVector &location)
Handles a location change request.
virtual bool createPorts() override
Creates the ports required for actuator operation.
DtUpdateRepositoryOutputPortGroup * myUpdateRepositoryOutputPortGroup
Definition vortexMovementActuator.h:716
virtual void useFuel(double fuelUsed)
Consumes fuel.
virtual bool taskConflictsWithVortex(const DtSimTaskMessageType &taskType) const
Determines whether a task type conflicts with Vortex control.
virtual void updateGroundInteractionPoint(const DtDcm &localOrientation, const DtVector &localPosition, const DtAttachedTerrain &terrain, bool &dataAvailable) const
Updates the ground interaction point under the vehicle.
DtGroundVehicleStateRepository * myGroundVehicleState
Definition vortexMovementActuator.h:698
VortexInterfaceMap myInterfaces
Definition vortexMovementActuator.h:708
bool myHasVortexPhysicsRequest
Definition vortexMovementActuator.h:733
void sendTowingHookGroupUpdate(bool enable)
Enables or disables the Vortex tow-hook group extension.
double myAngularVelocityThreshold
Definition vortexMovementActuator.h:751
bool myDetectTerrainFallthrough
Controls whether terrain fallthrough detection is enabled.
Definition vortexMovementActuator.h:785
friend class DtVxSimulationFileManagerFacadeListener
Definition vortexMovementActuator.h:284
virtual void realizeVortexState()
Updates the Vortex state based on current conditions.
virtual bool isTerrainAvailable() const
Checks if terrain is available below the vehicle.
virtual DtUUID towingTargetUuid(const VxData::FieldBase &field) const
Converts a Vortex field value to a tow target UUID.
virtual VxData::FieldBase * vehicleParameter(const std::string ¶meterName) const
Gets a named Vortex vehicle parameter.
void processTerrainChangeNotification(const DtTerrainChangeNotificationInfo &terrainChangeInfo)
Processes terrain change notifications.
DtVortexMovementActuator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
static void setVortexWhileUntaskedCallback(DtSimMessage *msg, void *usrData)
Callback for scripted set data request message.
void processTowingTargetChanged(const VxData::FieldBase &field)
Processes tow-hook target field changes.
virtual void getLowestBoundingPointsOfMechanism(std::vector< DtVector > &outputPoints)
Gets the lowest bounding points of the current mechanism.
double myPartLinearVelocityThreshold
Definition vortexMovementActuator.h:755
std::shared_ptr< VxSim::VxSimulationFileManagerFacade > mySimulationFileManagerFacade
Definition vortexMovementActuator.h:709
virtual bool isBeingTowed() const
Checks if the entity is being towed by another Vortex entity.
bool mySpawnedFromSpawnPoint
Definition vortexMovementActuator.h:734
makVre::DtVortexMovementPSR * myProcessState
Definition vortexMovementActuator.h:790
virtual void initParametersFromModel()
Initializes Vortex model parameters with data from VR-Forces.
virtual bool isHighFidelityCGF() const
Checks whether Vortex While Untasked is enabled.
virtual void restoreWheels()
Restores wheel articulated parts.
virtual bool initFieldFromArticulatedPartPosition(VxData::FieldBase *field, const makVrf::DtArticulatedPartStateRepository *partRepository, const DtVortexDynamicsPart *dynamicsPart) const
Initializes a Vortex position field from an articulated-part position.
virtual void tick() override
Updates the actuator each simulation frame.
virtual void updateFuel()
Updates fuel level.
Vx::VxVector3 getNextFrameVortexPosition() const
Gets the next frame Vortex location from the entity.
virtual void updateDestroyedState()
VxSim::VxExtension * findTowingHookGroupExtension()
Finds this mechanism's tow-hook group extension.
virtual bool isPlayerControlledAs(std::string role) const
Checks if the entity is player controlled in a specific role.
virtual bool isVortexPlayerControlled() const
Checks if the entity is player controlled.
DtVortexMovementActuator(const DtVortexMovementActuator &orig)=delete
virtual void initArticulatedPartPositions()
Initializes Vortex vehicle-part positions from VR-Forces articulated parts.
virtual void initTrackPartPositions(bool didInitLeftSprocket, bool didInitRightSprocket)
Initializes tracked-vehicle wheel and idler positions.
double myPositionThreshold
Definition vortexMovementActuator.h:748
virtual bool checkDistanceFromCoordinateOriginOverLimit(const DtVector &position, double distance)
Checks if the incoming position is further than distance.
virtual void sendVehiclePartsUpdate(Vx::VxPart::EntityControlTypeEnum control)
Updates the control state of all vehicle parts.
DtVector myPreviousPosition
Definition vortexMovementActuator.h:787
virtual void dropAboveTerrain(const DtVector &newLocalPosition, double heading)
Drops the vehicle above the terrain at a specified position.
std::map< std::string, DtVortexInterface * > VortexInterfaceMap
Type definition for a map of Vortex interfaces by name.
Definition vortexMovementActuator.h:101
VxData::DelegateConnection myTowingTargetObserverConnection
Definition vortexMovementActuator.h:721
virtual void engageParkingBrakeOnDisengage(bool isDriver)
Automatically engages parking brake when disengaging from driver role.
MechanismLoadStatus
Definition vortexMovementActuator.h:738
@ LOADED
Definition vortexMovementActuator.h:741
@ LOADING
Definition vortexMovementActuator.h:740
@ NOT_LOADED
Definition vortexMovementActuator.h:739
virtual bool initSprocketPositionFromArticulatedPart(DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository)
Initializes a sprocket position from an articulated part.
double myVortexPhysicsDisableDelayElapsedSeconds
Definition vortexMovementActuator.h:759
const DtVortexMovementActuatorDescriptor * myDescriptor
Definition vortexMovementActuator.h:697
virtual void resetWheelParts()
Resets wheel parts to their default positions.
void enableVehicleDynamics()
Enables the vehicle dynamics.
double myVelocityThreshold
Definition vortexMovementActuator.h:750
double myPartOrientationThreshold
Definition vortexMovementActuator.h:754
DtVortexBasePart * createPart(makVre::DtVortexSimArtPartDescriptor *desc)
Creates a Vortex part from a descriptor.
virtual void preFirstTickInit() override
Initializes the actuator before the first simulation tick.
virtual bool createPSR()
Creates a process state repository for this component.
virtual void clearTowingTargetTracking()
Clears current tow target tracking.
bool myPendingDynamicsDisableAfterStartupStep
Definition vortexMovementActuator.h:731
DtUUID myTowingTargetUuid
Definition vortexMovementActuator.h:723
virtual void updateMassOfChassis()
Updates the chassis mass from entity parameters.
static void terrainChangeNotification(const DtTerrainChangeNotificationInfo &terrainChangeInfo, void *usr)
Static callback for terrain change notifications.
virtual const char * type() const override
Gets the type of this actuator.
virtual void queueMechanismLoad()
Queues the mechanism for loading.
virtual void detectTerrainFallthrough()
Detects and logs terrain fall-through conditions.
void connectTowingTargetObserver()
Connects to tow-hook target updates from the driver interface.
virtual void updatePorts()
Updates ports with data from Vortex interfaces.
bool myAllowVortexWhileDestroyed
Controls whether Vortex physics simulation continues for destroyed entities.
Definition vortexMovementActuator.h:772
double myDropTimer
Definition vortexMovementActuator.h:757
bool myIsVortexDynamicsActive
Definition vortexMovementActuator.h:730
virtual bool initTrackWheelRelativeToSprocket(VxData::FieldBase *trackWheel, VxData::FieldBase *sprocket, const makVrf::DtArticulatedPartStateRepository *partRepository, const DtVortexDynamicsPart *dynamicsPart) const
Initializes a track-wheel position relative to its sprocket.
virtual void connectTowingTargetDeletedSignal(const DtUUID &targetUuid)
Connects to the current tow target deletion signal.
double myOrientationThreshold
Definition vortexMovementActuator.h:749
Vx::VxVector3 getVortexLocation(const DtVector &inputCoords) const
Converts local coordinates to Vortex coordinates.
void updateTowingHookGroupState(const DtUUID ¤tTowingTargetUuid)
Updates tow-hook group reset state based on the current hook target.
Vx::VxSmartPtr< DtVxSimulationFileManagerFacadeListener > myListener
Definition vortexMovementActuator.h:710
virtual bool isInVortexWorld() const
Checks if high-fidelity Vortex physics should be active.
DtArticulatedPartCollection myCollectionWithWheels
Definition vortexMovementActuator.h:701
bool myNeedsWheelPartRemoval
Definition vortexMovementActuator.h:727
virtual void setVortexMechanismLocation(const Vx::VxVector3 &nwuLocation, double heading)
Sets the Vortex mechanism's location and orientation.
bool myWasDriverLastTick
Definition vortexMovementActuator.h:725
void loadMechanism()
Loads the Vortex mechanism.
virtual ~DtVortexMovementActuator() override
Destructor.
virtual void createVortexInterfacesFromDescriptor()
Creates Vortex interfaces defined in the descriptor.
virtual void removeSetCallbacks()
Removes set callbacks for location and heading.
VxSim::VxSmartInterface< VxDynamics::Part > findPartFromPathRecursive(const VxSim::VxWeakInterface< VxSim::IObject > &objectToLookThroughWeak, const std::vector< std::string > &pathToLookForPart, int index)
Recursively finds a part from a path.
std::vector< DtVortexBasePart * > myParts
Definition vortexMovementActuator.h:707
virtual void populateArtPartMapProperty()
virtual void processTowingTargetDeleted()
Processes removal of the currently tracked tow target.
double myAccelerationThreshold
Definition vortexMovementActuator.h:752
boost::signals2::scoped_connection myTowingTargetDeletedConnection
Definition vortexMovementActuator.h:722
VxSim::VxExtension * myVehicleExt
Definition vortexMovementActuator.h:706
DtVortexBasePart * findPart(int partId) const
Gets the Vortex part associated with an articulated part ID.
State repository for Vortex physics entities.
Definition vortexStateRepository.h:54
Listener for Vortex file loading events.
Definition vortexMovementActuator.h:798
virtual ~DtVxSimulationFileManagerFacadeListener() override
Destructor.
virtual void onRequestedObjectUnloaded(const VxSim::VxUuid &requestId, const std::string &name, RequestResult result) override
Called when a requested object has been unloaded.
DtVxSimulationFileManagerFacadeListener(DtVortexMovementActuator *actuator)
Constructor.
DtVortexMovementActuator * myMovementActuator
The movement actuator.
Definition vortexMovementActuator.h:825
virtual void onRequestedObjectLoaded(const VxSim::VxUuid &requestId, const std::string &name, RequestResult result) override
Called when a requested object has been loaded.
Descriptor for Vortex physics engine configurations.
Definition vortexConfigurationDescriptor.h:27
Main class for managing Vortex configuration parameters.
Definition vortexConfiguration.h:146
Descriptor for Vortex physics engine interfaces.
Definition vortexInterfaceDescriptor.h:27
Process state repository for the Vortex movement actuator.
Definition vortexMovementPSR.h:31
Main class responsible for managing the Vortex physics simulation environment.
Definition vortexPhysicalWorld.h:65
Articulated part descriptor for Vortex physics simulation.
Definition vortexArtPartDescriptor.h:27
Provides coordinate conversion functionality between different coordinate systems.
Export macros for the VR-Forces Vortex extension library.
#define VREVRFVORTEX_DLL
Export macro for non-Windows platforms.
Definition export.h:30
Definition vortexConfiguration.h:24
Definition vortexConfiguration.h:29
!
Definition glsVreMessageUtil.h:50
Definition connectorAccessory.h:38
const char DtVortexMovementActuatorType[]
Type identifier for the Vortex movement actuator.
Definition vortexMovementActuator.h:88