FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
platform.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 platform.h
10 * @brief Defines the Platform class used in radar simulation.
11 */
12
13#pragma once
14
15#include <memory>
16#include <string>
17#include <utility>
18
19#include "core/config.h"
20#include "core/sim_id.h"
21#include "math/geometry_ops.h"
22#include "math/path.h"
23#include "math/rotation_path.h"
24
25namespace radar
26{
27 /**
28 * @class Platform
29 * @brief Represents a simulation platform with motion and rotation paths.
30 */
32 {
33 public:
34 /**
35 * @brief Constructs a Platform with the specified name.
36 *
37 * @param name The name of the platform.
38 */
39 explicit Platform(std::string name, const SimId id = 0) noexcept :
40 _motion_path(std::make_unique<math::Path>()), _rotation_path(std::make_unique<math::RotationPath>()),
41 _id(id == 0 ? SimIdGenerator::instance().generateId(ObjectType::Platform) : id), _name(std::move(name))
42 {
43 }
44
45 Platform(const Platform&) = delete;
46
47 Platform& operator=(const Platform&) = delete;
48
49 ~Platform() = default;
50
51 Platform(Platform&&) = default;
52
54
55 /**
56 * @brief Gets the motion path of the platform.
57 *
58 * @return A pointer to the motion path of the platform.
59 */
60 [[nodiscard]] math::Path* getMotionPath() const noexcept { return _motion_path.get(); }
61
62 /**
63 * @brief Gets the rotation path of the platform.
64 *
65 * @return A pointer to the rotation path of the platform.
66 */
67 [[nodiscard]] math::RotationPath* getRotationPath() const noexcept { return _rotation_path.get(); }
68
69 /**
70 * @brief Gets the position of the platform at a specific time.
71 *
72 * @param time The time for which the position is requested.
73 * @return A vector representing the position of the platform.
74 */
75 [[nodiscard]] math::Vec3 getPosition(const RealType time) const { return _motion_path->getPosition(time); }
76
77 /**
78 * @brief Gets the rotation of the platform at a specific time.
79 *
80 * @param time The time for which the rotation is requested.
81 * @return A vector representing the rotation of the platform.
82 */
83 [[nodiscard]] math::SVec3 getRotation(const RealType time) const { return _rotation_path->getPosition(time); }
84
85 /**
86 * @brief Gets the name of the platform.
87 *
88 * @return A constant reference to the name of the platform.
89 */
90 [[nodiscard]] const std::string& getName() const noexcept { return _name; }
91
92 /**
93 * @brief Gets the unique ID of the platform.
94 *
95 * @return The platform SimId.
96 */
97 [[nodiscard]] SimId getId() const noexcept { return _id; }
98
99 /**
100 * @brief Sets the rotation path of the platform.
101 *
102 * @param path A unique pointer to the new rotation path.
103 */
104 void setRotationPath(std::unique_ptr<math::RotationPath> path) noexcept { _rotation_path = std::move(path); }
105
106 /**
107 * @brief Sets the motion path of the platform.
108 *
109 * @param path A unique pointer to the new motion path.
110 */
111 void setMotionPath(std::unique_ptr<math::Path> path) noexcept { _motion_path = std::move(path); }
112
113 /**
114 * @brief Sets the name of the platform.
115 *
116 * @param name The new name of the platform.
117 */
118 void setName(std::string name) noexcept { _name = std::move(name); }
119
120 private:
121 std::unique_ptr<math::Path> _motion_path; ///< The motion path of the platform.
122 std::unique_ptr<math::RotationPath> _rotation_path; ///< The rotation path of the platform.
123 SimId _id; ///< Unique ID for this platform.
124 std::string _name; ///< The name of the platform.
125 };
126}
Thread-safe Meyers singleton for generating unique object IDs.
Definition sim_id.h:42
Represents a path with coordinates and allows for various interpolation methods.
Definition path.h:30
Manages rotational paths with different interpolation techniques.
A class representing a vector in spherical coordinates.
A class representing a vector in rectangular coordinates.
Represents a simulation platform with motion and rotation paths.
Definition platform.h:32
SimId getId() const noexcept
Gets the unique ID of the platform.
Definition platform.h:97
math::Path * getMotionPath() const noexcept
Gets the motion path of the platform.
Definition platform.h:60
math::Vec3 getPosition(const RealType time) const
Gets the position of the platform at a specific time.
Definition platform.h:75
Platform(std::string name, const SimId id=0) noexcept
Constructs a Platform with the specified name.
Definition platform.h:39
Platform(Platform &&)=default
const std::string & getName() const noexcept
Gets the name of the platform.
Definition platform.h:90
void setName(std::string name) noexcept
Sets the name of the platform.
Definition platform.h:118
~Platform()=default
void setMotionPath(std::unique_ptr< math::Path > path) noexcept
Sets the motion path of the platform.
Definition platform.h:111
math::SVec3 getRotation(const RealType time) const
Gets the rotation of the platform at a specific time.
Definition platform.h:83
Platform & operator=(Platform &&)=default
math::RotationPath * getRotationPath() const noexcept
Gets the rotation path of the platform.
Definition platform.h:67
Platform & operator=(const Platform &)=delete
void setRotationPath(std::unique_ptr< math::RotationPath > path) noexcept
Sets the rotation path of the platform.
Definition platform.h:104
Platform(const Platform &)=delete
Global configuration file for the project.
double RealType
Type for real numbers.
Definition config.h:27
Classes and operations for 3D geometry.
Definition coord.h:18
Provides the definition and functionality of the Path class for handling coordinate-based paths with ...
Defines the RotationPath class for handling rotational paths with different interpolation types.
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
ObjectType
Categorizes objects for ID generation.
Definition sim_id.h:25