Gimbal
public class Gimbal
Provide control over a gimbal.
-
Initializes a new
Gimbal
plugin.Normally never created manually, but used from the
Drone
helper class instead.Declaration
Swift
public convenience init(address: String = "localhost", port: Int32 = 50051, scheduler: SchedulerType = ConcurrentDispatchQueueScheduler(qos: .background))
Parameters
address
The address of the
MavsdkServer
instance to connect toport
The port of the
MavsdkServer
instance to connect toscheduler
The scheduler to be used by
Observable
s -
Undocumented
See moreDeclaration
Swift
public struct RuntimeGimbalError : Error
-
Undocumented
See moreDeclaration
Swift
public struct GimbalError : Error
-
Gimbal mode type.
See moreDeclaration
Swift
public enum GimbalMode : Equatable
-
Control mode
See moreDeclaration
Swift
public enum ControlMode : Equatable
-
Control status
See moreDeclaration
Swift
public struct ControlStatus : Equatable
-
Result type.
See moreDeclaration
Swift
public struct GimbalResult : Equatable
-
Set gimbal pitch and yaw angles.
This sets the desired pitch and yaw angles of a gimbal. Will return when the command is accepted, however, it might take the gimbal longer to actually be set to the new angles.
Declaration
Swift
public func setPitchAndYaw(pitchDeg: Float, yawDeg: Float) -> Completable
Parameters
pitchDeg
Pitch angle in degrees (negative points down)
yawDeg
Yaw angle in degrees (positive is clock-wise, range: -180 to 180 or 0 to 360)
-
Set gimbal angular rates around pitch and yaw axes.
This sets the desired angular rates around pitch and yaw axes of a gimbal. Will return when the command is accepted, however, it might take the gimbal longer to actually reach the angular rate.
Declaration
Swift
public func setPitchRateAndYawRate(pitchRateDegS: Float, yawRateDegS: Float) -> Completable
Parameters
pitchRateDegS
Angular rate around pitch axis in degrees/second (negative downward)
yawRateDegS
Angular rate around yaw axis in degrees/second (positive is clock-wise)
-
Set gimbal mode.
This sets the desired yaw mode of a gimbal. Will return when the command is accepted. However, it might take the gimbal longer to actually be set to the new angles.
Declaration
Swift
public func setMode(gimbalMode: GimbalMode) -> Completable
Parameters
gimbalMode
The mode to be set.
-
Set gimbal region of interest (ROI).
This sets a region of interest that the gimbal will point to. The gimbal will continue to point to the specified region until it receives a new command. The function will return when the command is accepted, however, it might take the gimbal longer to actually rotate to the ROI.
Declaration
Swift
public func setRoiLocation(latitudeDeg: Double, longitudeDeg: Double, altitudeM: Float) -> Completable
Parameters
latitudeDeg
Latitude in degrees
longitudeDeg
Longitude in degrees
altitudeM
Altitude in metres (AMSL)
-
Take control.
There can be only two components in control of a gimbal at any given time. One with “primary” control, and one with “secondary” control. The way the secondary control is implemented is not specified and hence depends on the vehicle.
Components are expected to be cooperative, which means that they can override each other and should therefore do it carefully.
Declaration
Swift
public func takeControl(controlMode: ControlMode) -> Completable
Parameters
controlMode
Control mode (primary or secondary)
-
Release control.
Release control, such that other components can control the gimbal.
Declaration
Swift
public func releaseControl() -> Completable
-
Subscribe to control status updates.
This allows a component to know if it has primary, secondary or no control over the gimbal. Also, it gives the system and component ids of the other components in control (if any).
Declaration
Swift
public lazy var control: Observable<ControlStatus> { get set }