Flyby SDK v1.0.2
Loading...
Searching...
No Matches
camera.h
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <vector>
11
13#include <flyby/util/error.h>
14
15namespace flyby {
20 enum CameraType : uint8_t {
21 STANDARD = 0,
22 THERMAL,
23 };
24
29 enum ZoomType : uint8_t {
30 MM = 0,
31 MULTIPLIER,
32 };
33
38 enum FocusMode : uint8_t {
39 F_AUTOMATIC = 0,
40 F_MANUAL,
41 };
42
47 enum ExposureProgramMode : uint8_t {
48 P_MANUAL = 0,
49 P_AUTOMATIC,
50 P_APERTURE_PRIORITY,
51 P_SHUTTER_PRIORITY,
52 };
53
58 enum TouchMode : uint8_t { T_DISABLED = 0, T_TRACKING, T_DETECTION };
59
64 enum IRPalette : uint8_t {
65 WHITEHOT = 0,
66 BLACKHOT,
67 LAVA,
68 IRONBOW,
69 ARCTIC,
70 GLOBOW,
71 RAINBOW,
72 RAINBOWHC,
73 HOTTEST,
74 ICEFIRE,
75 };
76
82 class CameraInterface : public Component {
83 public:
84 virtual void take_picture() = 0;
85
86 virtual void start_video_recording() = 0;
87
88 virtual void stop_video_recording() = 0;
89
90 virtual void set_optical_zoom_level(unsigned int level) = 0;
91
92 virtual unsigned int get_optical_zoom_level() = 0;
93
94 virtual std::vector<unsigned int> get_optical_zoom_range() = 0;
95
96 virtual ZoomType get_optical_zoom_type() = 0;
97
98 virtual void set_digital_zoom_level(unsigned int level) = 0;
99
100 virtual unsigned int get_digital_zoom_level() = 0;
101
102 virtual std::vector<unsigned int> get_digital_zoom_range() = 0;
103
104 virtual FocusMode get_focus_mode() = 0;
105
106 virtual void set_focus_mode(FocusMode mode) = 0;
107
108 virtual unsigned int get_focus_position() = 0;
109
110 virtual std::vector<unsigned int> get_focus_position_range() = 0;
111
112 virtual void set_focus_position(unsigned int position) = 0;
113
114 virtual unsigned int get_iso_level() = 0;
115
116 virtual std::vector<unsigned int> get_iso_range() = 0;
117
118 virtual void set_iso_level(unsigned int level) = 0;
119
120 virtual unsigned int get_shutter_speed() = 0;
121
122 virtual std::vector<unsigned int> get_shutter_speed_range() = 0;
123
124 virtual void set_shutter_speed(unsigned int speed) = 0;
125
126 virtual ExposureProgramMode get_exposure_program_mode() = 0;
127
128 virtual void set_exposure_program_mode(ExposureProgramMode mode) = 0;
129
130 virtual unsigned int get_aperture() = 0;
131
132 virtual std::vector<unsigned int> get_aperture_range() = 0;
133
134 virtual void set_aperture(unsigned int aperture) = 0;
135
136 virtual std::string get_white_balance() = 0;
137
138 virtual std::vector<std::string> get_white_balance_options() = 0;
139
140 virtual void set_white_balance(std::string wb) = 0;
141
142 [[nodiscard]] virtual bool get_zoom() const = 0;
143
144 [[nodiscard]] virtual bool get_gimbal() const = 0;
145
146 [[nodiscard]] virtual bool get_picture() const = 0;
147
148 [[nodiscard]] virtual bool get_video() const = 0;
149
150 [[nodiscard]] virtual bool get_touch() const = 0;
151
152 [[nodiscard]] virtual CameraType get_type() const = 0;
153
154 [[nodiscard]] virtual bool is_recording() const = 0;
155
156 [[nodiscard]] virtual TouchMode get_touch_mode() const = 0;
157
158 virtual void set_touch_mode(TouchMode mode) = 0;
159
160 virtual void set_touch_position(unsigned int x, unsigned int y) = 0;
161
162 private:
164 };
165
171 class IRInterface {
172 public:
173 virtual IRPalette get_color_palette() = 0;
174
175 virtual void set_color_palette(IRPalette palette) = 0;
176
177 virtual std::vector<IRPalette> get_color_palette_options() = 0;
178 };
179
188 class Camera : public CameraInterface {
189 public:
194 : Camera(std::string()) {}
195
201 explicit Camera(const std::string& name)
202 : CameraInterface(name),
203 m_type { CameraType::STANDARD } {}
204
205 ~Camera() override = default;
206
212 void take_picture() override {
213 throw not_implemented_error();
214 }
215
221 void start_video_recording() override {
222 throw not_implemented_error();
223 }
224
230 void stop_video_recording() override {
231 throw not_implemented_error();
232 }
233
241 void set_optical_zoom_level([[maybe_unused]] unsigned int level) override {
242 throw not_implemented_error();
243 }
244
252 unsigned int get_optical_zoom_level() override {
253 throw not_implemented_error();
254 }
255
263 std::vector<unsigned int> get_optical_zoom_range() override {
264 throw not_implemented_error();
265 }
266
275 throw not_implemented_error();
276 }
277
285 void set_digital_zoom_level([[maybe_unused]] unsigned int level) override {
286 throw not_implemented_error();
287 }
288
296 unsigned int get_digital_zoom_level() override {
297 throw not_implemented_error();
298 }
299
307 std::vector<unsigned int> get_digital_zoom_range() override {
308 throw not_implemented_error();
309 }
310
318 unsigned int get_iso_level() override {
319 throw not_implemented_error();
320 }
321
329 std::vector<unsigned int> get_iso_range() override {
330 throw not_implemented_error();
331 }
332
340 void set_iso_level([[maybe_unused]] unsigned int level) override {
341 throw not_implemented_error();
342 }
343
351 unsigned int get_shutter_speed() override {
352 throw not_implemented_error();
353 }
354
362 std::vector<unsigned int> get_shutter_speed_range() override {
363 throw not_implemented_error();
364 }
365
373 void set_shutter_speed([[maybe_unused]] unsigned int speed) override {
374 throw not_implemented_error();
375 }
376
387
395 void set_exposure_program_mode([[maybe_unused]] ExposureProgramMode mode) override {
396 throw not_implemented_error();
397 }
398
406 unsigned int get_aperture() override {
407 throw not_implemented_error();
408 }
409
417 std::vector<unsigned int> get_aperture_range() override {
418 throw not_implemented_error();
419 }
420
428 void set_aperture([[maybe_unused]] unsigned int aperture) override {
429 throw not_implemented_error();
430 }
431
439 std::string get_white_balance() override {
440 throw not_implemented_error();
441 }
442
450 std::vector<std::string> get_white_balance_options() override {
451 throw not_implemented_error();
452 }
453
461 void set_white_balance([[maybe_unused]] std::string wb) override {
462 throw not_implemented_error();
463 }
464
473 throw not_implemented_error();
474 }
475
483 void set_focus_mode([[maybe_unused]] FocusMode mode) override {
484 throw not_implemented_error();
485 }
486
494 unsigned int get_focus_position() override {
495 throw not_implemented_error();
496 }
497
505 std::vector<unsigned int> get_focus_position_range() override {
506 throw not_implemented_error();
507 }
508
516 void set_focus_position([[maybe_unused]] unsigned int position) override {
517 throw not_implemented_error();
518 }
519
525 [[nodiscard]] bool get_zoom() const final {
526 return m_zoom;
527 }
528
534 [[nodiscard]] bool get_gimbal() const final {
535 return m_gimbal;
536 }
537
543 [[nodiscard]] bool get_picture() const final {
544 return m_picture;
545 }
546
552 [[nodiscard]] bool get_video() const final {
553 return m_video;
554 }
555
561 [[nodiscard]] bool get_touch() const final {
562 return m_touch;
563 }
564
570 [[nodiscard]] CameraType get_type() const final {
571 return m_type;
572 }
573
579 [[nodiscard]] bool is_recording() const final {
580 return m_is_recording;
581 }
582
588 [[nodiscard]] TouchMode get_touch_mode() const final {
589 return m_touch_mode;
590 }
591
597 void set_touch_mode(TouchMode mode) override {
598 m_touch_mode = mode;
599 }
600
607 void set_touch_position([[maybe_unused]] unsigned int x, [[maybe_unused]] unsigned int y) override {
608 throw not_implemented_error();
609 }
610
611 protected:
616
620 bool m_picture { false };
621
625 bool m_video { false };
626
630 bool m_touch { false };
631
635 bool m_zoom { false };
636
640 bool m_gimbal { false };
641
645 bool m_is_recording { false };
646
650 TouchMode m_touch_mode { T_DISABLED };
651 };
652
661 class IRCamera : public Camera, public IRInterface {
662 public:
667 : IRCamera(std::string()) {}
668
672 explicit IRCamera(const std::string& name)
673 : Camera(name) {
674 m_type = CameraType::THERMAL;
675 }
676
685 throw not_implemented_error();
686 }
687
695 void set_color_palette([[maybe_unused]] IRPalette palette) override {
696 throw not_implemented_error();
697 }
698
706 std::vector<IRPalette> get_color_palette_options() override {
707 throw not_implemented_error();
708 }
709 };
710} // namespace flyby
IRPalette
The different possible thermal palettes.
Definition camera.h:64
ZoomType
The zoom format for the camera, such as mm (24mm) or multiplier (3x)
Definition camera.h:29
ExposureProgramMode
The exposure program mode, such as manual or aperture priority.
Definition camera.h:47
TouchMode
The current mode for camera gestures.
Definition camera.h:58
FocusMode
The focus mode of the camera.
Definition camera.h:38
CameraType
The type of camera, such as standard EO or thermal.
Definition camera.h:20
The base camera class.
Definition camera.h:188
void set_focus_mode(FocusMode mode) override
Sets the focus mode.
Definition camera.h:483
TouchMode m_touch_mode
The current touch/gesture mode.
Definition camera.h:650
void set_exposure_program_mode(ExposureProgramMode mode) override
Sets the exposure program mode.
Definition camera.h:395
std::vector< unsigned int > get_focus_position_range() override
Gets the focus position range.
Definition camera.h:505
std::vector< unsigned int > get_iso_range() override
Gets the ISO range on the camera.
Definition camera.h:329
std::vector< unsigned int > get_digital_zoom_range() override
Gets the digital zoom range on the camera.
Definition camera.h:307
unsigned int get_shutter_speed() override
Gets the shutter speed on the camera.
Definition camera.h:351
void set_white_balance(std::string wb) override
Sets the white balance.
Definition camera.h:461
bool m_touch
Does the camera support touch gestures.
Definition camera.h:630
bool m_gimbal
Is the camera mounted on a controllable gimbal.
Definition camera.h:640
bool get_touch() const final
Does the camera support touch.
Definition camera.h:561
Camera()
The default constructor.
Definition camera.h:193
unsigned int get_focus_position() override
Gets the focus position.
Definition camera.h:494
unsigned int get_iso_level() override
Gets the ISO level on the camera.
Definition camera.h:318
void set_optical_zoom_level(unsigned int level) override
Sets the optical zoom on the camera.
Definition camera.h:241
std::vector< unsigned int > get_aperture_range() override
Gets the possible aperture values.
Definition camera.h:417
CameraType get_type() const final
Get the type of camera.
Definition camera.h:570
void set_shutter_speed(unsigned int speed) override
Sets the shutter speed on the camera.
Definition camera.h:373
void set_focus_position(unsigned int position) override
Sets the focus position.
Definition camera.h:516
std::string get_white_balance() override
Gets the white balance.
Definition camera.h:439
unsigned int get_optical_zoom_level() override
Gets the optical zoom on the camera.
Definition camera.h:252
bool get_zoom() const final
Does the camera support zoom.
Definition camera.h:525
void set_touch_mode(TouchMode mode) override
Set the camera touch/gesture mode.
Definition camera.h:597
CameraType m_type
The camera type.
Definition camera.h:615
ZoomType get_optical_zoom_type() override
Gets the optical zoom type on the camera.
Definition camera.h:274
unsigned int get_digital_zoom_level() override
Gets the digital zoom on the camera.
Definition camera.h:296
void set_digital_zoom_level(unsigned int level) override
Sets the digital zoom on the camera.
Definition camera.h:285
TouchMode get_touch_mode() const final
Get the camera touch/gesture mode.
Definition camera.h:588
bool m_video
Can the camera take videos.
Definition camera.h:625
ExposureProgramMode get_exposure_program_mode() override
Gets the exposure program mode.
Definition camera.h:384
void take_picture() override
Take a picture on the camera.
Definition camera.h:212
bool get_picture() const final
Does the camera support pictures.
Definition camera.h:543
unsigned int get_aperture() override
Gets the aperture.
Definition camera.h:406
bool m_zoom
Can the camera zoom.
Definition camera.h:635
void set_iso_level(unsigned int level) override
Sets the ISO level on the camera.
Definition camera.h:340
bool m_picture
Can the camera take pictures.
Definition camera.h:620
std::vector< std::string > get_white_balance_options() override
Gets the white balance options.
Definition camera.h:450
Camera(const std::string &name)
The name constructor.
Definition camera.h:201
bool get_gimbal() const final
Is the camera mounted on a gimbal.
Definition camera.h:534
bool is_recording() const final
Get the recording status of the camera.
Definition camera.h:579
std::vector< unsigned int > get_optical_zoom_range() override
Gets the optical zoom range on the camera.
Definition camera.h:263
void set_aperture(unsigned int aperture) override
Sets the aperture.
Definition camera.h:428
bool get_video() const final
Does the camera support videos.
Definition camera.h:552
bool m_is_recording
Is the camera currently recording.
Definition camera.h:645
void stop_video_recording() override
Stop recording a video on the camera.
Definition camera.h:230
FocusMode get_focus_mode() override
Gets the focus mode.
Definition camera.h:472
void set_touch_position(unsigned int x, unsigned int y) override
Set the touch position.
Definition camera.h:607
void start_video_recording() override
Start recording a video on the camera.
Definition camera.h:221
std::vector< unsigned int > get_shutter_speed_range() override
Gets the shutter speed range on the camera.
Definition camera.h:362
Component()=default
The default constructor.
IRPalette get_color_palette() override
Gets the active color palette of the IR camera.
Definition camera.h:684
IRCamera()
Default constructor.
Definition camera.h:666
std::vector< IRPalette > get_color_palette_options() override
Gets the active color palette of the IR camera.
Definition camera.h:706
IRCamera(const std::string &name)
Name constructor.
Definition camera.h:672
void set_color_palette(IRPalette palette) override
Sets the active color palette of the IR camera.
Definition camera.h:695
An error representing a function that is not implemented.
Definition error.h:19