FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
transmitter.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 transmitter.h
10 * @brief Header file for the Transmitter class in the radar namespace.
11 */
12
13#pragma once
14
15#include <optional>
16
17#include "core/sim_id.h"
18#include "radar_obj.h"
19#include "schedule_period.h"
20
21namespace fers_signal
22{
23 class FmcwChirpSignal;
24 class RadarSignal;
25}
26
27namespace radar
28{
29 /**
30 * @class Transmitter
31 * @brief Represents a radar transmitter system.
32 */
33 class Transmitter final : public Radar
34 {
35 public:
36 /**
37 * @brief Constructor for the Transmitter class.
38 *
39 * @param platform Pointer to the platform object.
40 * @param name Name of the transmitter.
41 * @param mode The operational mode (PULSED_MODE or CW_MODE).
42 */
43 Transmitter(Platform* platform, std::string name, const OperationMode mode, const SimId id = 0) noexcept :
44 Radar(platform, std::move(name),
45 id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Transmitter) : id),
46 _mode(mode)
47 {
48 }
49
50 ~Transmitter() override = default;
51
52 Transmitter(const Transmitter&) = delete;
53
55
57
59
60 /**
61 * @brief Retrieves the pulse repetition frequency (PRF).
62 *
63 * @return The current PRF of the transmitter.
64 */
65 [[nodiscard]] RealType getPrf() const noexcept { return _prf; }
66
67 /**
68 * @brief Retrieves the radar signal currently being transmitted.
69 *
70 * @return Pointer to the RadarSignal object being transmitted.
71 */
73
74 /// Gets the FMCW chirp signal when this transmitter uses one.
76
77 /// Returns true when the transmitter uses a continuous streaming mode.
79 {
80 return _mode == OperationMode::CW_MODE || _mode == OperationMode::FMCW_MODE ||
82 }
83
84 /**
85 * @brief Retrieves the unique ID of the transmitter.
86 *
87 * @return The transmitter SimId.
88 */
90
91 /**
92 * @brief Gets the operational mode of the transmitter.
93 *
94 * @return The operational mode (PULSED_MODE or CW_MODE).
95 */
97
98 /**
99 * @brief Sets the operational mode of the transmitter.
100 *
101 * @param mode The operational mode (PULSED_MODE or CW_MODE).
102 */
103 void setMode(OperationMode mode) noexcept { _mode = mode; }
104
105 /**
106 * @brief Sets the radar signal wave to be transmitted.
107 *
108 * @param pulse Pointer to the RadarSignal object representing the wave.
109 */
110 void setWave(fers_signal::RadarSignal* pulse) noexcept { _signal = pulse; }
111
112 /**
113 * @brief Sets the radar signal wave to be transmitted.
114 *
115 * @param signal Pointer to the RadarSignal object to be transmitted.
116 */
117 void setSignal(fers_signal::RadarSignal* signal) noexcept { _signal = signal; }
118
119 /**
120 * @brief Sets the pulse repetition frequency (PRF) of the transmitter.
121 *
122 * @param mprf Desired PRF to be set.
123 */
124 void setPrf(RealType mprf) noexcept;
125
126 /**
127 * @brief Sets the active schedule for the transmitter.
128 *
129 * The provided schedule should be pre-validated and sorted.
130 * @param schedule A vector of active periods.
131 */
132 void setSchedule(std::vector<SchedulePeriod> schedule);
133
134 /**
135 * @brief Retrieves the list of active transmission periods.
136 * @return A const reference to the schedule vector.
137 */
138 [[nodiscard]] const std::vector<SchedulePeriod>& getSchedule() const noexcept { return _schedule; }
139
140 /**
141 * @brief Determines the valid simulation time for a pulse at or after the given time.
142 *
143 * If the requested time falls within an active period, it is returned.
144 * If it falls in a gap between periods, the start of the next period is returned.
145 * If it falls after all periods, std::nullopt is returned.
146 * If no schedule is defined, the transmitter is considered "always on".
147 *
148 * @param time The proposed pulse time.
149 * @return The actual pulse time, or nullopt if no valid time exists.
150 */
151 [[nodiscard]] std::optional<RealType> getNextPulseTime(RealType time) const;
152
153 private:
154 fers_signal::RadarSignal* _signal = nullptr; ///< Pointer to the radar signal being transmitted.
155
156 RealType _prf = {}; ///< The pulse repetition frequency (PRF) of the transmitter.
157
158 OperationMode _mode; ///< The operational mode of the transmitter.
159 std::vector<SchedulePeriod> _schedule; ///< The schedule of active periods.
160 };
161
162}
Thread-safe Meyers singleton for generating unique object IDs.
Definition sim_id.h:42
FMCW linear chirp signal implementation.
Class representing a radar signal with associated properties.
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
SimId getId() const noexcept
Retrieves the unique ID of the radar object.
Definition radar_obj.h:87
Represents a radar transmitter system.
Definition transmitter.h:34
void setWave(fers_signal::RadarSignal *pulse) noexcept
Sets the radar signal wave to be transmitted.
Transmitter & operator=(const Transmitter &)=delete
void setMode(OperationMode mode) noexcept
Sets the operational mode of the transmitter.
SimId getId() const noexcept
Retrieves the unique ID of the transmitter.
Definition transmitter.h:89
RealType getPrf() const noexcept
Retrieves the pulse repetition frequency (PRF).
Definition transmitter.h:65
fers_signal::RadarSignal * getSignal() const noexcept
Retrieves the radar signal currently being transmitted.
Definition transmitter.h:72
~Transmitter() override=default
Transmitter(const Transmitter &)=delete
std::optional< RealType > getNextPulseTime(RealType time) const
Determines the valid simulation time for a pulse at or after the given time.
Transmitter & operator=(Transmitter &&)=delete
bool isStreamingMode() const noexcept
Returns true when the transmitter uses a continuous streaming mode.
Definition transmitter.h:78
const std::vector< SchedulePeriod > & getSchedule() const noexcept
Retrieves the list of active transmission periods.
OperationMode getMode() const noexcept
Gets the operational mode of the transmitter.
Definition transmitter.h:96
Transmitter(Platform *platform, std::string name, const OperationMode mode, const SimId id=0) noexcept
Constructor for the Transmitter class.
Definition transmitter.h:43
void setSignal(fers_signal::RadarSignal *signal) noexcept
Sets the radar signal wave to be transmitted.
void setSchedule(std::vector< SchedulePeriod > schedule)
Sets the active schedule for the transmitter.
const fers_signal::FmcwChirpSignal * getFmcwSignal() const noexcept
Gets the FMCW chirp signal when this transmitter uses one.
Transmitter(Transmitter &&)=delete
void setPrf(RealType mprf) noexcept
Sets the pulse repetition frequency (PRF) of the transmitter.
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.
@ CW_MODE
The component operates in a continuous-wave mode.
@ FMCW_MODE
The component operates in an FMCW streaming mode.
Defines the Radar class and associated functionality.
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