From f07a166dbc146f47f74ea267695723c90027ebde Mon Sep 17 00:00:00 2001 From: Diego Gil Date: Fri, 19 Apr 2024 19:11:44 -0300 Subject: [PATCH 1/4] add generated code and examples --- README.md | 59 +- build.rs | 21 +- examples/info.rs | 19 +- examples/mocap.rs | 42 +- examples/takeoff_and_land.rs | 66 + examples/telemetry.rs | 34 +- src/grpc/mavsdk.options.rs | 30 + src/grpc/mavsdk.rpc.action.rs | 1130 ++++++++++ src/grpc/mavsdk.rpc.calibration.rs | 466 ++++ src/grpc/mavsdk.rpc.camera.rs | 1426 ++++++++++++ src/grpc/mavsdk.rpc.core.rs | 183 ++ src/grpc/mavsdk.rpc.geofence.rs | 319 +++ src/grpc/mavsdk.rpc.gimbal.rs | 577 +++++ src/grpc/mavsdk.rpc.info.rs | 430 ++++ src/grpc/mavsdk.rpc.mission.rs | 833 +++++++ src/grpc/mavsdk.rpc.mocap.rs | 481 ++++ src/grpc/mavsdk.rpc.offboard.rs | 779 +++++++ src/grpc/mavsdk.rpc.param.rs | 421 ++++ src/grpc/mavsdk.rpc.shell.rs | 237 ++ src/grpc/mavsdk.rpc.telemetry.rs | 3386 ++++++++++++++++++++++++++++ src/lib.rs | 77 +- 21 files changed, 10875 insertions(+), 141 deletions(-) create mode 100644 examples/takeoff_and_land.rs create mode 100644 src/grpc/mavsdk.options.rs create mode 100644 src/grpc/mavsdk.rpc.action.rs create mode 100644 src/grpc/mavsdk.rpc.calibration.rs create mode 100644 src/grpc/mavsdk.rpc.camera.rs create mode 100644 src/grpc/mavsdk.rpc.core.rs create mode 100644 src/grpc/mavsdk.rpc.geofence.rs create mode 100644 src/grpc/mavsdk.rpc.gimbal.rs create mode 100644 src/grpc/mavsdk.rpc.info.rs create mode 100644 src/grpc/mavsdk.rpc.mission.rs create mode 100644 src/grpc/mavsdk.rpc.mocap.rs create mode 100644 src/grpc/mavsdk.rpc.offboard.rs create mode 100644 src/grpc/mavsdk.rpc.param.rs create mode 100644 src/grpc/mavsdk.rpc.shell.rs create mode 100644 src/grpc/mavsdk.rpc.telemetry.rs diff --git a/README.md b/README.md index 4f3d86a..b7a2022 100644 --- a/README.md +++ b/README.md @@ -3,57 +3,76 @@ This is the Rust wrapper for MAVSDK. The Rust wrapper is based on a gRPC client communicating with the gRPC server written in C++. -The wrapper is potentially auto-generated from the message definitions ([proto files](https://github.com/mavlink/MAVSDK-Proto)). +The wrapper is auto-generated from the message definitions ([proto files](https://github.com/mavlink/MAVSDK-Proto)). -# Update Rust for async/await support (first time) -```bash -$ rustup update -``` +## Requirements + +- Rust >= 1.39.0 (for async/await support) +- Building mavsdk-rust requires the [protoc](https://grpc.io/docs/protoc-installation/) compiler to be installed. -# Build +## Trying the Examples -*note that building mavsdk-rust requires the [protoc](https://grpc.io/docs/protoc-installation/) compiler to be installed.* +1. Start a simulator as described [here.](https://mavsdk.mavlink.io/main/en/cpp/examples/#setting-up-a-simulator) ```bash -$ cargo build +make px4_sitl jmavsim ``` -# Run examples +2. Run **MAVSDK Backend** on `localhost:50051`. [More info here.](https://mavsdk.mavlink.io/main/en/cpp/guide/build_mavsdk_server.html) -1. Run **MAVSDK Backend** on `localhost:50051` -2. Run examples -```bash -$ cargo run --example info -``` -```bash -$ cargo run --example mocap -``` ```bash -$ cargo run --example telemetry +cd [path_to_MAVSDK] +./build/default/src/mavsdk_server/src/mavsdk_server ``` -# Expected examples output +# Run examples + +3. Run examples - `info` + ```bash $ cargo run --example info Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/info` Version received: Version { flight_sw_major: 1, flight_sw_minor: 10, flight_sw_patch: 0, flight_sw_vendor_major: 0, flight_sw_vendor_minor: 0, flight_sw_vendor_patch: 0, os_sw_major: 8, os_sw_minor: 2, os_sw_patch: 0 } ``` + - `mocap` + ```bash $ cargo run --example mocap Finished dev [unoptimized + debuginfo] target(s) in 0.31s Running `target/debug/examples/mocap` -All sended successfully! +... +Sending SetVisionPositionEstimateRequest { vision_position_estimate: Some(VisionPositionEstimate { time_usec: 0, position_body: Some(PositionBody { x_m: 49.89981, y_m: -49.89981, z_m: -4.9900193 }), angle_body: Some(AngleBody { roll_rad: 0.0, pitch_rad: 0.0, yaw_rad: 0.0 }), pose_covariance: Some(Covariance { covariance_matrix: [] }) }) } +All sent successfully! ``` + - `telemetry` + ```bash $ cargo run --example telemery Compiling libmavsdk v0.1.0 (/home/ildar/sw/mavsdk-rust) Finished dev [unoptimized + debuginfo] target(s) in 4.92s Running `target/debug/examples/telemetry` +... Odometry: Odometry { time_usec: 0, frame_id: EstimNed, child_frame_id: Undef, position_body: PositionBody { x_m: 0.0, y_m: 0.0, z_m: -3.483048 }, q: Quaternion { w: 0.6384722, x: -0.004061609, y: 0.079110526, z: 0.76555747 }, speed_body: SpeedBody { velocity_x_m_s: 0.0042169667, velocity_y_m_s: -0.0015938352, velocity_z_m_s: -0.014632007 }, angular_velocity_body: AngularVelocityBody { roll_rad_s: 0.0005086092, pitch_rad_s: 0.00023366197, yaw_rad_s: -0.0002803828 }, pose_covariance: Covariance { covariance_matrix: [0.0079130605, 0.0, 0.0, 0.0, 0.0, 0.0, 0.007913225, 0.0, 0.0, 0.0, 0.0, 0.044821125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }, velocity_covariance: Covariance { covariance_matrix: [0.0052988436, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0052990587, 0.0, 0.0, 0.0, 0.0, 0.0045366324, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] } } ... ``` + +- takoff and land + +```bash +cargo run --example takeoff_and_land + Finished dev [unoptimized + debuginfo] target(s) in 0.02s + Running `target/debug/examples/takeoff_and_land` +Waiting for drone to be ready... +Drone ready to arm! +Start takeoff +Wait 10 seconds and land... +Start landing +Example finished +``` + +You should see the copter taking off, holding and landing in the sim window. diff --git a/build.rs b/build.rs index 01be678..1ecea1f 100644 --- a/build.rs +++ b/build.rs @@ -1,18 +1,18 @@ const PROTO_INCLUDE_PATH: &str = "proto/protos"; const PLUGINS: &[&str] = &[ - //"action", - //"calibration", - //"camera", - //"core", - //"geofence", - //"gimbal", + "action", + "calibration", + "camera", + "core", + "geofence", + "gimbal", "info", - //"mission", + "mission", "mocap", - //"offboard", - //"param", - //"shell", + "offboard", + "param", + "shell", "telemetry", ]; @@ -22,6 +22,7 @@ fn main() -> std::io::Result<()> { tonic_build::configure() .build_server(false) + .out_dir("src/grpc/") .compile(&[proto_path.as_str()], &[PROTO_INCLUDE_PATH])?; } Ok(()) diff --git a/examples/info.rs b/examples/info.rs index 6ec7a80..b877af1 100644 --- a/examples/info.rs +++ b/examples/info.rs @@ -1,20 +1,13 @@ -use libmavsdk::System; -use std::io::{self, Write}; +use libmavsdk::info; #[tokio::main] async fn main() -> Result<(), Box> { - let args: Vec = std::env::args().skip(1).collect(); + let mut version_service = + info::info_service_client::InfoServiceClient::connect("http://0.0.0.0:50051").await?; - if args.len() > 1 { - io::stderr() - .write_all(b"Usage: info [connection_url]\n") - .unwrap(); - std::process::exit(1); - } - - let url = args.first().cloned(); - - let version = System::connect(url).await?.info.get_version().await?; + let version = version_service + .get_version(info::GetVersionRequest::default()) + .await?; println!("Version received: {version:?}"); diff --git a/examples/mocap.rs b/examples/mocap.rs index 23846c4..0c0c616 100644 --- a/examples/mocap.rs +++ b/examples/mocap.rs @@ -1,39 +1,33 @@ -use libmavsdk::{mocap, System}; -use std::io::{self, Write}; +use libmavsdk::mocap; use std::time::Duration; #[tokio::main] async fn main() -> Result<(), Box> { - let args: Vec = std::env::args().skip(1).collect(); + let mut vision_position_estimate = mocap::VisionPositionEstimate { + time_usec: 0, + position_body: Some(mocap::PositionBody::default()), + angle_body: Some(mocap::AngleBody::default()), + pose_covariance: Some(mocap::Covariance::default()), + }; - if args.len() > 1 { - io::stderr() - .write_all(b"Usage: info [connection_url]\n") - .unwrap(); - std::process::exit(1); - } - - let url = args.first().cloned(); - - let mut system = System::connect(url).await?; - - let mut vision_position_estimate = mocap::VisionPositionEstimate::default(); - vision_position_estimate.pose_covariance.covariance_matrix = vec![std::f32::NAN]; + let mut mocap_service = + mocap::mocap_service_client::MocapServiceClient::connect("http://0.0.0.0:50051").await?; for _ in 0..500 { - system - .mocap - .set_vision_position_estimate(vision_position_estimate.clone()) - .await?; + let req = mocap::SetVisionPositionEstimateRequest { + vision_position_estimate: Some(vision_position_estimate.clone()), + }; + println!("Sending {:?}", req); + mocap_service.set_vision_position_estimate(req).await?; - vision_position_estimate.position_body.x_m += 0.1; - vision_position_estimate.position_body.y_m -= 0.1; - vision_position_estimate.position_body.z_m -= 0.01; + vision_position_estimate.position_body.as_mut().unwrap().x_m += 0.1; + vision_position_estimate.position_body.as_mut().unwrap().y_m -= 0.1; + vision_position_estimate.position_body.as_mut().unwrap().z_m -= 0.01; tokio::time::sleep(Duration::from_millis(20)).await; } - println!("All sended successfully!"); + println!("All sent successfully!"); Ok(()) } diff --git a/examples/takeoff_and_land.rs b/examples/takeoff_and_land.rs new file mode 100644 index 0000000..bedd8fc --- /dev/null +++ b/examples/takeoff_and_land.rs @@ -0,0 +1,66 @@ +use std::process; +use std::thread::sleep; +use std::time::Duration; + +use futures_util::StreamExt; +use libmavsdk::action::{self}; +use libmavsdk::telemetry; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let mut telemetry_service = + telemetry::telemetry_service_client::TelemetryServiceClient::connect( + "http://0.0.0.0:50051", + ) + .await?; + + let mut telemetry_stream = telemetry_service + .subscribe_health(telemetry::SubscribeHealthRequest::default()) + .await? + .into_inner(); + + println!("Waiting for drone to be ready..."); + while let Some(odometry) = telemetry_stream.next().await { + if odometry.is_ok() { + break; + } + } + println!("Drone ready to arm!"); + + let mut action_service = + action::action_service_client::ActionServiceClient::connect("http://0.0.0.0:50051").await?; + + let arm_request = action::ArmRequest::default(); + let arm_response = + action::action_service_client::ActionServiceClient::arm(&mut action_service, arm_request) + .await? + .into_inner(); + + // Checking responses example + if let Some(value) = arm_response.action_result { + if !value.result_str.eq("Success") { + println!("Drone armed {:?}", value); + } + } else { + process::exit(1); + } + + println!("Start takeoff"); + let takeoff_request = action::TakeoffRequest::default(); + action::action_service_client::ActionServiceClient::takeoff( + &mut action_service, + takeoff_request, + ) + .await?; + + println!("Wait 10 seconds and land..."); + sleep(Duration::from_millis(10_000)); + + println!("Start landing"); + let land_request = action::LandRequest::default(); + action::action_service_client::ActionServiceClient::land(&mut action_service, land_request) + .await?; + + println!("Example finished"); + Ok(()) +} diff --git a/examples/telemetry.rs b/examples/telemetry.rs index 5a89ecb..3cff4d6 100644 --- a/examples/telemetry.rs +++ b/examples/telemetry.rs @@ -1,29 +1,23 @@ -use futures_util::stream::StreamExt; -use libmavsdk::System; -use std::io::{self, Write}; +use futures_util::StreamExt; +use libmavsdk::telemetry; #[tokio::main] async fn main() -> Result<(), Box> { - let args: Vec = std::env::args().skip(1).collect(); - - if args.len() > 1 { - io::stderr() - .write_all(b"Usage: telemetry [connection_url]\n") - .unwrap(); - std::process::exit(1); - } - - let url = args.first().cloned(); + let mut telemetry_service = + telemetry::telemetry_service_client::TelemetryServiceClient::connect( + "http://0.0.0.0:50051", + ) + .await?; - let mut stream_odometry = System::connect(url) + let mut odometry_stream = telemetry_service + .subscribe_odometry(telemetry::SubscribeOdometryRequest::default()) .await? - .telemetry - .subscribe_odometry() - .await?; + .into_inner(); - while let Some(odometry) = stream_odometry.next().await { - println!("Received: {:?}", odometry?); + while let Some(odometry) = odometry_stream.next().await { + let asd = odometry.unwrap(); + println!("asd {:?}", asd) } - println!("Exit"); + Ok(()) } diff --git a/src/grpc/mavsdk.options.rs b/src/grpc/mavsdk.options.rs new file mode 100644 index 0000000..56bc92c --- /dev/null +++ b/src/grpc/mavsdk.options.rs @@ -0,0 +1,30 @@ +// This file is @generated by prost-build. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AsyncType { + Async = 0, + Sync = 1, + Both = 2, +} +impl AsyncType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + AsyncType::Async => "ASYNC", + AsyncType::Sync => "SYNC", + AsyncType::Both => "BOTH", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ASYNC" => Some(Self::Async), + "SYNC" => Some(Self::Sync), + "BOTH" => Some(Self::Both), + _ => None, + } + } +} diff --git a/src/grpc/mavsdk.rpc.action.rs b/src/grpc/mavsdk.rpc.action.rs new file mode 100644 index 0000000..294a958 --- /dev/null +++ b/src/grpc/mavsdk.rpc.action.rs @@ -0,0 +1,1130 @@ +// This file is @generated by prost-build. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ArmRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ArmResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DisarmRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DisarmResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TakeoffRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TakeoffResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LandRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LandResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RebootRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RebootResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ShutdownRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ShutdownResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TerminateRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TerminateResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KillRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KillResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReturnToLaunchRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReturnToLaunchResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GotoLocationRequest { + /// Latitude (in degrees) + #[prost(double, tag = "1")] + pub latitude_deg: f64, + /// Longitude (in degrees) + #[prost(double, tag = "2")] + pub longitude_deg: f64, + /// Altitude AMSL (in meters) + #[prost(float, tag = "3")] + pub absolute_altitude_m: f32, + /// Yaw angle (in degrees, frame is NED, 0 is North, positive is clockwise) + #[prost(float, tag = "4")] + pub yaw_deg: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GotoLocationResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DoOrbitRequest { + /// Radius of circle (in meters) + #[prost(float, tag = "1")] + pub radius_m: f32, + /// Tangential velocity (in m/s) + #[prost(float, tag = "2")] + pub velocity_ms: f32, + /// Yaw behavior of vehicle (ORBIT_YAW_BEHAVIOUR) + #[prost(enumeration = "OrbitYawBehavior", tag = "3")] + pub yaw_behavior: i32, + /// Center point latitude in degrees. NAN: use current latitude for center + #[prost(double, tag = "5")] + pub latitude_deg: f64, + /// Center point longitude in degrees. NAN: use current longitude for center + #[prost(double, tag = "6")] + pub longitude_deg: f64, + /// Center point altitude in meters. NAN: use current altitude for center + #[prost(double, tag = "7")] + pub absolute_altitude_m: f64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DoOrbitResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HoldRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HoldResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetActuatorRequest { + /// Index of actuator (starting with 1) + #[prost(int32, tag = "1")] + pub index: i32, + /// Value to set the actuator to (normalized from \[-1..1\]) + #[prost(float, tag = "2")] + pub value: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetActuatorResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransitionToFixedwingRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransitionToFixedwingResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransitionToMulticopterRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransitionToMulticopterResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTakeoffAltitudeRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTakeoffAltitudeResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, + /// Takeoff altitude relative to ground/takeoff location (in meters) + #[prost(float, tag = "2")] + pub altitude: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetTakeoffAltitudeRequest { + /// Takeoff altitude relative to ground/takeoff location (in meters) + #[prost(float, tag = "1")] + pub altitude: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetTakeoffAltitudeResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMaximumSpeedRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMaximumSpeedResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, + /// Maximum speed (in metres/second) + #[prost(float, tag = "2")] + pub speed: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetMaximumSpeedRequest { + /// Maximum speed (in metres/second) + #[prost(float, tag = "1")] + pub speed: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetMaximumSpeedResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetReturnToLaunchAltitudeRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetReturnToLaunchAltitudeResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, + /// Return altitude relative to takeoff location (in meters) + #[prost(float, tag = "2")] + pub relative_altitude_m: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetReturnToLaunchAltitudeRequest { + /// Return altitude relative to takeoff location (in meters) + #[prost(float, tag = "1")] + pub relative_altitude_m: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetReturnToLaunchAltitudeResponse { + #[prost(message, optional, tag = "1")] + pub action_result: ::core::option::Option, +} +/// Result type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionResult { + /// Result enum value + #[prost(enumeration = "action_result::Result", tag = "1")] + pub result: i32, + /// Human-readable English string describing the result + #[prost(string, tag = "2")] + pub result_str: ::prost::alloc::string::String, +} +/// Nested message and enum types in `ActionResult`. +pub mod action_result { + /// Possible results returned for action requests. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Result { + /// Unknown result + Unknown = 0, + /// Request was successful + Success = 1, + /// No system is connected + NoSystem = 2, + /// Connection error + ConnectionError = 3, + /// Vehicle is busy + Busy = 4, + /// Command refused by vehicle + CommandDenied = 5, + /// Command refused because landed state is unknown + CommandDeniedLandedStateUnknown = 6, + /// Command refused because vehicle not landed + CommandDeniedNotLanded = 7, + /// Request timed out + Timeout = 8, + /// Hybrid/VTOL transition support is unknown + VtolTransitionSupportUnknown = 9, + /// Vehicle does not support hybrid/VTOL transitions + NoVtolTransitionSupport = 10, + /// Error getting or setting parameter + ParameterError = 11, + } + impl Result { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Result::Unknown => "RESULT_UNKNOWN", + Result::Success => "RESULT_SUCCESS", + Result::NoSystem => "RESULT_NO_SYSTEM", + Result::ConnectionError => "RESULT_CONNECTION_ERROR", + Result::Busy => "RESULT_BUSY", + Result::CommandDenied => "RESULT_COMMAND_DENIED", + Result::CommandDeniedLandedStateUnknown => { + "RESULT_COMMAND_DENIED_LANDED_STATE_UNKNOWN" + } + Result::CommandDeniedNotLanded => "RESULT_COMMAND_DENIED_NOT_LANDED", + Result::Timeout => "RESULT_TIMEOUT", + Result::VtolTransitionSupportUnknown => { + "RESULT_VTOL_TRANSITION_SUPPORT_UNKNOWN" + } + Result::NoVtolTransitionSupport => "RESULT_NO_VTOL_TRANSITION_SUPPORT", + Result::ParameterError => "RESULT_PARAMETER_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "RESULT_UNKNOWN" => Some(Self::Unknown), + "RESULT_SUCCESS" => Some(Self::Success), + "RESULT_NO_SYSTEM" => Some(Self::NoSystem), + "RESULT_CONNECTION_ERROR" => Some(Self::ConnectionError), + "RESULT_BUSY" => Some(Self::Busy), + "RESULT_COMMAND_DENIED" => Some(Self::CommandDenied), + "RESULT_COMMAND_DENIED_LANDED_STATE_UNKNOWN" => { + Some(Self::CommandDeniedLandedStateUnknown) + } + "RESULT_COMMAND_DENIED_NOT_LANDED" => Some(Self::CommandDeniedNotLanded), + "RESULT_TIMEOUT" => Some(Self::Timeout), + "RESULT_VTOL_TRANSITION_SUPPORT_UNKNOWN" => { + Some(Self::VtolTransitionSupportUnknown) + } + "RESULT_NO_VTOL_TRANSITION_SUPPORT" => { + Some(Self::NoVtolTransitionSupport) + } + "RESULT_PARAMETER_ERROR" => Some(Self::ParameterError), + _ => None, + } + } + } +} +/// Yaw behaviour during orbit flight. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum OrbitYawBehavior { + /// Vehicle front points to the center (default) + HoldFrontToCircleCenter = 0, + /// Vehicle front holds heading when message received + HoldInitialHeading = 1, + /// Yaw uncontrolled + Uncontrolled = 2, + /// Vehicle front follows flight path (tangential to circle) + HoldFrontTangentToCircle = 3, + /// Yaw controlled by RC input + RcControlled = 4, +} +impl OrbitYawBehavior { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OrbitYawBehavior::HoldFrontToCircleCenter => { + "ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TO_CIRCLE_CENTER" + } + OrbitYawBehavior::HoldInitialHeading => { + "ORBIT_YAW_BEHAVIOR_HOLD_INITIAL_HEADING" + } + OrbitYawBehavior::Uncontrolled => "ORBIT_YAW_BEHAVIOR_UNCONTROLLED", + OrbitYawBehavior::HoldFrontTangentToCircle => { + "ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TANGENT_TO_CIRCLE" + } + OrbitYawBehavior::RcControlled => "ORBIT_YAW_BEHAVIOR_RC_CONTROLLED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TO_CIRCLE_CENTER" => { + Some(Self::HoldFrontToCircleCenter) + } + "ORBIT_YAW_BEHAVIOR_HOLD_INITIAL_HEADING" => Some(Self::HoldInitialHeading), + "ORBIT_YAW_BEHAVIOR_UNCONTROLLED" => Some(Self::Uncontrolled), + "ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TANGENT_TO_CIRCLE" => { + Some(Self::HoldFrontTangentToCircle) + } + "ORBIT_YAW_BEHAVIOR_RC_CONTROLLED" => Some(Self::RcControlled), + _ => None, + } + } +} +/// Generated client implementations. +pub mod action_service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Enable simple actions such as arming, taking off, and landing. + #[derive(Debug, Clone)] + pub struct ActionServiceClient { + inner: tonic::client::Grpc, + } + impl ActionServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ActionServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ActionServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ActionServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// + /// Send command to arm the drone. + /// + /// Arming a drone normally causes motors to spin at idle. + /// Before arming take all safety precautions and stand clear of the drone! + pub async fn arm( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Arm", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Arm")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to disarm the drone. + /// + /// This will disarm a drone that considers itself landed. If flying, the drone should + /// reject the disarm command. Disarming means that all motors will stop. + pub async fn disarm( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Disarm", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Disarm")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to take off and hover. + /// + /// This switches the drone into position control mode and commands + /// it to take off and hover at the takeoff altitude. + /// + /// Note that the vehicle must be armed before it can take off. + pub async fn takeoff( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Takeoff", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Takeoff")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to land at the current position. + /// + /// This switches the drone to 'Land' flight mode. + pub async fn land( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Land", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Land")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to reboot the drone components. + /// + /// This will reboot the autopilot, companion computer, camera and gimbal. + pub async fn reboot( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Reboot", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Reboot")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to shut down the drone components. + /// + /// This will shut down the autopilot, onboard computer, camera and gimbal. + /// This command should only be used when the autopilot is disarmed and autopilots commonly + /// reject it if they are not already ready to shut down. + pub async fn shutdown( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Shutdown", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Shutdown")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to terminate the drone. + /// + /// This will run the terminate routine as configured on the drone (e.g. disarm and open the parachute). + pub async fn terminate( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Terminate", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Terminate")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to kill the drone. + /// + /// This will disarm a drone irrespective of whether it is landed or flying. + /// Note that the drone will fall out of the sky if this command is used while flying. + pub async fn kill( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Kill", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Kill")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to return to the launch (takeoff) position and land. + /// + /// This switches the drone into [Return mode](https://docs.px4.io/master/en/flight_modes/return.html) which + /// generally means it will rise up to a certain altitude to clear any obstacles before heading + /// back to the launch (takeoff) position and land there. + pub async fn return_to_launch( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/ReturnToLaunch", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("mavsdk.rpc.action.ActionService", "ReturnToLaunch"), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to move the vehicle to a specific global position. + /// + /// The latitude and longitude are given in degrees (WGS84 frame) and the altitude + /// in meters AMSL (above mean sea level). + /// + /// The yaw angle is in degrees (frame is NED, 0 is North, positive is clockwise). + pub async fn goto_location( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/GotoLocation", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("mavsdk.rpc.action.ActionService", "GotoLocation"), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Send command do orbit to the drone. + /// + /// This will run the orbit routine with the given parameters. + pub async fn do_orbit( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/DoOrbit", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "DoOrbit")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to hold position (a.k.a. "Loiter"). + /// + /// Sends a command to drone to change to Hold flight mode, causing the + /// vehicle to stop and maintain its current GPS position and altitude. + /// + /// Note: this command is specific to the PX4 Autopilot flight stack as + /// it implies a change to a PX4-specific mode. + pub async fn hold( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/Hold", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("mavsdk.rpc.action.ActionService", "Hold")); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to set the value of an actuator. + pub async fn set_actuator( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/SetActuator", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("mavsdk.rpc.action.ActionService", "SetActuator"), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to transition the drone to fixedwing. + /// + /// The associated action will only be executed for VTOL vehicles (on other vehicle types the + /// command will fail). The command will succeed if called when the vehicle + /// is already in fixedwing mode. + pub async fn transition_to_fixedwing( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/TransitionToFixedwing", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.action.ActionService", + "TransitionToFixedwing", + ), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Send command to transition the drone to multicopter. + /// + /// The associated action will only be executed for VTOL vehicles (on other vehicle types the + /// command will fail). The command will succeed if called when the vehicle + /// is already in multicopter mode. + pub async fn transition_to_multicopter( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/TransitionToMulticopter", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.action.ActionService", + "TransitionToMulticopter", + ), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Get the takeoff altitude (in meters above ground). + pub async fn get_takeoff_altitude( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/GetTakeoffAltitude", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.action.ActionService", + "GetTakeoffAltitude", + ), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Set takeoff altitude (in meters above ground). + pub async fn set_takeoff_altitude( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/SetTakeoffAltitude", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.action.ActionService", + "SetTakeoffAltitude", + ), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Get the vehicle maximum speed (in metres/second). + pub async fn get_maximum_speed( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/GetMaximumSpeed", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("mavsdk.rpc.action.ActionService", "GetMaximumSpeed"), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Set vehicle maximum speed (in metres/second). + pub async fn set_maximum_speed( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/SetMaximumSpeed", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("mavsdk.rpc.action.ActionService", "SetMaximumSpeed"), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Get the return to launch minimum return altitude (in meters). + pub async fn get_return_to_launch_altitude( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/GetReturnToLaunchAltitude", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.action.ActionService", + "GetReturnToLaunchAltitude", + ), + ); + self.inner.unary(req, path, codec).await + } + /// + /// Set the return to launch minimum return altitude (in meters). + pub async fn set_return_to_launch_altitude( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.action.ActionService/SetReturnToLaunchAltitude", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.action.ActionService", + "SetReturnToLaunchAltitude", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/grpc/mavsdk.rpc.calibration.rs b/src/grpc/mavsdk.rpc.calibration.rs new file mode 100644 index 0000000..a3c6de6 --- /dev/null +++ b/src/grpc/mavsdk.rpc.calibration.rs @@ -0,0 +1,466 @@ +// This file is @generated by prost-build. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeCalibrateGyroRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CalibrateGyroResponse { + #[prost(message, optional, tag = "1")] + pub calibration_result: ::core::option::Option, + /// Progress data + #[prost(message, optional, tag = "2")] + pub progress_data: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeCalibrateAccelerometerRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CalibrateAccelerometerResponse { + #[prost(message, optional, tag = "1")] + pub calibration_result: ::core::option::Option, + /// Progress data + #[prost(message, optional, tag = "2")] + pub progress_data: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeCalibrateMagnetometerRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CalibrateMagnetometerResponse { + #[prost(message, optional, tag = "1")] + pub calibration_result: ::core::option::Option, + /// Progress data + #[prost(message, optional, tag = "2")] + pub progress_data: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeCalibrateLevelHorizonRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CalibrateLevelHorizonResponse { + #[prost(message, optional, tag = "1")] + pub calibration_result: ::core::option::Option, + /// Progress data + #[prost(message, optional, tag = "2")] + pub progress_data: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeCalibrateGimbalAccelerometerRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CalibrateGimbalAccelerometerResponse { + #[prost(message, optional, tag = "1")] + pub calibration_result: ::core::option::Option, + /// Progress data + #[prost(message, optional, tag = "2")] + pub progress_data: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CancelRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CancelResponse { + #[prost(message, optional, tag = "1")] + pub calibration_result: ::core::option::Option, +} +/// Result type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CalibrationResult { + /// Result enum value + #[prost(enumeration = "calibration_result::Result", tag = "1")] + pub result: i32, + /// Human-readable English string describing the result + #[prost(string, tag = "2")] + pub result_str: ::prost::alloc::string::String, +} +/// Nested message and enum types in `CalibrationResult`. +pub mod calibration_result { + /// Possible results returned for calibration commands + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Result { + /// Unknown result + Unknown = 0, + /// The calibration succeeded + Success = 1, + /// Intermediate message showing progress or instructions on the next steps + Next = 2, + /// Calibration failed + Failed = 3, + /// No system is connected + NoSystem = 4, + /// Connection error + ConnectionError = 5, + /// Vehicle is busy + Busy = 6, + /// Command refused by vehicle + CommandDenied = 7, + /// Command timed out + Timeout = 8, + /// Calibration process was cancelled + Cancelled = 9, + /// Calibration process failed since the vehicle is armed + FailedArmed = 10, + } + impl Result { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Result::Unknown => "RESULT_UNKNOWN", + Result::Success => "RESULT_SUCCESS", + Result::Next => "RESULT_NEXT", + Result::Failed => "RESULT_FAILED", + Result::NoSystem => "RESULT_NO_SYSTEM", + Result::ConnectionError => "RESULT_CONNECTION_ERROR", + Result::Busy => "RESULT_BUSY", + Result::CommandDenied => "RESULT_COMMAND_DENIED", + Result::Timeout => "RESULT_TIMEOUT", + Result::Cancelled => "RESULT_CANCELLED", + Result::FailedArmed => "RESULT_FAILED_ARMED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "RESULT_UNKNOWN" => Some(Self::Unknown), + "RESULT_SUCCESS" => Some(Self::Success), + "RESULT_NEXT" => Some(Self::Next), + "RESULT_FAILED" => Some(Self::Failed), + "RESULT_NO_SYSTEM" => Some(Self::NoSystem), + "RESULT_CONNECTION_ERROR" => Some(Self::ConnectionError), + "RESULT_BUSY" => Some(Self::Busy), + "RESULT_COMMAND_DENIED" => Some(Self::CommandDenied), + "RESULT_TIMEOUT" => Some(Self::Timeout), + "RESULT_CANCELLED" => Some(Self::Cancelled), + "RESULT_FAILED_ARMED" => Some(Self::FailedArmed), + _ => None, + } + } + } +} +/// +/// Progress data coming from calibration. +/// +/// Can be a progress percentage, or an instruction text. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProgressData { + /// Whether this ProgressData contains a 'progress' status or not + #[prost(bool, tag = "1")] + pub has_progress: bool, + /// Progress (percentage) + #[prost(float, tag = "2")] + pub progress: f32, + /// Whether this ProgressData contains a 'status_text' or not + #[prost(bool, tag = "3")] + pub has_status_text: bool, + /// Instruction text + #[prost(string, tag = "4")] + pub status_text: ::prost::alloc::string::String, +} +/// Generated client implementations. +pub mod calibration_service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Enable to calibrate sensors of a drone such as gyro, accelerometer, and magnetometer. + #[derive(Debug, Clone)] + pub struct CalibrationServiceClient { + inner: tonic::client::Grpc, + } + impl CalibrationServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl CalibrationServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> CalibrationServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + CalibrationServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Perform gyro calibration. + pub async fn subscribe_calibrate_gyro( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.calibration.CalibrationService/SubscribeCalibrateGyro", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.calibration.CalibrationService", + "SubscribeCalibrateGyro", + ), + ); + self.inner.server_streaming(req, path, codec).await + } + /// Perform accelerometer calibration. + pub async fn subscribe_calibrate_accelerometer( + &mut self, + request: impl tonic::IntoRequest< + super::SubscribeCalibrateAccelerometerRequest, + >, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.calibration.CalibrationService/SubscribeCalibrateAccelerometer", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.calibration.CalibrationService", + "SubscribeCalibrateAccelerometer", + ), + ); + self.inner.server_streaming(req, path, codec).await + } + /// Perform magnetometer calibration. + pub async fn subscribe_calibrate_magnetometer( + &mut self, + request: impl tonic::IntoRequest< + super::SubscribeCalibrateMagnetometerRequest, + >, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.calibration.CalibrationService/SubscribeCalibrateMagnetometer", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.calibration.CalibrationService", + "SubscribeCalibrateMagnetometer", + ), + ); + self.inner.server_streaming(req, path, codec).await + } + /// Perform board level horizon calibration. + pub async fn subscribe_calibrate_level_horizon( + &mut self, + request: impl tonic::IntoRequest< + super::SubscribeCalibrateLevelHorizonRequest, + >, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.calibration.CalibrationService/SubscribeCalibrateLevelHorizon", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.calibration.CalibrationService", + "SubscribeCalibrateLevelHorizon", + ), + ); + self.inner.server_streaming(req, path, codec).await + } + /// Perform gimbal accelerometer calibration. + pub async fn subscribe_calibrate_gimbal_accelerometer( + &mut self, + request: impl tonic::IntoRequest< + super::SubscribeCalibrateGimbalAccelerometerRequest, + >, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.calibration.CalibrationService/SubscribeCalibrateGimbalAccelerometer", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.calibration.CalibrationService", + "SubscribeCalibrateGimbalAccelerometer", + ), + ); + self.inner.server_streaming(req, path, codec).await + } + /// Cancel ongoing calibration process. + pub async fn cancel( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/mavsdk.rpc.calibration.CalibrationService/Cancel", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "mavsdk.rpc.calibration.CalibrationService", + "Cancel", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/grpc/mavsdk.rpc.camera.rs b/src/grpc/mavsdk.rpc.camera.rs new file mode 100644 index 0000000..c2859d7 --- /dev/null +++ b/src/grpc/mavsdk.rpc.camera.rs @@ -0,0 +1,1426 @@ +// This file is @generated by prost-build. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrepareRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrepareResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TakePhotoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TakePhotoResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartPhotoIntervalRequest { + /// Interval between photos (in seconds) + #[prost(float, tag = "1")] + pub interval_s: f32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartPhotoIntervalResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StopPhotoIntervalRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StopPhotoIntervalResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartVideoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartVideoResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StopVideoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StopVideoResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartVideoStreamingRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartVideoStreamingResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StopVideoStreamingRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StopVideoStreamingResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetModeRequest { + /// Camera mode to set + #[prost(enumeration = "Mode", tag = "1")] + pub mode: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetModeResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListPhotosRequest { + /// Which photos should be listed (all or since connection) + #[prost(enumeration = "PhotosRange", tag = "1")] + pub photos_range: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListPhotosResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, + /// List of capture infos (representing the photos) + #[prost(message, repeated, tag = "2")] + pub capture_infos: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeInformationRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InformationResponse { + /// Camera information + #[prost(message, optional, tag = "1")] + pub information: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeModeRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModeResponse { + /// Camera mode + #[prost(enumeration = "Mode", tag = "1")] + pub mode: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeVideoStreamInfoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VideoStreamInfoResponse { + /// Video stream info + #[prost(message, optional, tag = "1")] + pub video_stream_info: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeCaptureInfoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CaptureInfoResponse { + /// Capture info + #[prost(message, optional, tag = "1")] + pub capture_info: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeStatusRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusResponse { + /// Camera status + #[prost(message, optional, tag = "1")] + pub camera_status: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribeCurrentSettingsRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CurrentSettingsResponse { + /// List of current settings + #[prost(message, repeated, tag = "1")] + pub current_settings: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubscribePossibleSettingOptionsRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PossibleSettingOptionsResponse { + /// List of settings that can be changed + #[prost(message, repeated, tag = "1")] + pub setting_options: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetSettingRequest { + /// Desired setting + #[prost(message, optional, tag = "1")] + pub setting: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetSettingResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSettingRequest { + /// Requested setting + #[prost(message, optional, tag = "1")] + pub setting: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSettingResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, + /// Setting + #[prost(message, optional, tag = "2")] + pub setting: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FormatStorageRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FormatStorageResponse { + #[prost(message, optional, tag = "1")] + pub camera_result: ::core::option::Option, +} +/// Result type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CameraResult { + /// Result enum value + #[prost(enumeration = "camera_result::Result", tag = "1")] + pub result: i32, + /// Human-readable English string describing the result + #[prost(string, tag = "2")] + pub result_str: ::prost::alloc::string::String, +} +/// Nested message and enum types in `CameraResult`. +pub mod camera_result { + /// Possible results returned for camera commands + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Result { + /// Unknown result + Unknown = 0, + /// Command executed successfully + Success = 1, + /// Command in progress + InProgress = 2, + /// Camera is busy and rejected command + Busy = 3, + /// Camera denied the command + Denied = 4, + /// An error has occurred while executing the command + Error = 5, + /// Command timed out + Timeout = 6, + /// Command has wrong argument(s) + WrongArgument = 7, + /// No system connected + NoSystem = 8, + } + impl Result { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Result::Unknown => "RESULT_UNKNOWN", + Result::Success => "RESULT_SUCCESS", + Result::InProgress => "RESULT_IN_PROGRESS", + Result::Busy => "RESULT_BUSY", + Result::Denied => "RESULT_DENIED", + Result::Error => "RESULT_ERROR", + Result::Timeout => "RESULT_TIMEOUT", + Result::WrongArgument => "RESULT_WRONG_ARGUMENT", + Result::NoSystem => "RESULT_NO_SYSTEM", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "RESULT_UNKNOWN" => Some(Self::Unknown), + "RESULT_SUCCESS" => Some(Self::Success), + "RESULT_IN_PROGRESS" => Some(Self::InProgress), + "RESULT_BUSY" => Some(Self::Busy), + "RESULT_DENIED" => Some(Self::Denied), + "RESULT_ERROR" => Some(Self::Error), + "RESULT_TIMEOUT" => Some(Self::Timeout), + "RESULT_WRONG_ARGUMENT" => Some(Self::WrongArgument), + "RESULT_NO_SYSTEM" => Some(Self::NoSystem), + _ => None, + } + } + } +} +/// Position type in global coordinates. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Position { + /// Latitude in degrees (range: -90 to +90) + #[prost(double, tag = "1")] + pub latitude_deg: f64, + /// Longitude in degrees (range: -180 to +180) + #[prost(double, tag = "2")] + pub longitude_deg: f64, + /// Altitude AMSL (above mean sea level) in metres + #[prost(float, tag = "3")] + pub absolute_altitude_m: f32, + /// Altitude relative to takeoff altitude in metres + #[prost(float, tag = "4")] + pub relative_altitude_m: f32, +} +/// +/// 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: +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Quaternion { + /// Quaternion entry 0, also denoted as a + #[prost(float, tag = "1")] + pub w: f32, + /// Quaternion entry 1, also denoted as b + #[prost(float, tag = "2")] + pub x: f32, + /// Quaternion entry 2, also denoted as c + #[prost(float, tag = "3")] + pub y: f32, + /// Quaternion entry 3, also denoted as d + #[prost(float, tag = "4")] + pub z: f32, +} +/// +/// Euler angle type. +/// +/// All rotations and axis systems follow the right-hand rule. +/// The Euler angles follow the convention of a 3-2-1 intrinsic Tait-Bryan rotation sequence. +/// +/// For more info see +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EulerAngle { + /// Roll angle in degrees, positive is banking to the right + #[prost(float, tag = "1")] + pub roll_deg: f32, + /// Pitch angle in degrees, positive is pitching nose up + #[prost(float, tag = "2")] + pub pitch_deg: f32, + /// Yaw angle in degrees, positive is clock-wise seen from above + #[prost(float, tag = "3")] + pub yaw_deg: f32, +} +/// Information about a picture just captured. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CaptureInfo { + /// Location where the picture was taken + #[prost(message, optional, tag = "1")] + pub position: ::core::option::Option, + /// Attitude of the camera when the picture was taken (quaternion) + #[prost(message, optional, tag = "2")] + pub attitude_quaternion: ::core::option::Option, + /// Attitude of the camera when the picture was taken (euler angle) + #[prost(message, optional, tag = "3")] + pub attitude_euler_angle: ::core::option::Option, + /// Timestamp in UTC (since UNIX epoch) in microseconds + #[prost(uint64, tag = "4")] + pub time_utc_us: u64, + /// True if the capture was successful + #[prost(bool, tag = "5")] + pub is_success: bool, + /// Zero-based index of this image since vehicle was armed + #[prost(int32, tag = "6")] + pub index: i32, + /// Download URL of this image + #[prost(string, tag = "7")] + pub file_url: ::prost::alloc::string::String, +} +/// Type for video stream settings. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VideoStreamSettings { + /// Frames per second + #[prost(float, tag = "1")] + pub frame_rate_hz: f32, + /// Horizontal resolution (in pixels) + #[prost(uint32, tag = "2")] + pub horizontal_resolution_pix: u32, + /// Vertical resolution (in pixels) + #[prost(uint32, tag = "3")] + pub vertical_resolution_pix: u32, + /// Bit rate (in bits per second) + #[prost(uint32, tag = "4")] + pub bit_rate_b_s: u32, + /// Video image rotation (clockwise, 0-359 degrees) + #[prost(uint32, tag = "5")] + pub rotation_deg: u32, + /// Video stream URI + #[prost(string, tag = "6")] + pub uri: ::prost::alloc::string::String, + /// Horizontal fov in degrees + #[prost(float, tag = "7")] + pub horizontal_fov_deg: f32, +} +/// Information about the video stream. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VideoStreamInfo { + /// Video stream settings + #[prost(message, optional, tag = "1")] + pub settings: ::core::option::Option, + /// Current status of video streaming + #[prost(enumeration = "video_stream_info::VideoStreamStatus", tag = "2")] + pub status: i32, + /// Light-spectrum of the video stream + #[prost(enumeration = "video_stream_info::VideoStreamSpectrum", tag = "3")] + pub spectrum: i32, +} +/// Nested message and enum types in `VideoStreamInfo`. +pub mod video_stream_info { + /// Video stream status type. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum VideoStreamStatus { + /// Video stream is not running + NotRunning = 0, + /// Video stream is running + InProgress = 1, + } + impl VideoStreamStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + VideoStreamStatus::NotRunning => "VIDEO_STREAM_STATUS_NOT_RUNNING", + VideoStreamStatus::InProgress => "VIDEO_STREAM_STATUS_IN_PROGRESS", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VIDEO_STREAM_STATUS_NOT_RUNNING" => Some(Self::NotRunning), + "VIDEO_STREAM_STATUS_IN_PROGRESS" => Some(Self::InProgress), + _ => None, + } + } + } + /// Video stream light spectrum type + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum VideoStreamSpectrum { + /// Unknown + Unknown = 0, + /// Visible light + VisibleLight = 1, + /// Infrared + Infrared = 2, + } + impl VideoStreamSpectrum { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + VideoStreamSpectrum::Unknown => "VIDEO_STREAM_SPECTRUM_UNKNOWN", + VideoStreamSpectrum::VisibleLight => { + "VIDEO_STREAM_SPECTRUM_VISIBLE_LIGHT" + } + VideoStreamSpectrum::Infrared => "VIDEO_STREAM_SPECTRUM_INFRARED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VIDEO_STREAM_SPECTRUM_UNKNOWN" => Some(Self::Unknown), + "VIDEO_STREAM_SPECTRUM_VISIBLE_LIGHT" => Some(Self::VisibleLight), + "VIDEO_STREAM_SPECTRUM_INFRARED" => Some(Self::Infrared), + _ => None, + } + } + } +} +/// Information about the camera status. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Status { + /// Whether video recording is currently in process + #[prost(bool, tag = "1")] + pub video_on: bool, + /// Whether a photo interval is currently in process + #[prost(bool, tag = "2")] + pub photo_interval_on: bool, + /// Used storage (in MiB) + #[prost(float, tag = "3")] + pub used_storage_mib: f32, + /// Available storage (in MiB) + #[prost(float, tag = "4")] + pub available_storage_mib: f32, + /// Total storage (in MiB) + #[prost(float, tag = "5")] + pub total_storage_mib: f32, + /// Elapsed time since starting the video recording (in seconds) + #[prost(float, tag = "6")] + pub recording_time_s: f32, + /// Current folder name where media are saved + #[prost(string, tag = "7")] + pub media_folder_name: ::prost::alloc::string::String, + /// Storage status + #[prost(enumeration = "status::StorageStatus", tag = "8")] + pub storage_status: i32, +} +/// Nested message and enum types in `Status`. +pub mod status { + /// Storage status type. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum StorageStatus { + /// Status not available + NotAvailable = 0, + /// Storage is not formatted (i.e. has no recognized file system) + Unformatted = 1, + /// Storage is formatted (i.e. has recognized a file system) + Formatted = 2, + /// Storage status is not supported + NotSupported = 3, + } + impl StorageStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + StorageStatus::NotAvailable => "STORAGE_STATUS_NOT_AVAILABLE", + StorageStatus::Unformatted => "STORAGE_STATUS_UNFORMATTED", + StorageStatus::Formatted => "STORAGE_STATUS_FORMATTED", + StorageStatus::NotSupported => "STORAGE_STATUS_NOT_SUPPORTED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "STORAGE_STATUS_NOT_AVAILABLE" => Some(Self::NotAvailable), + "STORAGE_STATUS_UNFORMATTED" => Some(Self::Unformatted), + "STORAGE_STATUS_FORMATTED" => Some(Self::Formatted), + "STORAGE_STATUS_NOT_SUPPORTED" => Some(Self::NotSupported), + _ => None, + } + } + } +} +/// Type to represent a setting option. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Option { + /// Name of the option (machine readable) + #[prost(string, tag = "1")] + pub option_id: ::prost::alloc::string::String, + /// Description of the option (human readable) + #[prost(string, tag = "2")] + pub option_description: ::prost::alloc::string::String, +} +/// Type to represent a setting with a selected option. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Setting { + /// Name of a setting (machine readable) + #[prost(string, tag = "1")] + pub setting_id: ::prost::alloc::string::String, + /// Description of the setting (human readable). This field is meant to be read from the drone, ignore it when setting. + #[prost(string, tag = "2")] + pub setting_description: ::prost::alloc::string::String, + /// Selected option + #[prost(message, optional, tag = "3")] + pub option: ::core::option::Option