VR-Engage  2.2
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>
20#include <vrfmodel/joystickControllerInterface.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>,
36 public DtJoystickControllerInterface
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 Factory method to create a new instance of this component
71 //! \param name The name for the new component
72 //! \param owner The local object that will own this component
73 //! \param simManager The simulation services manager
74 //! \param desc Optional component descriptor
75 //! \param parentRegistry Optional parent registry for reader/writer functionality
76 //! \return Pointer to the newly created component
77 //!
78 //! Static factory method used by the component creation system to instantiate
79 //! new instances of this component type.
80 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
81 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
82
83protected:
84 //! \brief Projects the expected landing location of an entity
85 //! \param entity Reference to the entity to project landing location for
86 //! \return The projected landing location as a 3D vector
87 //!
88 //! Calculates the expected landing location of a parachuting entity based on
89 //! its current position, velocity, and environmental factors such as wind.
90 //! This is used for both visualization and to guide autonomous entities toward
91 //! their intended landing zones.
92 virtual DtVector projectLandingLocation(DtSimObjectReference entity);
93
94 //! \brief Processes joystick input and sets corresponding port values
95 //! \param functionGroup The function group identifier for the input
96 //! \param function The specific function name for the input
97 //! \param value The input value (typically in range [-1.0, 1.0])
98 //! \param repeat Flag indicating whether the function should repeat
99 //!
100 //! Handles joystick input by translating joystick function calls into
101 //! appropriate parachute control values. Maps joystick axes and buttons
102 //! to steering and deployment controls for the parachute.
104 const DtString& functionGroup, const DtString& function, double value, bool repeat) override;
105
106 //! \brief Handles joystick connection events
107 //!
108 //! Required by the DtJoystickControllerInterface, but currently a no-op.
109 //! Called when a joystick is connected to the system.
110 virtual void joystickConnected() override;
111
112 //! \brief Handles joystick disconnection events
113 //!
114 //! Required by the DtJoystickControllerInterface, but currently a no-op.
115 //! Called when a joystick is disconnected from the system.
116 virtual void joystickDisconnected() override;
117
118 //! \brief Processes parachute-to-location task messages
119 //! \param msg The simulation message containing task parameters
120 //!
121 //! Overridden to fix a task parameter name mismatch. The incorrect capitalization
122 //! in the method name ("Tolocation" instead of "ToLocation") is maintained to
123 //! match the base class implementation for compatibility purposes.
124 virtual void processParachuteTolocationTask(DtSimMessage* msg) override;
125
126private:
127 //! \brief Default constructor (not implemented)
128 //!
129 //! Default constructor is private and not implemented to prevent
130 //! creation of instances without proper initialization.
132
133 //! \brief Copy constructor (not implemented)
134 //!
135 //! Copy constructor is private and not implemented to prevent
136 //! copy construction.
138
139 //! \brief Assignment operator (not implemented)
140 //! \return Reference to this object
141 //!
142 //! Assignment operator is private and not implemented to prevent assignment.
144};
145
146} // namespace makVre
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.
DtVreParachuteController()
Default constructor (not implemented)
virtual void processParachuteTolocationTask(DtSimMessage *msg) override
Processes parachute-to-location task messages.
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:54
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char * DtVreParachuteControllerType
Type identifier for the VRE parachute controller component.
Definition vreParachuteController.h:25
Base template class for VR-Engage simulation components.