Flyby SDK v0.3.0
Loading...
Searching...
No Matches
payload.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <string>
11#include <vector>
12
13#include <flyby/drone/drone.h>
15
16namespace flyby {
17 class Camera;
18 class IRCamera;
19 class GimbalInterface;
20 class LRFInterface;
21 class StreamInterface;
22
28 class PayloadInterface : public Component {
29 public:
30 friend class ComponentHandler;
31
32 virtual void register_stream(std::shared_ptr<StreamInterface> stream) = 0;
33
34 virtual void register_gimbal(std::shared_ptr<GimbalInterface> gimbal) = 0;
35
36 virtual void register_lrf(std::shared_ptr<LRFInterface> lrf) = 0;
37
38 [[nodiscard]] virtual std::string get_version() const = 0;
39
40 [[nodiscard]] virtual unsigned int get_port() const = 0;
41
42 [[nodiscard]] virtual const std::vector<std::shared_ptr<const StreamInterface>>& get_streams_const() const = 0;
43
44 [[nodiscard]] virtual const std::vector<std::shared_ptr<const GimbalInterface>>& get_gimbals_const() const = 0;
45
46 [[nodiscard]] virtual const std::vector<std::shared_ptr<const LRFInterface>>& get_lrfs_const() const = 0;
47
48 protected:
50
51 private:
52 virtual void set_port(unsigned int port) = 0;
53
54 virtual std::vector<std::shared_ptr<StreamInterface>>& get_streams() = 0;
55 virtual std::vector<std::shared_ptr<GimbalInterface>>& get_gimbals() = 0;
56 virtual std::vector<std::shared_ptr<LRFInterface>>& get_lrfs() = 0;
57
58 virtual std::shared_ptr<StreamInterface> get_active_stream() = 0;
59 virtual std::shared_ptr<GimbalInterface> get_active_gimbal() = 0;
60 virtual std::shared_ptr<LRFInterface> get_active_lrf() = 0;
61 };
62
71 class Payload : public PayloadInterface {
72 public:
82 Payload(const std::string& name, const std::string& version);
83
95 Payload(const std::string& name, const std::string& version, unsigned int port, const std::string& uuid);
96
97 ~Payload() override;
98
104 void register_stream(std::shared_ptr<StreamInterface> stream) final;
105
111 void register_gimbal(std::shared_ptr<GimbalInterface> gimbal) final;
112
118 void register_lrf(std::shared_ptr<LRFInterface> lrf) final;
119
125 [[nodiscard]] std::string get_version() const final;
126
132 [[nodiscard]] unsigned int get_port() const final;
133
139 [[nodiscard]] const std::vector<std::shared_ptr<const StreamInterface>>& get_streams_const() const final;
140
146 [[nodiscard]] const std::vector<std::shared_ptr<const GimbalInterface>>& get_gimbals_const() const final;
147
153 [[nodiscard]] const std::vector<std::shared_ptr<const LRFInterface>>& get_lrfs_const() const final;
154
155 private:
156 std::string m_version;
157
158 unsigned int m_port;
159
160 unsigned int m_active_stream_idx;
161 unsigned int m_active_gimbal_idx;
162 unsigned int m_active_lrf_idx;
163
164 std::vector<std::shared_ptr<StreamInterface>> m_streams;
165 std::vector<std::shared_ptr<GimbalInterface>> m_gimbals;
166 std::vector<std::shared_ptr<LRFInterface>> m_lrfs;
167
168 void set_port(unsigned int port) final;
169
170 std::vector<std::shared_ptr<StreamInterface>>& get_streams() final;
171 std::vector<std::shared_ptr<GimbalInterface>>& get_gimbals() final;
172 std::vector<std::shared_ptr<LRFInterface>>& get_lrfs() final;
173
174 std::shared_ptr<StreamInterface> get_active_stream() final;
175 std::shared_ptr<GimbalInterface> get_active_gimbal() final;
176 std::shared_ptr<LRFInterface> get_active_lrf() final;
177 };
178}
Component()=default
The default constructor.
The class containing all of the payload configurations.
Definition payload.h:71
const std::vector< std::shared_ptr< const StreamInterface > > & get_streams_const() const final
Get the streams.
void register_lrf(std::shared_ptr< LRFInterface > lrf) final
Registers a new laser range finder as part of the payload.
std::string get_version() const final
Returns the version of the payload service.
Payload(const std::string &name, const std::string &version, unsigned int port, const std::string &uuid)
Internal payload constructor.
const std::vector< std::shared_ptr< const LRFInterface > > & get_lrfs_const() const final
Get the LRFInterfaces.
const std::vector< std::shared_ptr< const GimbalInterface > > & get_gimbals_const() const final
Get the gimbals.
unsigned int get_port() const final
Returns the port of the payload service.
void register_gimbal(std::shared_ptr< GimbalInterface > gimbal) final
Registers a new gimbal as part of the payload.
void register_stream(std::shared_ptr< StreamInterface > stream) final
Registers a new stream as part of the payload.
Payload(const std::string &name, const std::string &version)
Creates a new payload.