FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
radar_obj.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2006-2008 Marc Brooker and Michael Inggs
4// Copyright (c) 2008-present FERS Contributors (see AUTHORS.md).
5//
6// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
7
8/**
9 * @file radar_obj.h
10 * @brief Defines the Radar class and associated functionality.
11 */
12
13#pragma once
14
15#include <cstdint>
16
17#include "core/sim_id.h"
18#include "object.h"
19
20namespace timing
21{
22 class Timing;
23}
24
25namespace antenna
26{
27 class Antenna;
28}
29
30namespace radar
31{
32 class Platform;
33
34 /**
35 * @enum OperationMode
36 * @brief Defines the operational mode of a radar component.
37 */
38 enum class OperationMode : std::uint8_t
39 {
40 PULSED_MODE, ///< The component operates in a pulsed mode.
41 CW_MODE, ///< The component operates in a continuous-wave mode.
42 FMCW_MODE, ///< The component operates in an FMCW streaming mode.
43 SFCW_MODE ///< The component operates in a stepped-frequency CW streaming mode.
44 };
45
46 /**
47 * @class Radar
48 * @brief Represents a radar system on a platform.
49 */
50 class Radar : public Object
51 {
52 public:
53 /**
54 * @brief Constructs a Radar object.
55 *
56 * @param platform Pointer to the platform on which the radar is mounted.
57 * @param name Name of the radar object.
58 */
59 Radar(Platform* platform, std::string name, const SimId id = 0) noexcept :
61 id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Unknown) : id)
62 {
63 }
64
65 ~Radar() override = default;
66
67 Radar(const Radar&) = delete;
68
69 Radar& operator=(const Radar&) = delete;
70
71 Radar(Radar&&) = delete;
72
73 Radar& operator=(Radar&&) = delete;
74
75 /**
76 * @brief Retrieves the attached radar object.
77 *
78 * @return Pointer to the attached radar object.
79 */
80 [[nodiscard]] const Radar* getAttached() const noexcept { return _attached; }
81
82 /**
83 * @brief Retrieves the unique ID of the radar object.
84 *
85 * @return The radar SimId.
86 */
88
89 /**
90 * @brief Gets the antenna associated with this radar.
91 *
92 * @return Pointer to the associated antenna.
93 */
94 [[nodiscard]] const antenna::Antenna* getAntenna() const noexcept { return _antenna; }
95
96 /**
97 * @brief Calculates the radar gain based on input angles and wavelength.
98 *
99 * @param angle The radar's pointing angle.
100 * @param refangle The reference angle for comparison.
101 * @param wavelength The wavelength of the radar signal.
102 * @return The calculated radar gain.
103 */
105 RealType wavelength) const;
106
107 /**
108 * @brief Gets the noise temperature of the radar.
109 *
110 * @param angle The angle at which the noise temperature is calculated.
111 * @return The calculated noise temperature.
112 */
113 [[nodiscard]] virtual RealType getNoiseTemperature(const math::SVec3& angle) const noexcept;
114
115 /**
116 * @brief Retrieves the timing source for the radar.
117 *
118 * @return Shared pointer to the timing source.
119 */
120 [[nodiscard]] std::shared_ptr<timing::Timing> getTiming() const;
121
122 /**
123 * @brief Sets the timing source for the radar.
124 *
125 * @param tim Shared pointer to the timing source to set.
126 */
127 void setTiming(const std::shared_ptr<timing::Timing>& tim);
128
129 /**
130 * @brief Sets the antenna for the radar.
131 *
132 * @param ant Pointer to the antenna to set.
133 */
134 void setAntenna(const antenna::Antenna* ant);
135
136 /**
137 * @brief Attaches another radar object to this radar.
138 *
139 * @param obj Pointer to the radar object to attach.
140 * @throws std::runtime_error If another object is already attached.
141 */
142 void setAttached(const Radar* obj);
143
144 protected:
145 std::shared_ptr<timing::Timing> _timing; ///< Timing source for the radar.
146
147 private:
148 const antenna::Antenna* _antenna{nullptr}; ///< Antenna object associated with the radar.
149 const Radar* _attached{nullptr}; ///< Attached radar object.
150 };
151}
Thread-safe Meyers singleton for generating unique object IDs.
Definition sim_id.h:42
Abstract base class representing an antenna.
A class representing a vector in spherical coordinates.
Represents a physical object in the radar system.
Definition object.h:25
SimId getId() const noexcept
Retrieves the unique ID of the object.
Definition object.h:72
Represents a simulation platform with motion and rotation paths.
Definition platform.h:32
Represents a radar system on a platform.
Definition radar_obj.h:51
std::shared_ptr< timing::Timing > _timing
Timing source for the radar.
Definition radar_obj.h:145
const Radar * getAttached() const noexcept
Retrieves the attached radar object.
Definition radar_obj.h:80
~Radar() override=default
void setAntenna(const antenna::Antenna *ant)
Sets the antenna for the radar.
Definition radar_obj.cpp:46
const antenna::Antenna * getAntenna() const noexcept
Gets the antenna associated with this radar.
Definition radar_obj.h:94
std::shared_ptr< timing::Timing > getTiming() const
Retrieves the timing source for the radar.
Definition radar_obj.cpp:66
Radar(const Radar &)=delete
void setAttached(const Radar *obj)
Attaches another radar object to this radar.
Definition radar_obj.cpp:56
Radar & operator=(const Radar &)=delete
Radar & operator=(Radar &&)=delete
SimId getId() const noexcept
Retrieves the unique ID of the radar object.
Definition radar_obj.h:87
Radar(Radar &&)=delete
RealType getGain(const math::SVec3 &angle, const math::SVec3 &refangle, RealType wavelength) const
Calculates the radar gain based on input angles and wavelength.
Definition radar_obj.cpp:26
virtual RealType getNoiseTemperature(const math::SVec3 &angle) const noexcept
Gets the noise temperature of the radar.
Definition radar_obj.cpp:31
Radar(Platform *platform, std::string name, const SimId id=0) noexcept
Constructs a Radar object.
Definition radar_obj.h:59
void setTiming(const std::shared_ptr< timing::Timing > &tim)
Sets the timing source for the radar.
Definition radar_obj.cpp:36
double RealType
Type for real numbers.
Definition config.h:27
OperationMode
Defines the operational mode of a radar component.
Definition radar_obj.h:39
@ SFCW_MODE
The component operates in a stepped-frequency CW streaming mode.
@ PULSED_MODE
The component operates in a pulsed mode.
@ CW_MODE
The component operates in a continuous-wave mode.
@ FMCW_MODE
The component operates in an FMCW streaming mode.
Base class for all physical objects in the radar system.
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
ObjectType
Categorizes objects for ID generation.
Definition sim_id.h:25
math::Vec3 max