CameraServer

class mavsdk.camera_server.CameraFeedback(value)

Bases: Enum

Possible feedback results for camera respond command.

Values

UNKNOWN

Unknown

OK

Ok

BUSY

Busy

FAILED

Failed

BUSY = 2
FAILED = 3
OK = 1
UNKNOWN = 0
class mavsdk.camera_server.CameraServer(async_plugin_manager)

Bases: AsyncBase

Provides handling of camera interface

Generated by dcsdkgen - MAVSDK CameraServer API

async capture_status()

Subscribe to camera capture status requests. Each request received should response to using RespondCaptureStatus

Yields:

reserved (int32_t) – reserved, just make protoc-gen-mavsdk working

async format_storage()

Subscribe to format storage requests. Each request received should response to using RespondFormatStorage

Yields:

storage_id (int32_t) – the storage id to format

name = 'CameraServer'
async reset_settings()

Subscribe to reset settings requests. Each request received should response to using RespondResetSettings

Yields:

reserved (int32_t) – reserved, just make protoc-gen-mavsdk working

async respond_capture_status(capture_status_feedback, capture_status)

Respond to camera capture status from SubscribeCaptureStatus.

Parameters:
Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_format_storage(format_storage_feedback)

Respond to format storage from SubscribeFormatStorage.

Parameters:

format_storage_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_reset_settings(reset_settings_feedback)

Respond to reset settings from SubscribeResetSettings.

Parameters:

reset_settings_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_set_mode(set_mode_feedback)

Respond to set camera mode from SubscribeSetMode.

Parameters:

set_mode_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_start_video(start_video_feedback)

Subscribe to stop video requests. Each request received should respond using StopVideoResponse

Parameters:

start_video_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_start_video_streaming(start_video_streaming_feedback)

Respond to start video streaming from SubscribeStartVideoStreaming.

Parameters:

start_video_streaming_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_stop_video(stop_video_feedback)

Respond to stop video request from SubscribeStopVideo.

Parameters:

stop_video_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_stop_video_streaming(stop_video_streaming_feedback)

Respond to stop video streaming from SubscribeStopVideoStreaming.

Parameters:

stop_video_streaming_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_storage_information(storage_information_feedback, storage_information)

Respond to camera storage information from SubscribeStorageInformation.

Parameters:
Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_take_photo(take_photo_feedback, capture_info)

Respond to an image capture request from SubscribeTakePhoto.

Parameters:
Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_tracking_off_command(stop_video_feedback)

Respond to an incoming tracking off command.

Parameters:

stop_video_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_tracking_point_command(stop_video_feedback)

Respond to an incoming tracking point command.

Parameters:

stop_video_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_tracking_rectangle_command(stop_video_feedback)

Respond to an incoming tracking rectangle command.

Parameters:

stop_video_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_zoom_in_start(zoom_in_start_feedback)

Respond to zoom in start.

Parameters:

zoom_in_start_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_zoom_out_start(zoom_out_start_feedback)

Respond to zoom out start.

Parameters:

zoom_out_start_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_zoom_range(zoom_range_feedback)

Respond to zoom range.

Parameters:

zoom_range_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async respond_zoom_stop(zoom_stop_feedback)

Respond to zoom stop.

Parameters:

zoom_stop_feedback (CameraFeedback) – the feedback

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async set_in_progress(in_progress)

Sets image capture in progress status flags. This should be set to true when the camera is busy taking a photo and false when it is done.

Parameters:

in_progress (bool) – true if capture is in progress or false for idle.

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async set_information(information)

Sets the camera information. This must be called as soon as the camera server is created.

Parameters:

information (Information) – information about the camera

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async set_mode()

Subscribe to set camera mode requests. Each request received should response to using RespondSetMode

Yields:

mode (Mode)

async set_tracking_off_status()

Set the current tracking status to off.

async set_tracking_rectangle_status(tracked_rectangle)

Set/update the current rectangle tracking status.

Parameters:

tracked_rectangle (TrackRectangle) – The tracked rectangle

async set_video_streaming(video_streaming)

Sets video streaming settings.

Parameters:

video_streaming (VideoStreaming) – information about the video stream

Raises:

CameraServerError – If the request fails. The error contains the reason for the failure.

async start_video()

Subscribe to start video requests. Each request received should respond to using RespondStartVideo

Yields:

stream_id (int32_t) – video stream id

async start_video_streaming()

Subscribe to start video streaming requests. Each request received should response to using RespondStartVideoStreaming

Yields:

stream_id (int32_t) – video stream id

async stop_video()

Subscribe to stop video requests. Each request received should response to using RespondStopVideo

Yields:

stream_id (int32_t) – video stream id

async stop_video_streaming()

Subscribe to stop video streaming requests. Each request received should response to using RespondStopVideoStreaming

Yields:

stream_id (int32_t) – video stream id

async storage_information()

Subscribe to camera storage information requests. Each request received should response to using RespondStorageInformation

Yields:

storage_id (int32_t)

async take_photo()

Subscribe to image capture requests. Each request received should respond to using RespondTakePhoto.

Yields:

index (int32_t)

async tracking_off_command()

Subscribe to incoming tracking off command.

Yields:

dummy (int32_t) – Unused

async tracking_point_command()

Subscribe to incoming tracking point command.

Yields:

track_point (TrackPoint) – The point to track if a point is to be tracked

async tracking_rectangle_command()

Subscribe to incoming tracking rectangle command.

Yields:

track_rectangle (TrackRectangle) – The point to track if a point is to be tracked

async zoom_in_start()

Subscribe to zoom in start command

Yields:

reserved (int32_t) – reserved, just make protoc-gen-mavsdk working

async zoom_out_start()

Subscribe to zoom out start command

Yields:

reserved (int32_t) – reserved, just make protoc-gen-mavsdk working

async zoom_range()

Subscribe to zoom range command

Yields:

factor (float) – The zoom factor, starting at 1x.

async zoom_stop()

Subscribe to zoom stop command

Yields:

reserved (int32_t) – reserved, just make protoc-gen-mavsdk working

exception mavsdk.camera_server.CameraServerError(result, origin, *params)

Bases: Exception

Raised when a CameraServerResult is a fail code

class mavsdk.camera_server.CameraServerResult(result, result_str)

Bases: object

Result type.

Parameters:
  • result (Result) – Result enum value

  • result_str (std::string) – Human-readable English string describing the result

class Result(value)

Bases: Enum

Possible results returned for action requests.

Values

UNKNOWN

Unknown result

SUCCESS

Command executed successfully

IN_PROGRESS

Command in progress

BUSY

Camera is busy and rejected command

DENIED

Camera denied the command

ERROR

An error has occurred while executing the command

TIMEOUT

Command timed out

WRONG_ARGUMENT

Command has wrong argument(s)

NO_SYSTEM

No system connected

BUSY = 3
DENIED = 4
ERROR = 5
IN_PROGRESS = 2
NO_SYSTEM = 8
SUCCESS = 1
TIMEOUT = 6
UNKNOWN = 0
WRONG_ARGUMENT = 7
class mavsdk.camera_server.CaptureInfo(position, attitude_quaternion, time_utc_us, is_success, index, file_url)

Bases: object

Information about a picture just captured.

Parameters:
  • position (Position) – Location where the picture was taken

  • attitude_quaternion (Quaternion) – Attitude of the camera when the picture was taken (quaternion)

  • time_utc_us (uint64_t) – Timestamp in UTC (since UNIX epoch) in microseconds

  • is_success (bool) – True if the capture was successful

  • index (int32_t) – Index from TakePhotoResponse

  • file_url (std::string) – Download URL of this image

class mavsdk.camera_server.CaptureStatus(image_interval_s, recording_time_s, available_capacity_mib, image_status, video_status, image_count)

Bases: object

Capture status

Parameters:
  • image_interval_s (float) – Image capture interval (in s)

  • recording_time_s (float) – Elapsed time since recording started (in s)

  • available_capacity_mib (float) – Available storage capacity. (in MiB)

  • image_status (ImageStatus) – Current status of image capturing

  • video_status (VideoStatus) – Current status of video capturing

  • image_count (int32_t) – Total number of images captured (‘forever’, or until reset using MAV_CMD_STORAGE_FORMAT)

class ImageStatus(value)

Bases: Enum

The image status

Values

IDLE

idle

CAPTURE_IN_PROGRESS

capture in progress

INTERVAL_IDLE

interval set but idle

INTERVAL_IN_PROGRESS

interval set and capture in progress)

CAPTURE_IN_PROGRESS = 1
IDLE = 0
INTERVAL_IDLE = 2
INTERVAL_IN_PROGRESS = 3
class VideoStatus(value)

Bases: Enum

The video status

Values

IDLE

idle

CAPTURE_IN_PROGRESS

capture in progress

CAPTURE_IN_PROGRESS = 1
IDLE = 0
class mavsdk.camera_server.Information(vendor_name, model_name, firmware_version, focal_length_mm, horizontal_sensor_size_mm, vertical_sensor_size_mm, horizontal_resolution_px, vertical_resolution_px, lens_id, definition_file_version, definition_file_uri, image_in_video_mode_supported, video_in_image_mode_supported)

Bases: object

Type to represent a camera information.

Parameters:
  • vendor_name (std::string) – Name of the camera vendor

  • model_name (std::string) – Name of the camera model

  • firmware_version (std::string) – Camera firmware version in major[.minor[.patch[.dev]]] format

  • focal_length_mm (float) – Focal length

  • horizontal_sensor_size_mm (float) – Horizontal sensor size

  • vertical_sensor_size_mm (float) – Vertical sensor size

  • horizontal_resolution_px (uint32_t) – Horizontal image resolution in pixels

  • vertical_resolution_px (uint32_t) – Vertical image resolution in pixels

  • lens_id (uint32_t) – Lens ID

  • definition_file_version (uint32_t) – Camera definition file version (iteration)

  • definition_file_uri (std::string) – Camera definition URI (http or mavlink ftp)

  • image_in_video_mode_supported (bool) – Camera supports taking images while in video mode

  • video_in_image_mode_supported (bool) – Camera supports recording video while in image mode

class mavsdk.camera_server.Mode(value)

Bases: Enum

Camera mode type.

Values

UNKNOWN

Unknown mode

PHOTO

Photo mode

VIDEO

Video mode

PHOTO = 1
UNKNOWN = 0
VIDEO = 2
class mavsdk.camera_server.Position(latitude_deg, longitude_deg, absolute_altitude_m, relative_altitude_m)

Bases: object

Position type in global coordinates.

Parameters:
  • latitude_deg (double) – Latitude in degrees (range: -90 to +90)

  • longitude_deg (double) – Longitude in degrees (range: -180 to +180)

  • absolute_altitude_m (float) – Altitude AMSL (above mean sea level) in metres

  • relative_altitude_m (float) – Altitude relative to takeoff altitude in metres

class mavsdk.camera_server.Quaternion(w, x, y, z)

Bases: object

Quaternion type.

All rotations and axis systems follow the right-hand rule. The Hamilton quaternion product definition is used. A zero-rotation quaternion is represented by (1,0,0,0). The quaternion could also be written as w + xi + yj + zk.

For more info see: https://en.wikipedia.org/wiki/Quaternion

Parameters:
  • w (float) – Quaternion entry 0, also denoted as a

  • x (float) – Quaternion entry 1, also denoted as b

  • y (float) – Quaternion entry 2, also denoted as c

  • z (float) – Quaternion entry 3, also denoted as d

class mavsdk.camera_server.StorageInformation(used_storage_mib, available_storage_mib, total_storage_mib, storage_status, storage_id, storage_type, read_speed_mib_s, write_speed_mib_s)

Bases: object

Information about the camera storage.

Parameters:
  • used_storage_mib (float) – Used storage (in MiB)

  • available_storage_mib (float) – Available storage (in MiB)

  • total_storage_mib (float) – Total storage (in MiB)

  • storage_status (StorageStatus) – Storage status

  • storage_id (uint32_t) – Storage ID starting at 1

  • storage_type (StorageType) – Storage type

  • read_speed_mib_s (float) – Read speed [MiB/s]

  • write_speed_mib_s (float) – Write speed [MiB/s]

class StorageStatus(value)

Bases: Enum

Storage status type.

Values

NOT_AVAILABLE

Storage not available

UNFORMATTED

Storage is not formatted (i.e. has no recognized file system)

FORMATTED

Storage is formatted (i.e. has recognized a file system)

NOT_SUPPORTED

Storage status is not supported

FORMATTED = 2
NOT_AVAILABLE = 0
NOT_SUPPORTED = 3
UNFORMATTED = 1
class StorageType(value)

Bases: Enum

Storage type.

Values

UNKNOWN

Storage type unknown

USB_STICK

Storage type USB stick

SD

Storage type SD card

MICROSD

Storage type MicroSD card

HD

Storage type HD mass storage

OTHER

Storage type other, not listed

HD = 4
MICROSD = 3
OTHER = 5
SD = 2
UNKNOWN = 0
USB_STICK = 1
class mavsdk.camera_server.TrackPoint(point_x, point_y, radius)

Bases: object

Point description type

Parameters:
  • point_x (float) – Point to track x value (normalized 0..1, 0 is left, 1 is right).

  • point_y (float) – Point to track y value (normalized 0..1, 0 is top, 1 is bottom).

  • radius (float) – Point to track y value (normalized 0..1, 0 is top, 1 is bottom).

class mavsdk.camera_server.TrackRectangle(top_left_corner_x, top_left_corner_y, bottom_right_corner_x, bottom_right_corner_y)

Bases: object

Rectangle description type

Parameters:
  • top_left_corner_x (float) – Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).

  • top_left_corner_y (float) – Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).

  • bottom_right_corner_x (float) – Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).

  • bottom_right_corner_y (float) – Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).

class mavsdk.camera_server.VideoStreaming(has_rtsp_server, rtsp_uri)

Bases: object

Type to represent video streaming settings

Parameters: