VR-Engage  2.2
Loading...
Searching...
No Matches
vreRadarObjectSensor.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreRadarObjectSensor.h
7//! \ingroup vreVrfmodel
8//! \brief Radar sensor for detecting objects and publishing emitter systems
9//!
10//! This file defines the DtVreRadarObjectSensor class which extends the radar
11//! object sensor to provide enhanced functionality for VR-Engage. It manages
12//! radar emitter systems, detection parameters, and designated target tracking.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
17#include <vrfmodel/radarObjectSensor.h>
18#include "vreVrfModel/vreSimComponent.h"
19
20namespace makVre
21{
25
26//! \brief Type identifier for the VRE radar object sensor component
27const char DtVreRadarObjectSensorType[] = "vre-radar-object-sensor";
28
29//! \brief Radar sensor for detecting objects and publishing emitter systems
30//!
31//! DtVreRadarObjectSensor extends the base radar object sensor to provide
32//! enhanced functionality for VR-Engage. It manages radar emitter systems,
33//! detection parameters, and designated target tracking. The sensor publishes
34//! radar emissions through DIS emitter systems and provides an interface for
35//! target designation and tracking.
36//!
37//! This class serves as a base class for more specialized radar sensor types
38//! like the Simple Radar Object Sensor.
39class VREVRFMODEL_DLL DtVreRadarObjectSensor : public DtVreSimComponent<DtRadarObjectSensor>
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 using DtSignatureObjectSensor::tick;
62
63 //! \brief Constructor
64 //! \param name The name of this component
65 //! \param owner The local object that owns this component
66 //! \param simManager The simulation services manager
67 //! \param desc Component descriptor with configuration parameters
68 //! \param parentRegistry Optional parent registry for reader/writer functionality
69 //!
70 //! Creates a new radar object sensor component with the specified parameters.
71 DtVreRadarObjectSensor(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 radar object sensor component,
77 //! including the radar state monitor and emitter systems.
78 virtual ~DtVreRadarObjectSensor() override;
79
80 //! \brief Initializes the radar sensor component
81 //! \return True if initialization is successful, false otherwise
82 //!
83 //! Performs component initialization, including setting up the radar
84 //! emitter systems, sensor monitors, and attribute providers.
85 virtual bool init() override;
86
87 //! \brief Gets the type identifier for this component
88 //! \return String identifying the component type (DtVreRadarObjectSensorType)
89 //!
90 //! Implements the DtSimComponent::type() method to return the
91 //! type identifier for this component.
92 virtual const char* type() const override;
93
94 //! \brief Gets the sensor type identifier
95 //! \return Integer identifying the sensor type (DtSensorTypeRadar)
96 //!
97 //! Returns the sensor type identifier, which is used to categorize
98 //! this sensor as a radar sensor type.
99 virtual int sensorType() const override;
100
101 //! \brief Updates the radar sensor state each simulation frame
102 //!
103 //! This method handles several radar operations during each tick:
104 //! - Turns on the emitter system in the first tick, as indicated in myRadarObjectPsr
105 //! - When it's time for the next detection attempt (cached in myRadarObjectPsr),
106 //! calls the base sensor's tick() and computes the time to next detection attempt
107 //! - If the entity is destroyed, calls destroyEmitterSystem()
108 //! - If the entity has been restored, calls createAndInitEmitterSystem()
109 //! - Updates the emitter system's state by calling its tick() method
110 virtual void tick() override;
111
112 //! \brief Creates and initializes sensor monitors
113 //! \return True if monitors were successfully created and initialized, false otherwise
114 //!
115 //! Creates and initializes the sensor monitors used to communicate with visualization
116 //! clients, including the radar state monitor. Overrides the base class implementation.
117 virtual bool createAndInitSensorMonitors() override;
118
119 //! \brief Creates and initializes the radar settings monitor
120 //! \return True if the monitor was successfully created and initialized, false otherwise
121 //!
122 //! Creates and initializes the radar settings monitor which handles communication
123 //! about radar settings between the simulation and visualization clients.
125
126 //! \brief Static callback function for radar settings messages
127 //! \param msg The simulation message containing radar settings
128 //! \param usrData User data pointer, typically pointing to an instance of this class
129 //!
130 //! Static function registered as a callback to handle radar settings messages.
131 //! Forwards the message to the appropriate instance's processSetRadarSettings method.
132 static void setRadarSettingsCallback(DtSimMessage* msg, void* usrData);
133
134 //! \brief Processes a radar settings message
135 //! \param msg The simulation message containing radar settings
136 //!
137 //! Updates the radar's settings based on the message content. This can include
138 //! changes to scan patterns, detection ranges, and other radar parameters.
139 virtual void processSetRadarSettings(DtSimMessage* msg);
140
141 //! \brief Static callback function for designated target requests
142 //! \param usrData User data pointer, typically pointing to an instance of this class
143 //! \return Reader/writer containing information about the designated target
144 //!
145 //! Static function registered as a callback to handle requests for information
146 //! about the current designated target. Forwards the request to the appropriate
147 //! instance's processProvideDesignatedTarget method.
148 static DtReaderWriter* provideDesignatedTargetCallback(void* usrData);
149
150 //! \brief Provides information about the currently designated target
151 //! \return Reader/writer containing information about the designated target
152 //!
153 //! Pure virtual method that must be implemented by derived classes to provide
154 //! information about the currently designated target. This information is used
155 //! by other components to identify which target the radar is currently tracking.
156 virtual DtReaderWriter* processProvideDesignatedTarget() = 0;
157
158 //! \brief Sets the list of designated targets for the radar
159 //! \param trackIds Vector of track IDs to designate
160 //!
161 //! Pure virtual method that must be implemented by derived classes to set
162 //! the designated targets for the radar. The order of track IDs in the vector
163 //! may represent their priority, depending on the implementation.
164 virtual void setDesignatedTargets(const std::vector<int>& trackIds) = 0;
165
166 //! \brief Clears all designated targets from the radar
167 //!
168 //! Pure virtual method that must be implemented by derived classes to clear
169 //! all current target designations. This removes all target designations,
170 //! restoring the radar to a standard search/track state.
171 virtual void clearDesignatedTargets() = 0;
172
173protected:
174 //! \brief Updates the radar's detection area based on current settings
175 //!
176 //! Updates the sensor's geometry evaluator and emitter beam angles according
177 //! to the current radar settings. This adjusts the detection capabilities of
178 //! the radar based on parameters such as scan pattern, range, and field of view.
179 virtual void updateDetectionArea();
180
181 //! \brief Registers attribute provider functions
182 //!
183 //! Registers attribute provider functions with the attribute executive,
184 //! including the "designated-target" attribute. These attributes allow
185 //! other components to query information about the radar's current state.
186 virtual void registerAttributeFunctions() override;
187
188 //! \brief Gets the default process state repository type
189 //! \return String identifying the default PSR type
190 //!
191 //! Returns the default process state repository type for this component.
192 //! This determines what type of state repository will be created for
193 //! storing the radar's persistent state information.
194 virtual const char* defaultPSRType() const override;
195
196protected:
197 //! \brief Pointer to the radar state monitor
198 //!
199 //! Manages the communication of radar state information between the
200 //! simulation and visualization clients. Handles subscription requests
201 //! and sends updates when the radar state changes.
203
204 //! \brief Pointer to the radar sensor descriptor
205 //!
206 //! Contains configuration parameters for the radar sensor, such as
207 //! detection ranges, scan patterns, and emitter characteristics.
209
210 //! \brief Pointer to the radar sensor process state repository
211 //!
212 //! Contains the persistent state information for the radar sensor,
213 //! including current detection settings, scan state, and timing information.
215};
216
217} // namespace makVre
Monitor for managing radar state information communication.
Definition radarStateMonitor.h:32
Radar object sensor descriptor for VREngage.
Definition vreRadarObjectSensorDescriptor.h:37
virtual bool createAndInitSensorMonitors() override
Creates and initializes sensor monitors.
DtVreRadarObjectSensor()
Default constructor (not implemented)
virtual void updateDetectionArea()
Updates the radar's detection area based on current settings.
static void setRadarSettingsCallback(DtSimMessage *msg, void *usrData)
Static callback function for radar settings messages.
virtual void clearDesignatedTargets()=0
Clears all designated targets from the radar.
const DtVreRadarObjectSensorDescriptor * myRadarObjectDescriptor
Pointer to the radar sensor descriptor.
Definition vreRadarObjectSensor.h:208
DtVreRadarObjectSensorPSR * myRadarObjectPsr
Pointer to the radar sensor process state repository.
Definition vreRadarObjectSensor.h:214
virtual int sensorType() const override
Gets the sensor type identifier.
virtual const char * defaultPSRType() const override
Gets the default process state repository type.
virtual void registerAttributeFunctions() override
Registers attribute provider functions.
virtual bool createAndInitRadarSettingsMonitor()
Creates and initializes the radar settings monitor.
virtual bool init() override
Initializes the radar sensor component.
const DtVreRadarObjectSensor & operator=(const DtVreRadarObjectSensor &orig)
Assignment operator (not implemented)
static DtReaderWriter * provideDesignatedTargetCallback(void *usrData)
Static callback function for designated target requests.
DtVreRadarObjectSensor(const DtVreRadarObjectSensor &orig)
Copy constructor (not implemented)
virtual ~DtVreRadarObjectSensor() override
Virtual destructor.
virtual void tick() override
Updates the radar sensor state each simulation frame.
DtVreRadarObjectSensor(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual DtReaderWriter * processProvideDesignatedTarget()=0
Provides information about the currently designated target.
virtual void processSetRadarSettings(DtSimMessage *msg)
Processes a radar settings message.
virtual const char * type() const override
Gets the type identifier for this component.
virtual void setDesignatedTargets(const std::vector< int > &trackIds)=0
Sets the list of designated targets for the radar.
DtRadarStateMonitor * myRadarStateMonitor
Pointer to the radar state monitor.
Definition vreRadarObjectSensor.h:202
Extended radar object sensor process state repository for VREngage.
Definition vreRadarObjectSensorPSR.h:34
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 DtVreRadarObjectSensorType[]
Type identifier for the VRE radar object sensor component.
Definition vreRadarObjectSensor.h:27