Flyby SDK v1.0.2
Loading...
Searching...
No Matches
payload.h
Go to the documentation of this file.
1
7
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 virtual void execute_action(std::string mission_name, unsigned int waypoint_idx) = 0;
49
50 protected:
52
53 private:
54 virtual void set_port(unsigned int port) = 0;
55
56 virtual std::vector<std::shared_ptr<StreamInterface>>& get_streams() = 0;
57 virtual std::vector<std::shared_ptr<GimbalInterface>>& get_gimbals() = 0;
58 virtual std::vector<std::shared_ptr<LRFInterface>>& get_lrfs() = 0;
59
60 virtual std::shared_ptr<StreamInterface> get_active_stream() = 0;
61 virtual std::shared_ptr<GimbalInterface> get_active_gimbal() = 0;
62 virtual std::shared_ptr<LRFInterface> get_active_lrf() = 0;
63 };
64
73 class Payload : public PayloadInterface {
74 public:
84 Payload(const std::string& name, std::string version);
85
97 Payload(const std::string& name, std::string version, unsigned int port, const std::string& uuid);
98
99 ~Payload() override;
100
106 void register_stream(std::shared_ptr<StreamInterface> stream) final;
107
113 void register_gimbal(std::shared_ptr<GimbalInterface> gimbal) final;
114
120 void register_lrf(std::shared_ptr<LRFInterface> lrf) final;
121
127 [[nodiscard]] std::string get_version() const final;
128
134 [[nodiscard]] unsigned int get_port() const final;
135
141 [[nodiscard]] const std::vector<std::shared_ptr<const StreamInterface>>& get_streams_const() const final;
142
148 [[nodiscard]] const std::vector<std::shared_ptr<const GimbalInterface>>& get_gimbals_const() const final;
149
155 [[nodiscard]] const std::vector<std::shared_ptr<const LRFInterface>>& get_lrfs_const() const final;
156
165 void execute_action(std::string mission_name, unsigned int waypoint_idx) override;
166
167 private:
168 std::string m_version;
169
170 unsigned int m_port;
171
172 unsigned int m_active_stream_idx;
173 unsigned int m_active_gimbal_idx;
174 unsigned int m_active_lrf_idx;
175
176 std::vector<std::shared_ptr<StreamInterface>> m_streams;
177 std::vector<std::shared_ptr<GimbalInterface>> m_gimbals;
178 std::vector<std::shared_ptr<LRFInterface>> m_lrfs;
179
180 void set_port(unsigned int port) final;
181
182 std::vector<std::shared_ptr<StreamInterface>>& get_streams() final;
183 std::vector<std::shared_ptr<GimbalInterface>>& get_gimbals() final;
184 std::vector<std::shared_ptr<LRFInterface>>& get_lrfs() final;
185
186 std::shared_ptr<StreamInterface> get_active_stream() final;
187 std::shared_ptr<GimbalInterface> get_active_gimbal() final;
188 std::shared_ptr<LRFInterface> get_active_lrf() final;
189 };
190} // namespace flyby
The base camera class.
Definition camera.h:188
Holds the common info for all SDK components.
Definition component.h:18
Component()=default
The default constructor.
The base infrared/thermal camera class.
Definition camera.h:661
const std::vector< std::shared_ptr< const StreamInterface > > & get_streams_const() const final
Get the streams.
Payload(const std::string &name, std::string version)
Creates a new payload.
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.
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 execute_action(std::string mission_name, unsigned int waypoint_idx) override
Execute actions at waypoints.
void register_gimbal(std::shared_ptr< GimbalInterface > gimbal) final
Registers a new gimbal as part of the payload.
Payload(const std::string &name, std::string version, unsigned int port, const std::string &uuid)
Internal payload constructor.
void register_stream(std::shared_ptr< StreamInterface > stream) final
Registers a new stream as part of the payload.