syntax = "proto3"; package mavsdk.rpc.mission; import "mavsdk_options.proto"; option java_package = "io.mavsdk.mission"; option java_outer_classname = "MissionProto"; // Enable waypoint missions. service MissionService { /* * Upload a list of mission items to the system. * * The mission items are uploaded to a drone. Once uploaded the mission can be started and * executed even if the connection is lost. */ rpc UploadMission(UploadMissionRequest) returns(UploadMissionResponse) {} /* * Upload a list of mission items to the system and report upload progress. * * The mission items are uploaded to a drone. Once uploaded the mission can be started and * executed even if the connection is lost. */ rpc SubscribeUploadMissionWithProgress(SubscribeUploadMissionWithProgressRequest) returns(stream UploadMissionWithProgressResponse) { option (mavsdk.options.async_type) = ASYNC; option (mavsdk.options.is_finite) = true; } /* * Cancel an ongoing mission upload. */ rpc CancelMissionUpload(CancelMissionUploadRequest) returns(CancelMissionUploadResponse) { option (mavsdk.options.async_type) = SYNC; } /* * Download a list of mission items from the system (asynchronous). * * Will fail if any of the downloaded mission items are not supported * by the MAVSDK API. */ rpc DownloadMission(DownloadMissionRequest) returns(DownloadMissionResponse) {} /* * Download a list of mission items from the system (asynchronous) and report progress. * * Will fail if any of the downloaded mission items are not supported * by the MAVSDK API. */ rpc SubscribeDownloadMissionWithProgress(SubscribeDownloadMissionWithProgressRequest) returns(stream DownloadMissionWithProgressResponse) { option (mavsdk.options.async_type) = ASYNC; option (mavsdk.options.is_finite) = true; } /* * Cancel an ongoing mission download. */ rpc CancelMissionDownload(CancelMissionDownloadRequest) returns(CancelMissionDownloadResponse) { option (mavsdk.options.async_type) = SYNC; } /* * Start the mission. * * A mission must be uploaded to the vehicle before this can be called. */ rpc StartMission(StartMissionRequest) returns(StartMissionResponse) {} /* * Pause the mission. * * Pausing the mission puts the vehicle into * [HOLD mode](https://docs.px4.io/main/en/flight_modes_mc/hold.html). * A multicopter should just hover at the spot while a fixedwing vehicle should loiter * around the location where it paused. */ rpc PauseMission(PauseMissionRequest) returns(PauseMissionResponse) {} /* * Clear the mission saved on the vehicle. */ rpc ClearMission(ClearMissionRequest) returns(ClearMissionResponse) {} /* * Sets the mission item index to go to. * * By setting the current index to 0, the mission is restarted from the beginning. If it is set * to a specific index of a mission item, the mission will be set to this item. * * Note that this is not necessarily true for general missions using MAVLink if loop counters * are used. */ rpc SetCurrentMissionItem(SetCurrentMissionItemRequest) returns(SetCurrentMissionItemResponse) {} /* * Check if the mission has been finished. */ rpc IsMissionFinished(IsMissionFinishedRequest) returns(IsMissionFinishedResponse) { option (mavsdk.options.async_type) = SYNC; } /* * Subscribe to mission progress updates. */ rpc SubscribeMissionProgress(SubscribeMissionProgressRequest) returns(stream MissionProgressResponse) {} /* * Get whether to trigger Return-to-Launch (RTL) after mission is complete. * * Before getting this option, it needs to be set, or a mission * needs to be downloaded. */ rpc GetReturnToLaunchAfterMission(GetReturnToLaunchAfterMissionRequest) returns(GetReturnToLaunchAfterMissionResponse) { option (mavsdk.options.async_type) = SYNC; } /* * Set whether to trigger Return-to-Launch (RTL) after the mission is complete. * * This will only take effect for the next mission upload, meaning that * the mission may have to be uploaded again. */ rpc SetReturnToLaunchAfterMission(SetReturnToLaunchAfterMissionRequest) returns(SetReturnToLaunchAfterMissionResponse) { option (mavsdk.options.async_type) = SYNC; } } message UploadMissionRequest { MissionPlan mission_plan = 1; // The mission plan } message UploadMissionResponse { MissionResult mission_result = 1; } message SubscribeUploadMissionWithProgressRequest { MissionPlan mission_plan = 1; // The mission plan } message UploadMissionWithProgressResponse { MissionResult mission_result = 1; ProgressData progress_data = 2; // The progress data } message CancelMissionUploadRequest {} message CancelMissionUploadResponse { MissionResult mission_result = 1; } message DownloadMissionRequest {} message DownloadMissionResponse { MissionResult mission_result = 1; MissionPlan mission_plan = 2; // The mission plan } message SubscribeDownloadMissionWithProgressRequest {} message DownloadMissionWithProgressResponse { MissionResult mission_result = 1; ProgressDataOrMission progress_data = 2; // The progress data, or the mission plan (when the download is finished) } message CancelMissionDownloadRequest {} message CancelMissionDownloadResponse { MissionResult mission_result = 1; } message StartMissionRequest {} message StartMissionResponse { MissionResult mission_result = 1; } message PauseMissionRequest {} message PauseMissionResponse { MissionResult mission_result = 1; } message ClearMissionRequest {} message ClearMissionResponse { MissionResult mission_result = 1; } message SetCurrentMissionItemRequest { int32 index = 1; // Index of the mission item to be set as the next one (0-based) } message SetCurrentMissionItemResponse { MissionResult mission_result = 1; } message IsMissionFinishedRequest {} message IsMissionFinishedResponse { MissionResult mission_result = 1; bool is_finished = 2; // True if the mission is finished and the last mission item has been reached } message SubscribeMissionProgressRequest {} message MissionProgressResponse { MissionProgress mission_progress = 1; // Mission progress } message GetReturnToLaunchAfterMissionRequest {} message GetReturnToLaunchAfterMissionResponse { MissionResult mission_result = 1; bool enable = 2; // If true, trigger an RTL at the end of the mission } message SetReturnToLaunchAfterMissionRequest { bool enable = 1; // If true, trigger an RTL at the end of the mission } message SetReturnToLaunchAfterMissionResponse { MissionResult mission_result = 1; } /* * Type representing a mission item. * * A MissionItem can contain a position and/or actions. * Mission items are building blocks to assemble a mission, * which can be sent to (or received from) a system. * They cannot be used independently. */ message MissionItem { double latitude_deg = 1 [(mavsdk.options.default_value)="NaN", (mavsdk.options.epsilon)=0.0000001]; // Latitude in degrees (range: -90 to +90) double longitude_deg = 2 [(mavsdk.options.default_value)="NaN", (mavsdk.options.epsilon)=0.0000001]; // Longitude in degrees (range: -180 to +180) float relative_altitude_m = 3 [(mavsdk.options.default_value)="NaN"]; // Altitude relative to takeoff altitude in metres float speed_m_s = 4 [(mavsdk.options.default_value)="NaN"]; // Speed to use after this mission item (in metres/second) bool is_fly_through = 5 [(mavsdk.options.default_value)="false"]; // True will make the drone fly through without stopping, while false will make the drone stop on the waypoint float gimbal_pitch_deg = 6 [(mavsdk.options.default_value)="NaN", (mavsdk.options.epsilon)=0.0001]; // Gimbal pitch (in degrees) float gimbal_yaw_deg = 7 [(mavsdk.options.default_value)="NaN", (mavsdk.options.epsilon)=0.0001]; // Gimbal yaw (in degrees) CameraAction camera_action = 8; // Camera action to trigger at this mission item float loiter_time_s = 9 [(mavsdk.options.default_value)="NaN"]; // Loiter time (in seconds) double camera_photo_interval_s = 10 [(mavsdk.options.default_value)="1.0"]; // Camera photo interval to use after this mission item (in seconds) float acceptance_radius_m = 11 [(mavsdk.options.default_value)="NaN"]; // Radius for completing a mission item (in metres) float yaw_deg = 12 [(mavsdk.options.default_value)="NaN"]; // Absolute yaw angle (in degrees) float camera_photo_distance_m = 13 [(mavsdk.options.default_value)="NAN"]; // Camera photo distance to use after this mission item (in meters) VehicleAction vehicle_action = 14; // Vehicle action to trigger at this mission item. // Possible camera actions at a mission item. enum CameraAction { CAMERA_ACTION_NONE = 0; // No action CAMERA_ACTION_TAKE_PHOTO = 1; // Take a single photo CAMERA_ACTION_START_PHOTO_INTERVAL = 2; // Start capturing photos at regular intervals CAMERA_ACTION_STOP_PHOTO_INTERVAL = 3; // Stop capturing photos at regular intervals CAMERA_ACTION_START_VIDEO = 4; // Start capturing video CAMERA_ACTION_STOP_VIDEO = 5; // Stop capturing video CAMERA_ACTION_START_PHOTO_DISTANCE = 6; // Start capturing photos at regular distance CAMERA_ACTION_STOP_PHOTO_DISTANCE = 7; // Stop capturing photos at regular distance } // Possible vehicle actions at a mission item enum VehicleAction { VEHICLE_ACTION_NONE = 0; // No action VEHICLE_ACTION_TAKEOFF = 1; // Vehicle will takeoff and go to defined waypoint VEHICLE_ACTION_LAND = 2; // When a waypoint is reached vehicle will land at current position VEHICLE_ACTION_TRANSITION_TO_FW = 3; // When a waypoint is reached vehicle will transition to fixed-wing mode VEHICLE_ACTION_TRANSITION_TO_MC = 4; // When a waypoint is reached vehicle will transition to multi-copter mode } } // Mission plan type message MissionPlan { repeated MissionItem mission_items = 1; // The mission items } // Mission progress type. message MissionProgress { int32 current = 1; // Current mission item index (0-based), if equal to total, the mission is finished int32 total = 2; // Total number of mission items } // Result type. message MissionResult { // Possible results returned for action requests. enum Result { RESULT_UNKNOWN = 0; // Unknown result RESULT_SUCCESS = 1; // Request succeeded RESULT_ERROR = 2; // Error RESULT_TOO_MANY_MISSION_ITEMS = 3; // Too many mission items in the mission RESULT_BUSY = 4; // Vehicle is busy RESULT_TIMEOUT = 5; // Request timed out RESULT_INVALID_ARGUMENT = 6; // Invalid argument RESULT_UNSUPPORTED = 7; // Mission downloaded from the system is not supported RESULT_NO_MISSION_AVAILABLE = 8; // No mission available on the system RESULT_UNSUPPORTED_MISSION_CMD = 11; // Unsupported mission command RESULT_TRANSFER_CANCELLED = 12; // Mission transfer (upload or download) has been cancelled RESULT_NO_SYSTEM = 13; // No system connected RESULT_NEXT = 14; // Intermediate message showing progress RESULT_DENIED = 15; // Request denied RESULT_PROTOCOL_ERROR = 16; // There was a protocol error RESULT_INT_MESSAGES_NOT_SUPPORTED = 17; // The system does not support the MISSION_INT protocol } Result result = 1; // Result enum value string result_str = 2; // Human-readable English string describing the result } // Progress data coming from mission upload. message ProgressData { float progress = 1 [(mavsdk.options.default_value)="NaN"]; // Progress (0..1.0) } // Progress data coming from mission download, or the mission itself (if the transfer succeeds). message ProgressDataOrMission { bool has_progress = 1 [(mavsdk.options.default_value)="false"]; // Whether this ProgressData contains a 'progress' status or not float progress = 2 [(mavsdk.options.default_value)="NaN"]; // Progress (0..1.0) bool has_mission = 3; // Whether this ProgressData contains a 'mission_plan' or not MissionPlan mission_plan = 4; // Mission plan }