VR-Engage  2.3
Loading...
Searching...
No Matches
vreParachuteController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreParachuteController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for parachute steering and deployment
9//!
10//! This file defines the DtVreParachuteController class which extends
11//! the base parachute controller to add joystick control capabilities for
12//! steering and deploying parachutes.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
18
19#include <vrfmodel/parachuteController.h>
21
22namespace makVre
23{
24//! \brief Type identifier for the VRE parachute controller component
25const char* DtVreParachuteControllerType = "vre-parachute-controller";
26
27//! \brief Controller for parachute operation with joystick input support
28//!
29//! DtVreParachuteController extends the base parachute controller to add joystick
30//! control capabilities. This allows direct user control of parachute steering and
31//! deployment through joystick inputs. The controller also provides automated
32//! guidance for CGF entities to navigate to designated landing locations.
33//!
34//! Uses Descriptor Type: DtParachuteControllerDescriptor
35class VREVRFMODEL_DLL DtVreParachuteController : public DtVreSimComponent<DtParachuteController>,
37{
38public:
39 //! \brief Constructor
40 //! \param name The name of this component
41 //! \param owner The local object that owns this component
42 //! \param simManager The simulation services manager
43 //! \param desc Component descriptor with configuration parameters
44 //! \param parentRegistry Optional parent registry for reader/writer functionality
45 //!
46 //! Creates a new parachute controller component with the specified parameters.
47 DtVreParachuteController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
48 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
49
50 //! \brief Virtual destructor
51 //!
52 //! Cleans up resources used by the parachute controller component.
53 //! This is mostly a no-op as the component doesn't maintain many resources.
54 virtual ~DtVreParachuteController() override;
55
56 //! \brief Updates the controller state each simulation frame
57 //!
58 //! Handles CGF (Computer Generated Forces) control of steering and
59 //! parachute deployment. For non-player entities, calculates the appropriate
60 //! steering inputs to guide the entity toward its designated landing location.
61 virtual void tick() override;
62
63 //! \brief Gets the type identifier for this component
64 //! \return String identifying the component type (DtVreParachuteControllerType)
65 //!
66 //! Implements the DtSimComponent::type() method to return the
67 //! type identifier for this component.
68 virtual const char* type() const override;
69
70 //! \brief Calls base first-tick initialization and restores incoming joystick state.
71 virtual void preFirstTickInit() override;
72
73 //! \brief Factory method to create a new instance of this component
74 //! \param name The name for the new component
75 //! \param owner The local object that will own this component
76 //! \param simManager The simulation services manager
77 //! \param desc Optional component descriptor
78 //! \param parentRegistry Optional parent registry for reader/writer functionality
79 //! \return Pointer to the newly created component
80 //!
81 //! Static factory method used by the component creation system to instantiate
82 //! new instances of this component type.
83 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
84 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
85
86protected:
87 //! \brief Projects the expected landing location of an entity
88 //! \param entity Reference to the entity to project landing location for
89 //! \return The projected landing location as a 3D vector
90 //!
91 //! Calculates the expected landing location of a parachuting entity based on
92 //! its current position, velocity, and environmental factors such as wind.
93 //! This is used for both visualization and to guide autonomous entities toward
94 //! their intended landing zones.
95 virtual DtVector projectLandingLocation(DtSimObjectReference entity);
96
97 //! \brief Processes joystick input and sets corresponding port values
98 //! \param functionGroup The function group identifier for the input
99 //! \param function The specific function name for the input
100 //! \param value The input value (typically in range [-1.0, 1.0])
101 //! \param repeat Flag indicating whether the function should repeat
102 //!
103 //! Handles joystick input by translating joystick function calls into
104 //! appropriate parachute control values. Maps joystick axes and buttons
105 //! to steering and deployment controls for the parachute.
107 const DtString& functionGroup, const DtString& function, double value, bool repeat) override;
108
109 //! \brief Handles joystick connection events
110 //!
111 //! Required by the DtJoystickControllerInterface, but currently a no-op.
112 //! Called when a joystick is connected to the system.
113 virtual void joystickConnected() override;
114
115 //! \brief Handles joystick disconnection events
116 //!
117 //! Required by the DtJoystickControllerInterface, but currently a no-op.
118 //! Called when a joystick is disconnected from the system.
119 virtual void joystickDisconnected() override;
120
121private:
122 //! \brief Default constructor (not implemented)
123 //!
124 //! Default constructor is private and not implemented to prevent
125 //! creation of instances without proper initialization.
127
128 //! \brief Copy constructor (not implemented)
129 //!
130 //! Copy constructor is private and not implemented to prevent
131 //! copy construction.
133
134 //! \brief Assignment operator (not implemented)
135 //! \return Reference to this object
136 //!
137 //! Assignment operator is private and not implemented to prevent assignment.
139};
140
141} // namespace makVre
DtVreJoystickControllerInterface(DtSimComponent *component, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc)
Constructs an interface alongside an existing component base.
DtVreParachuteController(const DtVreParachuteController &orig)
Copy constructor (not implemented)
const DtVreParachuteController & operator=(const DtVreParachuteController &orig)
Assignment operator (not implemented)
virtual ~DtVreParachuteController() override
Virtual destructor.
virtual void joystickDisconnected() override
Handles joystick disconnection events.
virtual void preFirstTickInit() override
Calls base first-tick initialization and restores incoming joystick state.
DtVreParachuteController()
Default constructor (not implemented)
virtual DtVector projectLandingLocation(DtSimObjectReference entity)
Projects the expected landing location of an entity.
DtVreParachuteController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual const char * type() const override
Gets the type identifier for this component.
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Factory method to create a new instance of this component.
virtual void joystickConnected() override
Handles joystick connection events.
virtual void calcAndSetPortValues(const DtString &functionGroup, const DtString &function, double value, bool repeat) override
Processes joystick input and sets corresponding port values.
virtual void tick() override
Updates the controller state each simulation frame.
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:63
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
!
Definition glsVreMessageUtil.h:50
const char * DtVreParachuteControllerType
Type identifier for the VRE parachute controller component.
Definition vreParachuteController.h:25
Internal-state persistence for VRE joystick controllers.
Base template class for VR-Engage simulation components.