Gimbal
Gimbal class for managing camera gimbal control.
#include <gimbal.hpp>Classes
class Gimbal
Handle for controlling a gimbal (physical or virtual) attached to a vehicle.
Supports absolute attitude commands, rate-based control, and status polling.
struct Attitude
Gimbal attitude in degrees.
| Field | Type | Description |
|---|---|---|
pitch |
float |
degrees, positive = up |
yaw |
float |
degrees, positive = right |
roll |
float |
degrees, positive = clockwise |
struct Limits
Gimbal limits in degrees.
| Field | Type | Description |
|---|---|---|
min_pitch |
float |
Minimum pitch travel in degrees. |
max_pitch |
float |
Maximum pitch travel in degrees. |
min_yaw |
float |
Minimum yaw travel in degrees. |
max_yaw |
float |
Maximum yaw travel in degrees. |
min_roll |
float |
Minimum roll travel in degrees. |
max_roll |
float |
Maximum roll travel in degrees. |
struct Status
Current gimbal status as reported by the onboard system.
| Field | Type | Description |
|---|---|---|
attitude |
Attitude |
Current gimbal attitude in degrees. |
limits |
Limits |
Configured gimbal travel limits in degrees. |
stabilized |
bool |
True when the gimbal stabilization loop is active. |
available |
bool |
True when a gimbal is present and responsive. |
enum Mode
Virtual-gimbal image processing mode.
| Value | Description |
|---|---|
kRaw |
Full lens FOV, no crop (widest, not zoomed). |
kCrop |
Videocrop pan/tilt, no distortion correction. |
kDewarp |
Rectilinear remap; straight lines, crops to virtual FOV. |
~Gimbal()Destroys the Gimbal handle.
auto SetMode(Mode mode) -> voidSet the virtual-gimbal processing mode at runtime.
Best-effort. Has no effect on physical gimbals or a ground-side direct gimbal.
| Parameter | Type | Description |
|---|---|---|
mode |
Mode |
Desired processing mode (kRaw / kCrop / kDewarp). |
auto SetAttitude(float pitch, float yaw, float roll) -> voidSet absolute gimbal orientation in degrees.
| Parameter | Type | Description |
|---|---|---|
pitch |
float |
Desired pitch angle in degrees, positive = up. |
yaw |
float |
Desired yaw angle in degrees, positive = right. |
roll |
float |
Desired roll angle in degrees, positive = clockwise. |
auto SetAttitude(const Quaternion& orientation) -> voidSet absolute gimbal orientation from a quaternion (convenience overload).
Converts @p orientation to pitch/yaw/roll (ZYX convention) and forwards to SetAttitude(pitch, yaw, roll). The resulting angles are still subject to the gimbal's per-axis limits, and axes the device does not physically have (e.g. roll on a 2-axis gimbal) are ignored.
| Parameter | Type | Description |
|---|---|---|
orientation |
const Quaternion& |
Desired orientation as a unit quaternion (x, y, z, w). |
auto SetSpeed(float pitch_rate, float yaw_rate, float roll_rate) -> voidSet angular velocity in degrees/second for rate-based (joystick-style) control.
| Parameter | Type | Description |
|---|---|---|
pitch_rate |
float |
Desired pitch rate in degrees/second, positive = up. |
yaw_rate |
float |
Desired yaw rate in degrees/second, positive = right. |
roll_rate |
float |
Desired roll rate in degrees/second, positive = clockwise. |
auto RequestStatus() -> voidRequest a status report from the onboard gimbal.
auto SetActiveCamera(uint8_t camera_index) -> voidSelect which camera's gimbal subsequent commands target, in multi-camera setups.
Has no effect when the gimbal is directly controlled from the ground side.
| Parameter | Type | Description |
|---|---|---|
camera_index |
uint8_t |
Zero-based index of the camera whose gimbal should receive commands. |