VR-Engage  2.2
Loading...
Searching...
No Matches
vreLasingMissileTrackController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreLasingMissileTrackController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for laser-guided missile tracking with LOAL capability
9//!
10//! This file defines the DtVreLasingMissileTrackController class which extends
11//! the base lasing missile track controller to support "Lock On After Launch" (LOAL)
12//! mode by following a designated path before enabling laser tracking.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
17#include <vrfmodel/lasingMissileTrackController.h>
19
20class DtSimulationServices;
21class DtSimMessage;
22class DtReflectedDesignator;
23class DtLaserTrackerPSR;
24class DtVreLasingMissileTrackControllerDescriptor;
25
26//! \brief Controller for laser-guided missiles with LOAL capability
27//!
28//! This controller extends the base laser tracking controller by looking for extended
29//! data that defines a path for the missile to follow before enabling laser tracking.
30//! This allows the missile to be fired in "Lock On After Launch" (LOAL) mode, where
31//! the missile follows a predetermined path until it acquires the laser-designated target.
32//! The controller is designed for use with the VRE_Fire_missile lua task and
33//! uses the descriptor type DtComponentDescriptor.
34namespace makVre
35{
36//! \brief Type identifier for the VRE lasing missile track controller component
37const char DtVreLasingMissileTrackControllerType[] = "vre-lasing-missile-track-controller";
38
39class VREVRFMODEL_DLL DtVreLasingMissileTrackController : public DtVreSimComponent<DtLasingMissileTrackController>
40{
41private:
42 //! \brief Default constructor (not implemented)
43 //!
44 //! Default constructor is private and not implemented to prevent
45 //! creation of instances without proper initialization.
47
48 //! \brief Copy constructor (not implemented)
49 //!
50 //! Copy constructor is private and not implemented to prevent
51 //! copy construction.
53
54 //! \brief Assignment operator (not implemented)
55 //! \return Reference to this object
56 //!
57 //! Assignment operator is private and not implemented to prevent assignment.
59
60public:
61 //! \brief Constructor
62 //! \param name The name of this component
63 //! \param owner The local object that owns this component
64 //! \param simManager The simulation services manager
65 //! \param desc Component descriptor with configuration parameters
66 //! \param parentRegistry Optional parent registry for reader/writer functionality
67 //!
68 //! Creates a new lasing missile track controller with the specified parameters.
69 //! During construction, the controller initializes its internal state to prepare
70 //! for missile path tracking.
71 DtVreLasingMissileTrackController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
72 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
73
74 //! \brief Virtual destructor
75 //!
76 //! Cleans up resources used by the lasing missile track controller,
77 //! including deleting any allocated missile path waypoints.
79
80 //! \brief Gets the type identifier for this component
81 //! \return String identifying the component type (DtVreLasingMissileTrackControllerType)
82 //!
83 //! Implements the DtSimComponent::type() method to return the
84 //! type identifier for this component.
85 virtual const char* type() const override;
86
87 //! \brief Factory method to create a new instance of this component
88 //! \param name The name for the new component
89 //! \param owner The local object that will own this component
90 //! \param simManager The simulation services manager
91 //! \param desc Optional component descriptor
92 //! \param parentRegistry Optional parent registry for reader/writer functionality
93 //! \return Pointer to the newly created component
94 //!
95 //! Static factory method used by the component creation system to instantiate
96 //! new instances of this component type.
97 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
98 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
99
100protected:
101 //! \brief Initializes the missile's guidance path
102 //!
103 //! Parses the "missilePath" extended data to extract waypoints and timing
104 //! information for the missile's pre-tracking path. This method also handles
105 //! cleanup of any previously defined waypoints to ensure a fresh initialization.
106 //! This is called during controller initialization before tracking begins.
107 virtual void initializePath();
108
109 //! \brief Updates the missile's position along its pre-tracking path
110 //! \return True if the missile is still following its path (delaying tracking),
111 //! false if it has completed the path and should begin tracking
112 //!
113 //! Checks timers to determine if the missile should move on to the next
114 //! waypoint in its path. When the path is complete, the missile transitions
115 //! to actual laser tracking behavior. This implements the "Lock On After Launch"
116 //! functionality that allows the missile to follow a predetermined path
117 //! before acquiring the laser-designated target.
118 virtual bool updatePath();
119
120 //! \brief Sets up the control point for missile guidance
121 //! \return True if a valid control point was established, false otherwise
122 //!
123 //! Overrides the base behavior that tracks a laser spot to incorporate the
124 //! "missilePath" extended data functionality. This method is called from the
125 //! base class tick() implementation and handles both initializing and updating
126 //! the missile's path. Once the initial path is followed, control is handed
127 //! over to the standard laser tracking behavior from the base class.
128 virtual bool setupControlPoint() override;
129
130protected:
131 //! \brief Flag indicating whether this is the first control point setup
132 //!
133 //! When true, indicates that setupControlPoint() has not yet been called,
134 //! and the route needs to be initialized. After the first call, this is set
135 //! to false to prevent re-initialization.
137
138 //! \brief Timer tracking how long the missile has been following its current waypoint
139 //!
140 //! Set to simulation time when the entity started tracking the current waypoint.
141 //! Used to determine when to move to the next waypoint in the path.
143
144 //! \brief Collection of waypoints for the missile's pre-tracking path
145 //!
146 //! Contains pairs of target location vectors and the amount of time (in seconds)
147 //! that the missile should track each location before moving to the next waypoint.
148 //! When the missile has followed all waypoints, it transitions to laser tracking.
149 std::vector<std::pair<DtVector, double>> myDelayedTrackingPoints;
150};
151} // namespace makVre
virtual void initializePath()
Initializes the missile's guidance path.
virtual const char * type() const override
Gets the type identifier for this component.
virtual bool setupControlPoint() override
Sets up the control point for missile guidance.
std::vector< std::pair< DtVector, double > > myDelayedTrackingPoints
Collection of waypoints for the missile's pre-tracking path.
Definition vreLasingMissileTrackController.h:149
virtual ~DtVreLasingMissileTrackController() override
Virtual destructor.
double myPathTimer
Timer tracking how long the missile has been following its current waypoint.
Definition vreLasingMissileTrackController.h:142
DtVreLasingMissileTrackController()
Default constructor (not implemented)
const DtVreLasingMissileTrackController & operator=(const DtVreLasingMissileTrackController &orig)
Assignment operator (not implemented)
DtVreLasingMissileTrackController(const DtVreLasingMissileTrackController &orig)
Copy constructor (not implemented)
virtual bool updatePath()
Updates the missile's position along its pre-tracking path.
DtVreLasingMissileTrackController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
bool myFirstSetupControlPoint
Flag indicating whether this is the first control point setup.
Definition vreLasingMissileTrackController.h:136
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.
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 DtVreLasingMissileTrackControllerType[]
Type identifier for the VRE lasing missile track controller component.
Definition vreLasingMissileTrackController.h:37
Base template class for VR-Engage simulation components.