OffboardServiceClient

Struct OffboardServiceClient 

Source
pub struct OffboardServiceClient<T> { /* private fields */ }
Expand description

Control a drone with position, velocity, attitude or motor commands.

The module is called offboard because the commands can be sent from external sources as opposed to onboard control right inside the autopilot “board”.

Client code must specify a setpoint before starting offboard mode. Mavsdk automatically sends setpoints at 20Hz (PX4 Offboard mode requires that setpoints are minimally sent at 2Hz).

Implementations§

Source§

impl OffboardServiceClient<Channel>

Source

pub async fn connect<D>(dst: D) -> Result<Self, Error>
where D: TryInto<Endpoint>, D::Error: Into<StdError>,

Attempt to create a new client by connecting to a given endpoint.

Source§

impl<T> OffboardServiceClient<T>
where T: GrpcService<BoxBody>, T::ResponseBody: Body + Send + Sync + 'static, T::Error: Into<StdError>, <T::ResponseBody as Body>::Error: Into<StdError> + Send,

Source

pub fn new(inner: T) -> Self

Source

pub fn with_interceptor<F>( inner: T, interceptor: F, ) -> OffboardServiceClient<InterceptedService<T, F>>
where F: Interceptor, T: Service<Request<BoxBody>, Response = Response<<T as GrpcService<BoxBody>>::ResponseBody>>, <T as Service<Request<BoxBody>>>::Error: Into<StdError> + Send + Sync,

Source

pub fn send_gzip(self) -> Self

Compress requests with gzip.

This requires the server to support it otherwise it might respond with an error.

Source

pub fn accept_gzip(self) -> Self

Enable decompressing responses with gzip.

Source

pub async fn start( &mut self, request: impl IntoRequest<StartRequest>, ) -> Result<Response<StartResponse>, Status>

Start offboard control.

Source

pub async fn stop( &mut self, request: impl IntoRequest<StopRequest>, ) -> Result<Response<StopResponse>, Status>

Stop offboard control.

The vehicle will be put into Hold mode: https://docs.px4.io/en/flight_modes/hold.html

Source

pub async fn is_active( &mut self, request: impl IntoRequest<IsActiveRequest>, ) -> Result<Response<IsActiveResponse>, Status>

Check if offboard control is active.

True means that the vehicle is in offboard mode and we are actively sending setpoints.

Source

pub async fn set_attitude( &mut self, request: impl IntoRequest<SetAttitudeRequest>, ) -> Result<Response<SetAttitudeResponse>, Status>

Set the attitude in terms of roll, pitch and yaw in degrees with thrust.

Source

pub async fn set_actuator_control( &mut self, request: impl IntoRequest<SetActuatorControlRequest>, ) -> Result<Response<SetActuatorControlResponse>, Status>

Set direct actuator control values to groups #0 and #1.

First 8 controls will go to control group 0, the following 8 controls to control group 1 (if actuator_control.num_controls more than 8).

Source

pub async fn set_attitude_rate( &mut self, request: impl IntoRequest<SetAttitudeRateRequest>, ) -> Result<Response<SetAttitudeRateResponse>, Status>

Set the attitude rate in terms of pitch, roll and yaw angular rate along with thrust.

Source

pub async fn set_position_ned( &mut self, request: impl IntoRequest<SetPositionNedRequest>, ) -> Result<Response<SetPositionNedResponse>, Status>

Set the position in NED coordinates and yaw.

Source

pub async fn set_velocity_body( &mut self, request: impl IntoRequest<SetVelocityBodyRequest>, ) -> Result<Response<SetVelocityBodyResponse>, Status>

Set the velocity in body coordinates and yaw angular rate. Not available for fixed-wing aircraft.

Source

pub async fn set_velocity_ned( &mut self, request: impl IntoRequest<SetVelocityNedRequest>, ) -> Result<Response<SetVelocityNedResponse>, Status>

Set the velocity in NED coordinates and yaw. Not available for fixed-wing aircraft.

Source

pub async fn set_position_velocity_ned( &mut self, request: impl IntoRequest<SetPositionVelocityNedRequest>, ) -> Result<Response<SetPositionVelocityNedResponse>, Status>

Set the position in NED coordinates, with the velocity to be used as feed-forward.

Trait Implementations§

Source§

impl<T: Clone> Clone for OffboardServiceClient<T>

Source§

fn clone(&self) -> OffboardServiceClient<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for OffboardServiceClient<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for OffboardServiceClient<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for OffboardServiceClient<T>
where T: RefUnwindSafe,

§

impl<T> Send for OffboardServiceClient<T>
where T: Send,

§

impl<T> Sync for OffboardServiceClient<T>
where T: Sync,

§

impl<T> Unpin for OffboardServiceClient<T>
where T: Unpin,

§

impl<T> UnwindSafe for OffboardServiceClient<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V