Flyby SDK v1.0.2
Loading...
Searching...
No Matches
gimbal.h
Go to the documentation of this file.
1
7
8#pragma once
9
11#include <flyby/util/error.h>
12
13namespace flyby {
19 LOCK = 0,
20 FOLLOW,
21 };
22
28 class GimbalInterface : public Component {
29 public:
30 virtual void set_roll_pitch_yaw_angle(double roll, double pitch, double yaw) = 0;
31
32 virtual void set_roll_pitch_yaw_speed(double roll, double pitch, double yaw) = 0;
33
34 virtual void reset_position() = 0;
35
36 virtual void reset_pitch_position() = 0;
37
38 virtual void reset_roll_position() = 0;
39
40 virtual void reset_yaw_position() = 0;
41
42 virtual GimbalMode get_gimbal_mode() = 0;
43
44 virtual void set_gimbal_mode(GimbalMode mode) = 0;
45
46 [[nodiscard]] virtual double get_roll() const = 0;
47
48 [[nodiscard]] virtual double get_pitch() const = 0;
49
50 [[nodiscard]] virtual double get_yaw() const = 0;
51 };
60 class Gimbal : public GimbalInterface {
61 public:
65 Gimbal() = default;
66
67 ~Gimbal() override = default;
68
78 }
79
87 void set_gimbal_mode(GimbalMode mode) override {
89 }
90
100 void set_roll_pitch_yaw_angle(double roll, double pitch, double yaw) override {
101 throw not_implemented_error();
102 }
103
113 void set_roll_pitch_yaw_speed(double roll, double pitch, double yaw) override {
114 throw not_implemented_error();
115 }
116
122 void reset_position() override {
124 }
125
131 void reset_pitch_position() override {
132 auto roll = get_roll();
133 auto yaw = get_yaw();
134 set_roll_pitch_yaw_angle(roll, 0, yaw);
135 }
136
142 void reset_roll_position() override {
143 auto pitch = get_pitch();
144 auto yaw = get_yaw();
145 set_roll_pitch_yaw_angle(0, pitch, yaw);
146 }
147
153 void reset_yaw_position() override {
154 auto roll = get_roll();
155 auto pitch = get_pitch();
156 set_roll_pitch_yaw_angle(roll, pitch, 0);
157 }
158
166 [[nodiscard]] double get_roll() const override {
167 throw not_implemented_error();
168 }
169
177 [[nodiscard]] double get_pitch() const override {
178 throw not_implemented_error();
179 }
180
188 [[nodiscard]] double get_yaw() const override {
189 throw not_implemented_error();
190 }
191 };
192} // namespace flyby
void reset_position() override
Reset the gimbal position.
Definition gimbal.h:122
double get_yaw() const override
Returns current yaw angle.
Definition gimbal.h:188
void set_gimbal_mode(GimbalMode mode) override
Sets the gimbal mode.
Definition gimbal.h:87
double get_pitch() const override
Returns current pitch angle.
Definition gimbal.h:177
void reset_pitch_position() override
Reset the gimbal pitch position.
Definition gimbal.h:131
double get_roll() const override
Returns current roll angle.
Definition gimbal.h:166
Gimbal()=default
The default constructor.
void set_roll_pitch_yaw_speed(double roll, double pitch, double yaw) override
Sets the speed of rotation of the roll, pitch, and yaw.
Definition gimbal.h:113
void reset_yaw_position() override
Reset the gimbal yaw position.
Definition gimbal.h:153
GimbalMode get_gimbal_mode() override
Gets the gimbal mode.
Definition gimbal.h:76
void reset_roll_position() override
Reset the gimbal roll position.
Definition gimbal.h:142
void set_roll_pitch_yaw_angle(double roll, double pitch, double yaw) override
Sets the angle of the roll, pitch, and yaw.
Definition gimbal.h:100
An error representing a function that is not implemented.
Definition error.h:19
GimbalMode
The gimbal movement mode.
Definition gimbal.h:18