VR-Engage  2.2
Loading...
Searching...
No Matches
vreLadderClimbingPSR.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreLadderClimbingPSR.h
7//! \ingroup vreVrfobjcore
8//! \brief Ladder climbing process state repository for VREngage
9//!
10//! This file defines the DtVreLadderClimbingPSR class, which provides a process state
11//! repository for ladder climbing components in VREngage. It stores the shared and
12//! checkpoint-able state for ladder climbing behavior, including the climbing state,
13//! ladder access points, and related timing information needed for human entities
14//! to realistically climb ladders in the simulation.
15
16
17#pragma once
18
21
22#include <vrfobjcore/vrfProcessStateRepository.h>
23
24#include <matrix/vlVector.h>
25#include <matrix/vlTaitBryan.h>
26
27#include <readerWriter/rwInt.h>
28#include <readerWriter/rwReal.h>
29#include <readerWriter/rwVector.h>
30
31namespace makVre
32{
33//! \brief Type identifier string for the ladder climbing process state repository
34const char DtVreLadderClimbingPSRType[] = "vre-ladder-climbing-psr";
35
36//! \brief Default name for the ladder climbing process state repository
38 "vre-ladder-climbing-process-state-repository-default";
39
40//! \brief Enumeration of ladder climbing states
41//!
42//! Defines the possible states of an entity in relation to ladder climbing.
43//! These states are used to control the behavior and animations of the entity
44//! throughout the ladder climbing process.
46 DtOffLadder = 0, //!< Entity is not on or near a ladder
47 DtGettingOnLadder, //!< Entity is in the process of mounting the ladder
48 DtOnLadderAtAccessPoint, //!< Entity is on the ladder at the access point
49 DtOnLadder, //!< Entity is actively climbing the ladder
50 DtGettingOffLadder, //!< Entity is in the process of dismounting the ladder
51 DtOffLadderAtExitPoint //!< Entity has just dismounted and is at the exit point
52};
53
54//! \brief Process state repository for ladder climbing components
55//!
56//! This class provides storage and management for ladder climbing state data,
57//! including the climbing state, ladder access points, and related timing information.
58//! It is used by entities that need to climb ladders in the simulation, particularly
59//! human entities, to maintain their state throughout the ladder climbing process.
60class VREVRFOBJCORE_DLL DtVreLadderClimbingPSR : public DtVrfProcessStateRepository
61{
62public:
63 //! \brief Constructor with VRF object and optional name
64 //! \param vrfObject Pointer to the local object this PSR is associated with
65 //! \param rwName Optional reader/writer name
66 //! \param parentRegistry Optional parent registry for reader/writer functionality
67 //!
68 //! Creates a new ladder climbing PSR for the specified VRF object.
69 DtVreLadderClimbingPSR(DtLocalObject* vrfObject, const DtString& rwName = DtString::nullString(),
70 DtReaderWriterRegistry* parentRegistry = 0);
71
72 //! \brief Copy constructor
73 //! \param orig The source PSR to copy from
74 //! \param rwName Optional reader/writer name
75 //! \param parentRegistry Optional parent registry for reader/writer functionality
76 //!
77 //! Creates a new ladder climbing PSR as a copy of the provided original.
78 DtVreLadderClimbingPSR(const DtVreLadderClimbingPSR& orig, const DtString& rwName = DtString::nullString(),
79 DtReaderWriterRegistry* parentRegistry = 0);
80
81 //! \brief Virtual destructor
82 //!
83 //! Cleans up resources used by the PSR.
84 virtual ~DtVreLadderClimbingPSR() override;
85
86 //! \brief Assignment operator (not implemented)
87 //! \param orig The source PSR to copy from
88 //! \return Reference to this PSR after assignment
89 //!
90 //! Assignment operator is declared but not implemented to prevent assignment.
92
93 //! \brief Creates a clone of this PSR
94 //! \param rwName Optional reader/writer name for the clone
95 //! \param parentRegistry Optional parent registry for reader/writer functionality
96 //! \return Pointer to a new PSR that is a clone of this one
97 //!
98 //! Creates a new ladder climbing PSR as a deep copy of this one.
99 virtual DtVrfProcessStateRepository* clone(const DtString& rwName = DtString::nullString(),
100 DtReaderWriterRegistry* parentRegistry = 0) const override;
101
102 //! \brief Gets the type identifier for this PSR
103 //! \return String identifying this PSR type
104 //!
105 //! Returns a unique type identifier string for this PSR type.
106 //! Will return DtVreLadderClimbingPSRType.
107 virtual DtString type() const override;
108
109 //! \brief Sets the ladder climbing state
110 //! \param state The new ladder climbing state to set
111 //!
112 //! Sets the current ladder climbing state of the entity.
113 //! This affects how the entity behaves in relation to ladders.
115
116 //! \brief Gets the ladder climbing state
117 //! \return The current ladder climbing state
118 //!
119 //! Returns the current ladder climbing state of the entity.
121
122 //! \brief Sets the current ladder
123 //! \param ladder The ladder object this entity is interacting with
124 //!
125 //! Sets the ladder that the entity is currently interacting with.
126 //! This includes all the ladder's properties such as base, top, and orientation.
127 virtual void setLadder(const DtLadder& ladder);
128
129 //! \brief Gets the current ladder
130 //! \return The ladder object this entity is interacting with
131 //!
132 //! Returns the ladder that the entity is currently interacting with.
133 virtual DtLadder ladder() const;
134
135 //! \brief Sets the ladder entry point
136 //! \param ladderAccessPoint The position where the entity mounts the ladder
137 //!
138 //! Sets the position where the entity mounts (gets on) the ladder.
139 //! This is typically near the base of the ladder.
140 virtual void setLadderEntryPoint(const DtVector& ladderAccessPoint);
141
142 //! \brief Gets the ladder entry point
143 //! \return The position where the entity mounts the ladder
144 //!
145 //! Returns the position where the entity mounts (gets on) the ladder.
146 virtual DtVector ladderEntryPoint() const;
147
148 //! \brief Sets the ladder exit point
149 //! \param ladderAccessPoint The position where the entity dismounts the ladder
150 //!
151 //! Sets the position where the entity dismounts (gets off) the ladder.
152 //! This is typically near the top of the ladder for upward climbing.
153 virtual void setLadderExitPoint(const DtVector& ladderAccessPoint);
154
155 //! \brief Gets the ladder exit point
156 //! \return The position where the entity dismounts the ladder
157 //!
158 //! Returns the position where the entity dismounts (gets off) the ladder.
159 virtual DtVector ladderExitPoint() const;
160
161 //! \brief Sets the simulation time when the entity will finish mounting the ladder
162 //! \param simTime The simulation time in seconds
163 //!
164 //! Sets the simulation time at which the entity will complete the process
165 //! of mounting (getting on) the ladder. Used for timing the transition animation.
166 virtual void setTimeToGetOnLadder(double simTime);
167
168 //! \brief Gets the simulation time when the entity will finish mounting the ladder
169 //! \return The simulation time in seconds
170 //!
171 //! Returns the simulation time at which the entity will complete the process
172 //! of mounting (getting on) the ladder.
173 virtual double timeToGetOnLadder() const;
174
175 //! \brief Sets the simulation time when the entity will finish dismounting the ladder
176 //! \param simTime The simulation time in seconds
177 //!
178 //! Sets the simulation time at which the entity will complete the process
179 //! of dismounting (getting off) the ladder. Used for timing the transition animation.
180 virtual void setTimeToGetOffLadder(double simTime);
181
182 //! \brief Gets the simulation time when the entity will finish dismounting the ladder
183 //! \return The simulation time in seconds
184 //!
185 //! Returns the simulation time at which the entity will complete the process
186 //! of dismounting (getting off) the ladder.
187 virtual double timeToGetOffLadder() const;
188
189 //! \brief Sets the ladder standoff offset
190 //! \param offset The offset vector in local coordinates
191 //!
192 //! Sets the offset vector used to position the entity relative to the ladder
193 //! so that it doesn't appear embedded in the ladder geometry.
194 virtual void setLadderStandoffOffset(const DtVector& offset);
195
196 //! \brief Gets the ladder standoff offset
197 //! \return The offset vector in local coordinates
198 //!
199 //! Returns the offset vector used to position the entity relative to the ladder.
200 virtual DtVector ladderStandoffOffset() const;
201
202 //! \brief Sets the entity's orientation when on the ground
203 //! \param orientation The orientation in Tait-Bryan angles
204 //!
205 //! Sets the orientation of the entity when it's on the ground before mounting
206 //! the ladder. This is saved to restore the entity's orientation after dismounting.
207 virtual void setOrientationOnGround(const DtTaitBryan& orientation);
208
209 //! \brief Gets the entity's orientation when on the ground
210 //! \return The orientation in Tait-Bryan angles
211 //!
212 //! Returns the saved orientation of the entity when it was on the ground
213 //! before mounting the ladder.
214 virtual DtTaitBryan orientationOnGround() const;
215
216 //! \brief Sets the terrain height in geodetic coordinates
217 //! \param altitude The terrain height in geodetic coordinates
218 //!
219 //! Sets the height of the terrain in geodetic coordinates at the ladder location.
220 //! This is used for positioning calculations when mounting and dismounting the ladder.
221 virtual void setTerrainHeightGeodetic(double altitude);
222
223 //! \brief Gets the terrain height in geodetic coordinates
224 //! \return The terrain height in geodetic coordinates
225 //!
226 //! Returns the height of the terrain in geodetic coordinates at the ladder location.
227 virtual double terrainHeightGeodetic() const;
228
229 //! \brief Sets the ladder base position for search operations
230 //! \param ladderBase The position of the ladder base in local coordinates
231 //!
232 //! Sets the position of the ladder base used in findNearestLadder() searches.
233 //! This helps optimize ladder searches by providing a starting point.
234 virtual void setLadderBaseForSearch(const DtVector& ladderBase);
235
236 //! \brief Gets the ladder base position for search operations
237 //! \return The position of the ladder base in local coordinates
238 //!
239 //! Returns the position of the ladder base used in findNearestLadder() searches.
240 virtual DtVector ladderBaseForSearch() const;
241
242 //! \brief Factory function to create a new instance of this PSR
243 //! \param rwName The reader/writer name for the new instance
244 //! \param vrfObject Pointer to the local object this PSR will be associated with
245 //! \param parentRegistry Parent registry for reader/writer functionality
246 //! \return Pointer to a newly created PSR instance
247 //!
248 //! Static factory function used by the PSR creation system to instantiate
249 //! new instances of this PSR type.
250 static DtVrfProcessStateRepository* creator(
251 const DtString& rwName, DtLocalObject* vrfObject, DtReaderWriterRegistry* parentRegistry);
252
253protected:
254 //! \brief Current ladder climbing state
255 //!
256 //! Stores the current state of the entity in relation to ladder climbing.
257 //! See DtLadderClimbingState enumeration for possible values.
259
260 //! \brief Current ladder being used
261 //!
262 //! Stores the ladder that the entity is currently interacting with.
263 //! This is valid when in the DtOnLadderAtAccessPoint or DtOnLadder states.
265
266 //! \brief Ladder entry point
267 //!
268 //! Stores the position where the entity mounts (gets on) the ladder.
269 //! This is typically near the base of the ladder.
271
272 //! \brief Ladder exit point
273 //!
274 //! Stores the position where the entity dismounts (gets off) the ladder.
275 //! This is typically near the top of the ladder for upward climbing.
277
278 //! \brief Time to finish mounting the ladder
279 //!
280 //! Stores the simulation time at which the entity will complete the process
281 //! of mounting (getting on) the ladder. Used for timing the transition animation.
283
284 //! \brief Time to finish dismounting the ladder
285 //!
286 //! Stores the simulation time at which the entity will complete the process
287 //! of dismounting (getting off) the ladder. Used for timing the transition animation.
289
290 //! \brief Ladder standoff offset
291 //!
292 //! Stores the offset vector in local coordinates, used to position the entity
293 //! such that it doesn't appear embedded in the ladder geometry.
295
296 //! \brief Entity orientation when on the ground
297 //!
298 //! Stores the orientation of the entity when it's on the ground before mounting
299 //! the ladder. This is used to restore the entity's orientation after dismounting.
301
302 //! \brief Terrain height in geodetic coordinates
303 //!
304 //! Stores the height of the terrain in geodetic coordinates at the ladder location.
305 //! This is used for positioning calculations when mounting and dismounting the ladder.
307
308 //! \brief Ladder base for search operations
309 //!
310 //! Stores the position of the ladder base used in findNearestLadder() searches.
311 //! This helps optimize ladder searches by providing a starting point.
313};
314
315} // namespace makVre
Helper class that represents a climbable ladder in simulations.
Definition ladder.h:35
virtual void setLadderEntryPoint(const DtVector &ladderAccessPoint)
Sets the ladder entry point.
virtual ~DtVreLadderClimbingPSR() override
Virtual destructor.
virtual DtVector ladderStandoffOffset() const
Gets the ladder standoff offset.
DtRwReal myTimeToGetOffLadder
Time to finish dismounting the ladder.
Definition vreLadderClimbingPSR.h:288
virtual void setTimeToGetOnLadder(double simTime)
Sets the simulation time when the entity will finish mounting the ladder.
virtual DtVector ladderBaseForSearch() const
Gets the ladder base position for search operations.
virtual DtLadder ladder() const
Gets the current ladder.
virtual DtLadderClimbingState ladderClimbingState() const
Gets the ladder climbing state.
virtual DtString type() const override
Gets the type identifier for this PSR.
virtual DtVrfProcessStateRepository * clone(const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0) const override
Creates a clone of this PSR.
virtual double timeToGetOffLadder() const
Gets the simulation time when the entity will finish dismounting the ladder.
DtRwVector myLadderExitPoint
Ladder exit point.
Definition vreLadderClimbingPSR.h:276
DtVreLadderClimbingPSR(const DtVreLadderClimbingPSR &orig, const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0)
Copy constructor.
virtual double terrainHeightGeodetic() const
Gets the terrain height in geodetic coordinates.
DtLadder myLadder
Current ladder being used.
Definition vreLadderClimbingPSR.h:264
virtual void setLadderClimbingState(DtLadderClimbingState state)
Sets the ladder climbing state.
DtRwVector myLadderEntryPoint
Ladder entry point.
Definition vreLadderClimbingPSR.h:270
virtual DtVector ladderExitPoint() const
Gets the ladder exit point.
static DtVrfProcessStateRepository * creator(const DtString &rwName, DtLocalObject *vrfObject, DtReaderWriterRegistry *parentRegistry)
Factory function to create a new instance of this PSR.
DtVreLadderClimbingPSR & operator=(const DtVreLadderClimbingPSR &orig)
Assignment operator (not implemented)
virtual void setTerrainHeightGeodetic(double altitude)
Sets the terrain height in geodetic coordinates.
virtual void setLadderBaseForSearch(const DtVector &ladderBase)
Sets the ladder base position for search operations.
DtRwReal myTimeToGetOnLadder
Time to finish mounting the ladder.
Definition vreLadderClimbingPSR.h:282
virtual void setLadderStandoffOffset(const DtVector &offset)
Sets the ladder standoff offset.
DtRwVector myLadderBaseForSearch
Ladder base for search operations.
Definition vreLadderClimbingPSR.h:312
DtVreLadderClimbingPSR(DtLocalObject *vrfObject, const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0)
Constructor with VRF object and optional name.
virtual void setLadder(const DtLadder &ladder)
Sets the current ladder.
virtual void setOrientationOnGround(const DtTaitBryan &orientation)
Sets the entity's orientation when on the ground.
virtual double timeToGetOnLadder() const
Gets the simulation time when the entity will finish mounting the ladder.
DtRwInt myLadderClimbingState
Current ladder climbing state.
Definition vreLadderClimbingPSR.h:258
virtual DtVector ladderEntryPoint() const
Gets the ladder entry point.
virtual DtTaitBryan orientationOnGround() const
Gets the entity's orientation when on the ground.
virtual void setLadderExitPoint(const DtVector &ladderAccessPoint)
Sets the ladder exit point.
DtRwVector myLadderStandoffOffset
Ladder standoff offset.
Definition vreLadderClimbingPSR.h:294
DtRwReal myTerrainHeightGeodetic
Terrain height in geodetic coordinates.
Definition vreLadderClimbingPSR.h:306
DtTaitBryan myOrientationOnGround
Entity orientation when on the ground.
Definition vreLadderClimbingPSR.h:300
virtual void setTimeToGetOffLadder(double simTime)
Sets the simulation time when the entity will finish dismounting the ladder.
Export macros for the VREngage Object Core library.
#define VREVRFOBJCORE_DLL
Platform-specific DLL export/import declaration.
Definition export.h:27
Ladder representation class for VREngage.
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVreLadderClimbingProcessStateRepositoryDefaultName[]
Default name for the ladder climbing process state repository.
Definition vreLadderClimbingPSR.h:37
const char DtVreLadderClimbingPSRType[]
Type identifier string for the ladder climbing process state repository.
Definition vreLadderClimbingPSR.h:34
enum DtLadderClimbingState { DtOffLadder=0, DtGettingOnLadder, DtOnLadderAtAccessPoint, DtOnLadder, DtGettingOffLadder, DtOffLadderAtExitPoint } DtLadderClimbingState
Enumeration of ladder climbing states.
Definition vreLadderClimbingPSR.h:45