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;
81 }
82
83 /**
84 * @brief Retrieves the unique ID of the transmitter.
85 *
86 * @return The transmitter SimId.
87 */
89
90 /**
91 * @brief Gets the operational mode of the transmitter.
92 *
93 * @return The operational mode (PULSED_MODE or CW_MODE).
94 */
96
97 /**
98 * @brief Sets the operational mode of the transmitter.
99 *
100 * @param mode The operational mode (PULSED_MODE or CW_MODE).
101 */
102 void setMode(OperationMode mode) noexcept { _mode = mode; }
103
104 /**
105 * @brief Sets the radar signal wave to be transmitted.
106 *
107 * @param pulse Pointer to the RadarSignal object representing the wave.
108 */
109 void setWave(fers_signal::RadarSignal* pulse) noexcept { _signal = pulse; }
110
111 /**
112 * @brief Sets the radar signal wave to be transmitted.
113 *
114 * @param signal Pointer to the RadarSignal object to be transmitted.
115 */
116 void setSignal(fers_signal::RadarSignal* signal) noexcept { _signal = signal; }
117
118 /**
119 * @brief Sets the pulse repetition frequency (PRF) of the transmitter.
120 *
121 * @param mprf Desired PRF to be set.
122 */
123 void setPrf(RealType mprf) noexcept;
124
125 /**
126 * @brief Sets the active schedule for the transmitter.
127 *
128 * The provided schedule should be pre-validated and sorted.
129 * @param schedule A vector of active periods.
130 */
131 void setSchedule(std::vector<SchedulePeriod> schedule);
132
133 /**
134 * @brief Retrieves the list of active transmission periods.
135 * @return A const reference to the schedule vector.
136 */
137 [[nodiscard]] const std::vector<SchedulePeriod>& getSchedule() const noexcept { return _schedule; }
138
139 /**
140 * @brief Determines the valid simulation time for a pulse at or after the given time.
141 *
142 * If the requested time falls within an active period, it is returned.
143 * If it falls in a gap between periods, the start of the next period is returned.
144 * If it falls after all periods, std::nullopt is returned.
145 * If no schedule is defined, the transmitter is considered "always on".
146 *
147 * @param time The proposed pulse time.
148 * @return The actual pulse time, or nullopt if no valid time exists.
149 */
150 [[nodiscard]] std::optional<RealType> getNextPulseTime(RealType time) const;
151
152 private:
153 fers_signal::RadarSignal* _signal = nullptr; ///< Pointer to the radar signal being transmitted.
154
155 RealType _prf = {}; ///< The pulse repetition frequency (PRF) of the transmitter.
156
157 OperationMode _mode; ///< The operational mode of the transmitter.
158 std::vector<SchedulePeriod> _schedule; ///< The schedule of active periods.
159 };
160
161}
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:50
SimId getId() const noexcept
Retrieves the unique ID of the radar object.
Definition radar_obj.h:86
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:88
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:95
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
@ 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