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 };
44
45 /**
46 * @class Radar
47 * @brief Represents a radar system on a platform.
48 */
49 class Radar : public Object
50 {
51 public:
52 /**
53 * @brief Constructs a Radar object.
54 *
55 * @param platform Pointer to the platform on which the radar is mounted.
56 * @param name Name of the radar object.
57 */
58 Radar(Platform* platform, std::string name, const SimId id = 0) noexcept :
60 id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Unknown) : id)
61 {
62 }
63
64 ~Radar() override = default;
65
66 Radar(const Radar&) = delete;
67
68 Radar& operator=(const Radar&) = delete;
69
70 Radar(Radar&&) = delete;
71
72 Radar& operator=(Radar&&) = delete;
73
74 /**
75 * @brief Retrieves the attached radar object.
76 *
77 * @return Pointer to the attached radar object.
78 */
79 [[nodiscard]] const Radar* getAttached() const noexcept { return _attached; }
80
81 /**
82 * @brief Retrieves the unique ID of the radar object.
83 *
84 * @return The radar SimId.
85 */
87
88 /**
89 * @brief Gets the antenna associated with this radar.
90 *
91 * @return Pointer to the associated antenna.
92 */
93 [[nodiscard]] const antenna::Antenna* getAntenna() const noexcept { return _antenna; }
94
95 /**
96 * @brief Calculates the radar gain based on input angles and wavelength.
97 *
98 * @param angle The radar's pointing angle.
99 * @param refangle The reference angle for comparison.
100 * @param wavelength The wavelength of the radar signal.
101 * @return The calculated radar gain.
102 */
104 RealType wavelength) const;
105
106 /**
107 * @brief Gets the noise temperature of the radar.
108 *
109 * @param angle The angle at which the noise temperature is calculated.
110 * @return The calculated noise temperature.
111 */
112 [[nodiscard]] virtual RealType getNoiseTemperature(const math::SVec3& angle) const noexcept;
113
114 /**
115 * @brief Retrieves the timing source for the radar.
116 *
117 * @return Shared pointer to the timing source.
118 */
119 [[nodiscard]] std::shared_ptr<timing::Timing> getTiming() const;
120
121 /**
122 * @brief Sets the timing source for the radar.
123 *
124 * @param tim Shared pointer to the timing source to set.
125 */
126 void setTiming(const std::shared_ptr<timing::Timing>& tim);
127
128 /**
129 * @brief Sets the antenna for the radar.
130 *
131 * @param ant Pointer to the antenna to set.
132 */
133 void setAntenna(const antenna::Antenna* ant);
134
135 /**
136 * @brief Attaches another radar object to this radar.
137 *
138 * @param obj Pointer to the radar object to attach.
139 * @throws std::runtime_error If another object is already attached.
140 */
141 void setAttached(const Radar* obj);
142
143 protected:
144 std::shared_ptr<timing::Timing> _timing; ///< Timing source for the radar.
145
146 private:
147 const antenna::Antenna* _antenna{nullptr}; ///< Antenna object associated with the radar.
148 const Radar* _attached{nullptr}; ///< Attached radar object.
149 };
150}
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:50
std::shared_ptr< timing::Timing > _timing
Timing source for the radar.
Definition radar_obj.h:144
const Radar * getAttached() const noexcept
Retrieves the attached radar object.
Definition radar_obj.h:79
~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:93
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:86
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:58
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
@ 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