mav_sdk/grpc/
mavsdk.rpc.offboard.rs

1#[derive(Clone, PartialEq, ::prost::Message)]
2pub struct StartRequest {}
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct StartResponse {
5    #[prost(message, optional, tag = "1")]
6    pub offboard_result: ::core::option::Option<OffboardResult>,
7}
8#[derive(Clone, PartialEq, ::prost::Message)]
9pub struct StopRequest {}
10#[derive(Clone, PartialEq, ::prost::Message)]
11pub struct StopResponse {
12    #[prost(message, optional, tag = "1")]
13    pub offboard_result: ::core::option::Option<OffboardResult>,
14}
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct IsActiveRequest {}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct IsActiveResponse {
19    /// True if offboard is active
20    #[prost(bool, tag = "1")]
21    pub is_active: bool,
22}
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct SetAttitudeRequest {
25    /// Attitude roll, pitch and yaw along with thrust
26    #[prost(message, optional, tag = "1")]
27    pub attitude: ::core::option::Option<Attitude>,
28}
29#[derive(Clone, PartialEq, ::prost::Message)]
30pub struct SetAttitudeResponse {
31    #[prost(message, optional, tag = "1")]
32    pub offboard_result: ::core::option::Option<OffboardResult>,
33}
34#[derive(Clone, PartialEq, ::prost::Message)]
35pub struct SetActuatorControlRequest {
36    /// Actuator control values
37    #[prost(message, optional, tag = "1")]
38    pub actuator_control: ::core::option::Option<ActuatorControl>,
39}
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct SetActuatorControlResponse {
42    #[prost(message, optional, tag = "1")]
43    pub offboard_result: ::core::option::Option<OffboardResult>,
44}
45#[derive(Clone, PartialEq, ::prost::Message)]
46pub struct SetAttitudeRateRequest {
47    /// Attitude rate roll, pitch and yaw angular rate along with thrust
48    #[prost(message, optional, tag = "1")]
49    pub attitude_rate: ::core::option::Option<AttitudeRate>,
50}
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct SetAttitudeRateResponse {
53    #[prost(message, optional, tag = "1")]
54    pub offboard_result: ::core::option::Option<OffboardResult>,
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
57pub struct SetPositionNedRequest {
58    /// Position and yaw
59    #[prost(message, optional, tag = "1")]
60    pub position_ned_yaw: ::core::option::Option<PositionNedYaw>,
61}
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct SetPositionNedResponse {
64    #[prost(message, optional, tag = "1")]
65    pub offboard_result: ::core::option::Option<OffboardResult>,
66}
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct SetVelocityBodyRequest {
69    /// Velocity and yaw angular rate
70    #[prost(message, optional, tag = "1")]
71    pub velocity_body_yawspeed: ::core::option::Option<VelocityBodyYawspeed>,
72}
73#[derive(Clone, PartialEq, ::prost::Message)]
74pub struct SetVelocityBodyResponse {
75    #[prost(message, optional, tag = "1")]
76    pub offboard_result: ::core::option::Option<OffboardResult>,
77}
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct SetVelocityNedRequest {
80    /// Velocity and yaw
81    #[prost(message, optional, tag = "1")]
82    pub velocity_ned_yaw: ::core::option::Option<VelocityNedYaw>,
83}
84#[derive(Clone, PartialEq, ::prost::Message)]
85pub struct SetVelocityNedResponse {
86    #[prost(message, optional, tag = "1")]
87    pub offboard_result: ::core::option::Option<OffboardResult>,
88}
89#[derive(Clone, PartialEq, ::prost::Message)]
90pub struct SetPositionVelocityNedRequest {
91    /// Position and yaw
92    #[prost(message, optional, tag = "1")]
93    pub position_ned_yaw: ::core::option::Option<PositionNedYaw>,
94    /// Velocity and yaw
95    #[prost(message, optional, tag = "2")]
96    pub velocity_ned_yaw: ::core::option::Option<VelocityNedYaw>,
97}
98#[derive(Clone, PartialEq, ::prost::Message)]
99pub struct SetPositionVelocityNedResponse {
100    #[prost(message, optional, tag = "1")]
101    pub offboard_result: ::core::option::Option<OffboardResult>,
102}
103/// Type for attitude body angles in NED reference frame (roll, pitch, yaw and thrust)
104#[derive(Clone, PartialEq, ::prost::Message)]
105pub struct Attitude {
106    /// Roll angle (in degrees, positive is right side down)
107    #[prost(float, tag = "1")]
108    pub roll_deg: f32,
109    /// Pitch angle (in degrees, positive is nose up)
110    #[prost(float, tag = "2")]
111    pub pitch_deg: f32,
112    /// Yaw angle (in degrees, positive is move nose to the right)
113    #[prost(float, tag = "3")]
114    pub yaw_deg: f32,
115    /// Thrust (range: 0 to 1)
116    #[prost(float, tag = "4")]
117    pub thrust_value: f32,
118}
119///
120/// Eight controls that will be given to the group. Each control is a normalized
121/// (-1..+1) command value, which will be mapped and scaled through the mixer.
122#[derive(Clone, PartialEq, ::prost::Message)]
123pub struct ActuatorControlGroup {
124    /// Controls in the group
125    #[prost(float, repeated, tag = "1")]
126    pub controls: ::prost::alloc::vec::Vec<f32>,
127}
128///
129/// Type for actuator control.
130///
131/// Control members should be normed to -1..+1 where 0 is neutral position.
132/// Throttle for single rotation direction motors is 0..1, negative range for reverse direction.
133///
134/// One group support eight controls.
135///
136/// Up to 16 actuator controls can be set. To ignore an output group, set all it conrols to NaN.
137/// If one or more controls in group is not NaN, then all NaN controls will sent as zero.
138/// The first 8 actuator controls internally map to control group 0, the latter 8 actuator
139/// controls map to control group 1. Depending on what controls are set (instead of NaN) 1 or 2
140/// MAVLink messages are actually sent.
141///
142/// In PX4 v1.9.0 Only first four Control Groups are supported
143/// (https://github.com/PX4/Firmware/blob/v1.9.0/src/modules/mavlink/mavlink_receiver.cpp#L980).
144#[derive(Clone, PartialEq, ::prost::Message)]
145pub struct ActuatorControl {
146    /// Control groups.
147    #[prost(message, repeated, tag = "1")]
148    pub groups: ::prost::alloc::vec::Vec<ActuatorControlGroup>,
149}
150/// Type for attitude rate commands in body coordinates (roll, pitch, yaw angular rate and thrust)
151#[derive(Clone, PartialEq, ::prost::Message)]
152pub struct AttitudeRate {
153    /// Roll angular rate (in degrees/second, positive for clock-wise looking from front)
154    #[prost(float, tag = "1")]
155    pub roll_deg_s: f32,
156    /// Pitch angular rate (in degrees/second, positive for head/front moving up)
157    #[prost(float, tag = "2")]
158    pub pitch_deg_s: f32,
159    /// Yaw angular rate (in degrees/second, positive for clock-wise looking from above)
160    #[prost(float, tag = "3")]
161    pub yaw_deg_s: f32,
162    /// Thrust (range: 0 to 1)
163    #[prost(float, tag = "4")]
164    pub thrust_value: f32,
165}
166/// Type for position commands in NED (North East Down) coordinates and yaw.
167#[derive(Clone, PartialEq, ::prost::Message)]
168pub struct PositionNedYaw {
169    /// Position North (in metres)
170    #[prost(float, tag = "1")]
171    pub north_m: f32,
172    /// Position East (in metres)
173    #[prost(float, tag = "2")]
174    pub east_m: f32,
175    /// Position Down (in metres)
176    #[prost(float, tag = "3")]
177    pub down_m: f32,
178    /// Yaw in degrees (0 North, positive is clock-wise looking from above)
179    #[prost(float, tag = "4")]
180    pub yaw_deg: f32,
181}
182/// Type for velocity commands in body coordinates.
183#[derive(Clone, PartialEq, ::prost::Message)]
184pub struct VelocityBodyYawspeed {
185    /// Velocity forward (in metres/second)
186    #[prost(float, tag = "1")]
187    pub forward_m_s: f32,
188    /// Velocity right (in metres/second)
189    #[prost(float, tag = "2")]
190    pub right_m_s: f32,
191    /// Velocity down (in metres/second)
192    #[prost(float, tag = "3")]
193    pub down_m_s: f32,
194    /// Yaw angular rate (in degrees/second, positive for clock-wise looking from above)
195    #[prost(float, tag = "4")]
196    pub yawspeed_deg_s: f32,
197}
198/// Type for velocity commands in NED (North East Down) coordinates and yaw.
199#[derive(Clone, PartialEq, ::prost::Message)]
200pub struct VelocityNedYaw {
201    /// Velocity North (in metres/second)
202    #[prost(float, tag = "1")]
203    pub north_m_s: f32,
204    /// Velocity East (in metres/second)
205    #[prost(float, tag = "2")]
206    pub east_m_s: f32,
207    /// Velocity Down (in metres/second)
208    #[prost(float, tag = "3")]
209    pub down_m_s: f32,
210    /// Yaw in degrees (0 North, positive is clock-wise looking from above)
211    #[prost(float, tag = "4")]
212    pub yaw_deg: f32,
213}
214/// Result type.
215#[derive(Clone, PartialEq, ::prost::Message)]
216pub struct OffboardResult {
217    /// Result enum value
218    #[prost(enumeration = "offboard_result::Result", tag = "1")]
219    pub result: i32,
220    /// Human-readable English string describing the result
221    #[prost(string, tag = "2")]
222    pub result_str: ::prost::alloc::string::String,
223}
224/// Nested message and enum types in `OffboardResult`.
225pub mod offboard_result {
226    /// Possible results returned for offboard requests
227    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
228    #[repr(i32)]
229    pub enum Result {
230        /// Unknown result
231        Unknown = 0,
232        /// Request succeeded
233        Success = 1,
234        /// No system is connected
235        NoSystem = 2,
236        /// Connection error
237        ConnectionError = 3,
238        /// Vehicle is busy
239        Busy = 4,
240        /// Command denied
241        CommandDenied = 5,
242        /// Request timed out
243        Timeout = 6,
244        /// Cannot start without setpoint set
245        NoSetpointSet = 7,
246    }
247}
248#[doc = r" Generated client implementations."]
249pub mod offboard_service_client {
250    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
251    use tonic::codegen::*;
252    #[doc = "*"]
253    #[doc = " Control a drone with position, velocity, attitude or motor commands."]
254    #[doc = ""]
255    #[doc = " The module is called offboard because the commands can be sent from external sources"]
256    #[doc = " as opposed to onboard control right inside the autopilot \"board\"."]
257    #[doc = ""]
258    #[doc = " Client code must specify a setpoint before starting offboard mode."]
259    #[doc = " Mavsdk automatically sends setpoints at 20Hz (PX4 Offboard mode requires that setpoints"]
260    #[doc = " are minimally sent at 2Hz)."]
261    #[derive(Debug, Clone)]
262    pub struct OffboardServiceClient<T> {
263        inner: tonic::client::Grpc<T>,
264    }
265    impl OffboardServiceClient<tonic::transport::Channel> {
266        #[doc = r" Attempt to create a new client by connecting to a given endpoint."]
267        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
268        where
269            D: std::convert::TryInto<tonic::transport::Endpoint>,
270            D::Error: Into<StdError>,
271        {
272            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
273            Ok(Self::new(conn))
274        }
275    }
276    impl<T> OffboardServiceClient<T>
277    where
278        T: tonic::client::GrpcService<tonic::body::BoxBody>,
279        T::ResponseBody: Body + Send + Sync + 'static,
280        T::Error: Into<StdError>,
281        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
282    {
283        pub fn new(inner: T) -> Self {
284            let inner = tonic::client::Grpc::new(inner);
285            Self { inner }
286        }
287        pub fn with_interceptor<F>(
288            inner: T,
289            interceptor: F,
290        ) -> OffboardServiceClient<InterceptedService<T, F>>
291        where
292            F: tonic::service::Interceptor,
293            T: tonic::codegen::Service<
294                http::Request<tonic::body::BoxBody>,
295                Response = http::Response<
296                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
297                >,
298            >,
299            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
300                Into<StdError> + Send + Sync,
301        {
302            OffboardServiceClient::new(InterceptedService::new(inner, interceptor))
303        }
304        #[doc = r" Compress requests with `gzip`."]
305        #[doc = r""]
306        #[doc = r" This requires the server to support it otherwise it might respond with an"]
307        #[doc = r" error."]
308        pub fn send_gzip(mut self) -> Self {
309            self.inner = self.inner.send_gzip();
310            self
311        }
312        #[doc = r" Enable decompressing responses with `gzip`."]
313        pub fn accept_gzip(mut self) -> Self {
314            self.inner = self.inner.accept_gzip();
315            self
316        }
317        #[doc = ""]
318        #[doc = " Start offboard control."]
319        pub async fn start(
320            &mut self,
321            request: impl tonic::IntoRequest<super::StartRequest>,
322        ) -> Result<tonic::Response<super::StartResponse>, tonic::Status> {
323            self.inner.ready().await.map_err(|e| {
324                tonic::Status::new(
325                    tonic::Code::Unknown,
326                    format!("Service was not ready: {}", e.into()),
327                )
328            })?;
329            let codec = tonic::codec::ProstCodec::default();
330            let path =
331                http::uri::PathAndQuery::from_static("/mavsdk.rpc.offboard.OffboardService/Start");
332            self.inner.unary(request.into_request(), path, codec).await
333        }
334        #[doc = ""]
335        #[doc = " Stop offboard control."]
336        #[doc = ""]
337        #[doc = " The vehicle will be put into Hold mode: https://docs.px4.io/en/flight_modes/hold.html"]
338        pub async fn stop(
339            &mut self,
340            request: impl tonic::IntoRequest<super::StopRequest>,
341        ) -> Result<tonic::Response<super::StopResponse>, tonic::Status> {
342            self.inner.ready().await.map_err(|e| {
343                tonic::Status::new(
344                    tonic::Code::Unknown,
345                    format!("Service was not ready: {}", e.into()),
346                )
347            })?;
348            let codec = tonic::codec::ProstCodec::default();
349            let path =
350                http::uri::PathAndQuery::from_static("/mavsdk.rpc.offboard.OffboardService/Stop");
351            self.inner.unary(request.into_request(), path, codec).await
352        }
353        #[doc = ""]
354        #[doc = " Check if offboard control is active."]
355        #[doc = ""]
356        #[doc = " True means that the vehicle is in offboard mode and we are actively sending"]
357        #[doc = " setpoints."]
358        pub async fn is_active(
359            &mut self,
360            request: impl tonic::IntoRequest<super::IsActiveRequest>,
361        ) -> Result<tonic::Response<super::IsActiveResponse>, tonic::Status> {
362            self.inner.ready().await.map_err(|e| {
363                tonic::Status::new(
364                    tonic::Code::Unknown,
365                    format!("Service was not ready: {}", e.into()),
366                )
367            })?;
368            let codec = tonic::codec::ProstCodec::default();
369            let path = http::uri::PathAndQuery::from_static(
370                "/mavsdk.rpc.offboard.OffboardService/IsActive",
371            );
372            self.inner.unary(request.into_request(), path, codec).await
373        }
374        #[doc = ""]
375        #[doc = " Set the attitude in terms of roll, pitch and yaw in degrees with thrust."]
376        pub async fn set_attitude(
377            &mut self,
378            request: impl tonic::IntoRequest<super::SetAttitudeRequest>,
379        ) -> Result<tonic::Response<super::SetAttitudeResponse>, tonic::Status> {
380            self.inner.ready().await.map_err(|e| {
381                tonic::Status::new(
382                    tonic::Code::Unknown,
383                    format!("Service was not ready: {}", e.into()),
384                )
385            })?;
386            let codec = tonic::codec::ProstCodec::default();
387            let path = http::uri::PathAndQuery::from_static(
388                "/mavsdk.rpc.offboard.OffboardService/SetAttitude",
389            );
390            self.inner.unary(request.into_request(), path, codec).await
391        }
392        #[doc = ""]
393        #[doc = " Set direct actuator control values to groups #0 and #1."]
394        #[doc = ""]
395        #[doc = " First 8 controls will go to control group 0, the following 8 controls to control group 1 (if"]
396        #[doc = " actuator_control.num_controls more than 8)."]
397        pub async fn set_actuator_control(
398            &mut self,
399            request: impl tonic::IntoRequest<super::SetActuatorControlRequest>,
400        ) -> Result<tonic::Response<super::SetActuatorControlResponse>, tonic::Status> {
401            self.inner.ready().await.map_err(|e| {
402                tonic::Status::new(
403                    tonic::Code::Unknown,
404                    format!("Service was not ready: {}", e.into()),
405                )
406            })?;
407            let codec = tonic::codec::ProstCodec::default();
408            let path = http::uri::PathAndQuery::from_static(
409                "/mavsdk.rpc.offboard.OffboardService/SetActuatorControl",
410            );
411            self.inner.unary(request.into_request(), path, codec).await
412        }
413        #[doc = ""]
414        #[doc = " Set the attitude rate in terms of pitch, roll and yaw angular rate along with thrust."]
415        pub async fn set_attitude_rate(
416            &mut self,
417            request: impl tonic::IntoRequest<super::SetAttitudeRateRequest>,
418        ) -> Result<tonic::Response<super::SetAttitudeRateResponse>, tonic::Status> {
419            self.inner.ready().await.map_err(|e| {
420                tonic::Status::new(
421                    tonic::Code::Unknown,
422                    format!("Service was not ready: {}", e.into()),
423                )
424            })?;
425            let codec = tonic::codec::ProstCodec::default();
426            let path = http::uri::PathAndQuery::from_static(
427                "/mavsdk.rpc.offboard.OffboardService/SetAttitudeRate",
428            );
429            self.inner.unary(request.into_request(), path, codec).await
430        }
431        #[doc = ""]
432        #[doc = " Set the position in NED coordinates and yaw."]
433        pub async fn set_position_ned(
434            &mut self,
435            request: impl tonic::IntoRequest<super::SetPositionNedRequest>,
436        ) -> Result<tonic::Response<super::SetPositionNedResponse>, tonic::Status> {
437            self.inner.ready().await.map_err(|e| {
438                tonic::Status::new(
439                    tonic::Code::Unknown,
440                    format!("Service was not ready: {}", e.into()),
441                )
442            })?;
443            let codec = tonic::codec::ProstCodec::default();
444            let path = http::uri::PathAndQuery::from_static(
445                "/mavsdk.rpc.offboard.OffboardService/SetPositionNed",
446            );
447            self.inner.unary(request.into_request(), path, codec).await
448        }
449        #[doc = ""]
450        #[doc = " Set the velocity in body coordinates and yaw angular rate. Not available for fixed-wing aircraft."]
451        pub async fn set_velocity_body(
452            &mut self,
453            request: impl tonic::IntoRequest<super::SetVelocityBodyRequest>,
454        ) -> Result<tonic::Response<super::SetVelocityBodyResponse>, tonic::Status> {
455            self.inner.ready().await.map_err(|e| {
456                tonic::Status::new(
457                    tonic::Code::Unknown,
458                    format!("Service was not ready: {}", e.into()),
459                )
460            })?;
461            let codec = tonic::codec::ProstCodec::default();
462            let path = http::uri::PathAndQuery::from_static(
463                "/mavsdk.rpc.offboard.OffboardService/SetVelocityBody",
464            );
465            self.inner.unary(request.into_request(), path, codec).await
466        }
467        #[doc = ""]
468        #[doc = " Set the velocity in NED coordinates and yaw. Not available for fixed-wing aircraft."]
469        pub async fn set_velocity_ned(
470            &mut self,
471            request: impl tonic::IntoRequest<super::SetVelocityNedRequest>,
472        ) -> Result<tonic::Response<super::SetVelocityNedResponse>, tonic::Status> {
473            self.inner.ready().await.map_err(|e| {
474                tonic::Status::new(
475                    tonic::Code::Unknown,
476                    format!("Service was not ready: {}", e.into()),
477                )
478            })?;
479            let codec = tonic::codec::ProstCodec::default();
480            let path = http::uri::PathAndQuery::from_static(
481                "/mavsdk.rpc.offboard.OffboardService/SetVelocityNed",
482            );
483            self.inner.unary(request.into_request(), path, codec).await
484        }
485        #[doc = ""]
486        #[doc = " Set the position in NED coordinates, with the velocity to be used as feed-forward."]
487        pub async fn set_position_velocity_ned(
488            &mut self,
489            request: impl tonic::IntoRequest<super::SetPositionVelocityNedRequest>,
490        ) -> Result<tonic::Response<super::SetPositionVelocityNedResponse>, tonic::Status> {
491            self.inner.ready().await.map_err(|e| {
492                tonic::Status::new(
493                    tonic::Code::Unknown,
494                    format!("Service was not ready: {}", e.into()),
495                )
496            })?;
497            let codec = tonic::codec::ProstCodec::default();
498            let path = http::uri::PathAndQuery::from_static(
499                "/mavsdk.rpc.offboard.OffboardService/SetPositionVelocityNed",
500            );
501            self.inner.unary(request.into_request(), path, codec).await
502        }
503    }
504}
505#[doc = r" Generated server implementations."]
506pub mod offboard_service_server {
507    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
508    use tonic::codegen::*;
509    #[doc = "Generated trait containing gRPC methods that should be implemented for use with OffboardServiceServer."]
510    #[async_trait]
511    pub trait OffboardService: Send + Sync + 'static {
512        #[doc = ""]
513        #[doc = " Start offboard control."]
514        async fn start(
515            &self,
516            request: tonic::Request<super::StartRequest>,
517        ) -> Result<tonic::Response<super::StartResponse>, tonic::Status>;
518        #[doc = ""]
519        #[doc = " Stop offboard control."]
520        #[doc = ""]
521        #[doc = " The vehicle will be put into Hold mode: https://docs.px4.io/en/flight_modes/hold.html"]
522        async fn stop(
523            &self,
524            request: tonic::Request<super::StopRequest>,
525        ) -> Result<tonic::Response<super::StopResponse>, tonic::Status>;
526        #[doc = ""]
527        #[doc = " Check if offboard control is active."]
528        #[doc = ""]
529        #[doc = " True means that the vehicle is in offboard mode and we are actively sending"]
530        #[doc = " setpoints."]
531        async fn is_active(
532            &self,
533            request: tonic::Request<super::IsActiveRequest>,
534        ) -> Result<tonic::Response<super::IsActiveResponse>, tonic::Status>;
535        #[doc = ""]
536        #[doc = " Set the attitude in terms of roll, pitch and yaw in degrees with thrust."]
537        async fn set_attitude(
538            &self,
539            request: tonic::Request<super::SetAttitudeRequest>,
540        ) -> Result<tonic::Response<super::SetAttitudeResponse>, tonic::Status>;
541        #[doc = ""]
542        #[doc = " Set direct actuator control values to groups #0 and #1."]
543        #[doc = ""]
544        #[doc = " First 8 controls will go to control group 0, the following 8 controls to control group 1 (if"]
545        #[doc = " actuator_control.num_controls more than 8)."]
546        async fn set_actuator_control(
547            &self,
548            request: tonic::Request<super::SetActuatorControlRequest>,
549        ) -> Result<tonic::Response<super::SetActuatorControlResponse>, tonic::Status>;
550        #[doc = ""]
551        #[doc = " Set the attitude rate in terms of pitch, roll and yaw angular rate along with thrust."]
552        async fn set_attitude_rate(
553            &self,
554            request: tonic::Request<super::SetAttitudeRateRequest>,
555        ) -> Result<tonic::Response<super::SetAttitudeRateResponse>, tonic::Status>;
556        #[doc = ""]
557        #[doc = " Set the position in NED coordinates and yaw."]
558        async fn set_position_ned(
559            &self,
560            request: tonic::Request<super::SetPositionNedRequest>,
561        ) -> Result<tonic::Response<super::SetPositionNedResponse>, tonic::Status>;
562        #[doc = ""]
563        #[doc = " Set the velocity in body coordinates and yaw angular rate. Not available for fixed-wing aircraft."]
564        async fn set_velocity_body(
565            &self,
566            request: tonic::Request<super::SetVelocityBodyRequest>,
567        ) -> Result<tonic::Response<super::SetVelocityBodyResponse>, tonic::Status>;
568        #[doc = ""]
569        #[doc = " Set the velocity in NED coordinates and yaw. Not available for fixed-wing aircraft."]
570        async fn set_velocity_ned(
571            &self,
572            request: tonic::Request<super::SetVelocityNedRequest>,
573        ) -> Result<tonic::Response<super::SetVelocityNedResponse>, tonic::Status>;
574        #[doc = ""]
575        #[doc = " Set the position in NED coordinates, with the velocity to be used as feed-forward."]
576        async fn set_position_velocity_ned(
577            &self,
578            request: tonic::Request<super::SetPositionVelocityNedRequest>,
579        ) -> Result<tonic::Response<super::SetPositionVelocityNedResponse>, tonic::Status>;
580    }
581    #[doc = "*"]
582    #[doc = " Control a drone with position, velocity, attitude or motor commands."]
583    #[doc = ""]
584    #[doc = " The module is called offboard because the commands can be sent from external sources"]
585    #[doc = " as opposed to onboard control right inside the autopilot \"board\"."]
586    #[doc = ""]
587    #[doc = " Client code must specify a setpoint before starting offboard mode."]
588    #[doc = " Mavsdk automatically sends setpoints at 20Hz (PX4 Offboard mode requires that setpoints"]
589    #[doc = " are minimally sent at 2Hz)."]
590    #[derive(Debug)]
591    pub struct OffboardServiceServer<T: OffboardService> {
592        inner: _Inner<T>,
593        accept_compression_encodings: (),
594        send_compression_encodings: (),
595    }
596    struct _Inner<T>(Arc<T>);
597    impl<T: OffboardService> OffboardServiceServer<T> {
598        pub fn new(inner: T) -> Self {
599            let inner = Arc::new(inner);
600            let inner = _Inner(inner);
601            Self {
602                inner,
603                accept_compression_encodings: Default::default(),
604                send_compression_encodings: Default::default(),
605            }
606        }
607        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
608        where
609            F: tonic::service::Interceptor,
610        {
611            InterceptedService::new(Self::new(inner), interceptor)
612        }
613    }
614    impl<T, B> tonic::codegen::Service<http::Request<B>> for OffboardServiceServer<T>
615    where
616        T: OffboardService,
617        B: Body + Send + Sync + 'static,
618        B::Error: Into<StdError> + Send + 'static,
619    {
620        type Response = http::Response<tonic::body::BoxBody>;
621        type Error = Never;
622        type Future = BoxFuture<Self::Response, Self::Error>;
623        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
624            Poll::Ready(Ok(()))
625        }
626        fn call(&mut self, req: http::Request<B>) -> Self::Future {
627            let inner = self.inner.clone();
628            match req.uri().path() {
629                "/mavsdk.rpc.offboard.OffboardService/Start" => {
630                    #[allow(non_camel_case_types)]
631                    struct StartSvc<T: OffboardService>(pub Arc<T>);
632                    impl<T: OffboardService> tonic::server::UnaryService<super::StartRequest> for StartSvc<T> {
633                        type Response = super::StartResponse;
634                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
635                        fn call(
636                            &mut self,
637                            request: tonic::Request<super::StartRequest>,
638                        ) -> Self::Future {
639                            let inner = self.0.clone();
640                            let fut = async move { (*inner).start(request).await };
641                            Box::pin(fut)
642                        }
643                    }
644                    let accept_compression_encodings = self.accept_compression_encodings;
645                    let send_compression_encodings = self.send_compression_encodings;
646                    let inner = self.inner.clone();
647                    let fut = async move {
648                        let inner = inner.0;
649                        let method = StartSvc(inner);
650                        let codec = tonic::codec::ProstCodec::default();
651                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
652                            accept_compression_encodings,
653                            send_compression_encodings,
654                        );
655                        let res = grpc.unary(method, req).await;
656                        Ok(res)
657                    };
658                    Box::pin(fut)
659                }
660                "/mavsdk.rpc.offboard.OffboardService/Stop" => {
661                    #[allow(non_camel_case_types)]
662                    struct StopSvc<T: OffboardService>(pub Arc<T>);
663                    impl<T: OffboardService> tonic::server::UnaryService<super::StopRequest> for StopSvc<T> {
664                        type Response = super::StopResponse;
665                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
666                        fn call(
667                            &mut self,
668                            request: tonic::Request<super::StopRequest>,
669                        ) -> Self::Future {
670                            let inner = self.0.clone();
671                            let fut = async move { (*inner).stop(request).await };
672                            Box::pin(fut)
673                        }
674                    }
675                    let accept_compression_encodings = self.accept_compression_encodings;
676                    let send_compression_encodings = self.send_compression_encodings;
677                    let inner = self.inner.clone();
678                    let fut = async move {
679                        let inner = inner.0;
680                        let method = StopSvc(inner);
681                        let codec = tonic::codec::ProstCodec::default();
682                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
683                            accept_compression_encodings,
684                            send_compression_encodings,
685                        );
686                        let res = grpc.unary(method, req).await;
687                        Ok(res)
688                    };
689                    Box::pin(fut)
690                }
691                "/mavsdk.rpc.offboard.OffboardService/IsActive" => {
692                    #[allow(non_camel_case_types)]
693                    struct IsActiveSvc<T: OffboardService>(pub Arc<T>);
694                    impl<T: OffboardService> tonic::server::UnaryService<super::IsActiveRequest> for IsActiveSvc<T> {
695                        type Response = super::IsActiveResponse;
696                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
697                        fn call(
698                            &mut self,
699                            request: tonic::Request<super::IsActiveRequest>,
700                        ) -> Self::Future {
701                            let inner = self.0.clone();
702                            let fut = async move { (*inner).is_active(request).await };
703                            Box::pin(fut)
704                        }
705                    }
706                    let accept_compression_encodings = self.accept_compression_encodings;
707                    let send_compression_encodings = self.send_compression_encodings;
708                    let inner = self.inner.clone();
709                    let fut = async move {
710                        let inner = inner.0;
711                        let method = IsActiveSvc(inner);
712                        let codec = tonic::codec::ProstCodec::default();
713                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
714                            accept_compression_encodings,
715                            send_compression_encodings,
716                        );
717                        let res = grpc.unary(method, req).await;
718                        Ok(res)
719                    };
720                    Box::pin(fut)
721                }
722                "/mavsdk.rpc.offboard.OffboardService/SetAttitude" => {
723                    #[allow(non_camel_case_types)]
724                    struct SetAttitudeSvc<T: OffboardService>(pub Arc<T>);
725                    impl<T: OffboardService> tonic::server::UnaryService<super::SetAttitudeRequest>
726                        for SetAttitudeSvc<T>
727                    {
728                        type Response = super::SetAttitudeResponse;
729                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
730                        fn call(
731                            &mut self,
732                            request: tonic::Request<super::SetAttitudeRequest>,
733                        ) -> Self::Future {
734                            let inner = self.0.clone();
735                            let fut = async move { (*inner).set_attitude(request).await };
736                            Box::pin(fut)
737                        }
738                    }
739                    let accept_compression_encodings = self.accept_compression_encodings;
740                    let send_compression_encodings = self.send_compression_encodings;
741                    let inner = self.inner.clone();
742                    let fut = async move {
743                        let inner = inner.0;
744                        let method = SetAttitudeSvc(inner);
745                        let codec = tonic::codec::ProstCodec::default();
746                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
747                            accept_compression_encodings,
748                            send_compression_encodings,
749                        );
750                        let res = grpc.unary(method, req).await;
751                        Ok(res)
752                    };
753                    Box::pin(fut)
754                }
755                "/mavsdk.rpc.offboard.OffboardService/SetActuatorControl" => {
756                    #[allow(non_camel_case_types)]
757                    struct SetActuatorControlSvc<T: OffboardService>(pub Arc<T>);
758                    impl<T: OffboardService>
759                        tonic::server::UnaryService<super::SetActuatorControlRequest>
760                        for SetActuatorControlSvc<T>
761                    {
762                        type Response = super::SetActuatorControlResponse;
763                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
764                        fn call(
765                            &mut self,
766                            request: tonic::Request<super::SetActuatorControlRequest>,
767                        ) -> Self::Future {
768                            let inner = self.0.clone();
769                            let fut = async move { (*inner).set_actuator_control(request).await };
770                            Box::pin(fut)
771                        }
772                    }
773                    let accept_compression_encodings = self.accept_compression_encodings;
774                    let send_compression_encodings = self.send_compression_encodings;
775                    let inner = self.inner.clone();
776                    let fut = async move {
777                        let inner = inner.0;
778                        let method = SetActuatorControlSvc(inner);
779                        let codec = tonic::codec::ProstCodec::default();
780                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
781                            accept_compression_encodings,
782                            send_compression_encodings,
783                        );
784                        let res = grpc.unary(method, req).await;
785                        Ok(res)
786                    };
787                    Box::pin(fut)
788                }
789                "/mavsdk.rpc.offboard.OffboardService/SetAttitudeRate" => {
790                    #[allow(non_camel_case_types)]
791                    struct SetAttitudeRateSvc<T: OffboardService>(pub Arc<T>);
792                    impl<T: OffboardService>
793                        tonic::server::UnaryService<super::SetAttitudeRateRequest>
794                        for SetAttitudeRateSvc<T>
795                    {
796                        type Response = super::SetAttitudeRateResponse;
797                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
798                        fn call(
799                            &mut self,
800                            request: tonic::Request<super::SetAttitudeRateRequest>,
801                        ) -> Self::Future {
802                            let inner = self.0.clone();
803                            let fut = async move { (*inner).set_attitude_rate(request).await };
804                            Box::pin(fut)
805                        }
806                    }
807                    let accept_compression_encodings = self.accept_compression_encodings;
808                    let send_compression_encodings = self.send_compression_encodings;
809                    let inner = self.inner.clone();
810                    let fut = async move {
811                        let inner = inner.0;
812                        let method = SetAttitudeRateSvc(inner);
813                        let codec = tonic::codec::ProstCodec::default();
814                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
815                            accept_compression_encodings,
816                            send_compression_encodings,
817                        );
818                        let res = grpc.unary(method, req).await;
819                        Ok(res)
820                    };
821                    Box::pin(fut)
822                }
823                "/mavsdk.rpc.offboard.OffboardService/SetPositionNed" => {
824                    #[allow(non_camel_case_types)]
825                    struct SetPositionNedSvc<T: OffboardService>(pub Arc<T>);
826                    impl<T: OffboardService>
827                        tonic::server::UnaryService<super::SetPositionNedRequest>
828                        for SetPositionNedSvc<T>
829                    {
830                        type Response = super::SetPositionNedResponse;
831                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
832                        fn call(
833                            &mut self,
834                            request: tonic::Request<super::SetPositionNedRequest>,
835                        ) -> Self::Future {
836                            let inner = self.0.clone();
837                            let fut = async move { (*inner).set_position_ned(request).await };
838                            Box::pin(fut)
839                        }
840                    }
841                    let accept_compression_encodings = self.accept_compression_encodings;
842                    let send_compression_encodings = self.send_compression_encodings;
843                    let inner = self.inner.clone();
844                    let fut = async move {
845                        let inner = inner.0;
846                        let method = SetPositionNedSvc(inner);
847                        let codec = tonic::codec::ProstCodec::default();
848                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
849                            accept_compression_encodings,
850                            send_compression_encodings,
851                        );
852                        let res = grpc.unary(method, req).await;
853                        Ok(res)
854                    };
855                    Box::pin(fut)
856                }
857                "/mavsdk.rpc.offboard.OffboardService/SetVelocityBody" => {
858                    #[allow(non_camel_case_types)]
859                    struct SetVelocityBodySvc<T: OffboardService>(pub Arc<T>);
860                    impl<T: OffboardService>
861                        tonic::server::UnaryService<super::SetVelocityBodyRequest>
862                        for SetVelocityBodySvc<T>
863                    {
864                        type Response = super::SetVelocityBodyResponse;
865                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
866                        fn call(
867                            &mut self,
868                            request: tonic::Request<super::SetVelocityBodyRequest>,
869                        ) -> Self::Future {
870                            let inner = self.0.clone();
871                            let fut = async move { (*inner).set_velocity_body(request).await };
872                            Box::pin(fut)
873                        }
874                    }
875                    let accept_compression_encodings = self.accept_compression_encodings;
876                    let send_compression_encodings = self.send_compression_encodings;
877                    let inner = self.inner.clone();
878                    let fut = async move {
879                        let inner = inner.0;
880                        let method = SetVelocityBodySvc(inner);
881                        let codec = tonic::codec::ProstCodec::default();
882                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
883                            accept_compression_encodings,
884                            send_compression_encodings,
885                        );
886                        let res = grpc.unary(method, req).await;
887                        Ok(res)
888                    };
889                    Box::pin(fut)
890                }
891                "/mavsdk.rpc.offboard.OffboardService/SetVelocityNed" => {
892                    #[allow(non_camel_case_types)]
893                    struct SetVelocityNedSvc<T: OffboardService>(pub Arc<T>);
894                    impl<T: OffboardService>
895                        tonic::server::UnaryService<super::SetVelocityNedRequest>
896                        for SetVelocityNedSvc<T>
897                    {
898                        type Response = super::SetVelocityNedResponse;
899                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
900                        fn call(
901                            &mut self,
902                            request: tonic::Request<super::SetVelocityNedRequest>,
903                        ) -> Self::Future {
904                            let inner = self.0.clone();
905                            let fut = async move { (*inner).set_velocity_ned(request).await };
906                            Box::pin(fut)
907                        }
908                    }
909                    let accept_compression_encodings = self.accept_compression_encodings;
910                    let send_compression_encodings = self.send_compression_encodings;
911                    let inner = self.inner.clone();
912                    let fut = async move {
913                        let inner = inner.0;
914                        let method = SetVelocityNedSvc(inner);
915                        let codec = tonic::codec::ProstCodec::default();
916                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
917                            accept_compression_encodings,
918                            send_compression_encodings,
919                        );
920                        let res = grpc.unary(method, req).await;
921                        Ok(res)
922                    };
923                    Box::pin(fut)
924                }
925                "/mavsdk.rpc.offboard.OffboardService/SetPositionVelocityNed" => {
926                    #[allow(non_camel_case_types)]
927                    struct SetPositionVelocityNedSvc<T: OffboardService>(pub Arc<T>);
928                    impl<T: OffboardService>
929                        tonic::server::UnaryService<super::SetPositionVelocityNedRequest>
930                        for SetPositionVelocityNedSvc<T>
931                    {
932                        type Response = super::SetPositionVelocityNedResponse;
933                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
934                        fn call(
935                            &mut self,
936                            request: tonic::Request<super::SetPositionVelocityNedRequest>,
937                        ) -> Self::Future {
938                            let inner = self.0.clone();
939                            let fut =
940                                async move { (*inner).set_position_velocity_ned(request).await };
941                            Box::pin(fut)
942                        }
943                    }
944                    let accept_compression_encodings = self.accept_compression_encodings;
945                    let send_compression_encodings = self.send_compression_encodings;
946                    let inner = self.inner.clone();
947                    let fut = async move {
948                        let inner = inner.0;
949                        let method = SetPositionVelocityNedSvc(inner);
950                        let codec = tonic::codec::ProstCodec::default();
951                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
952                            accept_compression_encodings,
953                            send_compression_encodings,
954                        );
955                        let res = grpc.unary(method, req).await;
956                        Ok(res)
957                    };
958                    Box::pin(fut)
959                }
960                _ => Box::pin(async move {
961                    Ok(http::Response::builder()
962                        .status(200)
963                        .header("grpc-status", "12")
964                        .header("content-type", "application/grpc")
965                        .body(empty_body())
966                        .unwrap())
967                }),
968            }
969        }
970    }
971    impl<T: OffboardService> Clone for OffboardServiceServer<T> {
972        fn clone(&self) -> Self {
973            let inner = self.inner.clone();
974            Self {
975                inner,
976                accept_compression_encodings: self.accept_compression_encodings,
977                send_compression_encodings: self.send_compression_encodings,
978            }
979        }
980    }
981    impl<T: OffboardService> Clone for _Inner<T> {
982        fn clone(&self) -> Self {
983            Self(self.0.clone())
984        }
985    }
986    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
987        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
988            write!(f, "{:?}", self.0)
989        }
990    }
991    impl<T: OffboardService> tonic::transport::NamedService for OffboardServiceServer<T> {
992        const NAME: &'static str = "mavsdk.rpc.offboard.OffboardService";
993    }
994}