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