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<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,
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,
pub fn new(inner: T) -> Self
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,
Sourcepub fn send_gzip(self) -> Self
pub fn send_gzip(self) -> Self
Compress requests with gzip.
This requires the server to support it otherwise it might respond with an error.
Sourcepub fn accept_gzip(self) -> Self
pub fn accept_gzip(self) -> Self
Enable decompressing responses with gzip.
Sourcepub async fn start(
&mut self,
request: impl IntoRequest<StartRequest>,
) -> Result<Response<StartResponse>, Status>
pub async fn start( &mut self, request: impl IntoRequest<StartRequest>, ) -> Result<Response<StartResponse>, Status>
Start offboard control.
Sourcepub async fn stop(
&mut self,
request: impl IntoRequest<StopRequest>,
) -> Result<Response<StopResponse>, Status>
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
Sourcepub async fn is_active(
&mut self,
request: impl IntoRequest<IsActiveRequest>,
) -> Result<Response<IsActiveResponse>, Status>
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.
Sourcepub async fn set_attitude(
&mut self,
request: impl IntoRequest<SetAttitudeRequest>,
) -> Result<Response<SetAttitudeResponse>, Status>
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.
Sourcepub async fn set_actuator_control(
&mut self,
request: impl IntoRequest<SetActuatorControlRequest>,
) -> Result<Response<SetActuatorControlResponse>, Status>
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).
Sourcepub async fn set_attitude_rate(
&mut self,
request: impl IntoRequest<SetAttitudeRateRequest>,
) -> Result<Response<SetAttitudeRateResponse>, Status>
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.
Sourcepub async fn set_position_ned(
&mut self,
request: impl IntoRequest<SetPositionNedRequest>,
) -> Result<Response<SetPositionNedResponse>, Status>
pub async fn set_position_ned( &mut self, request: impl IntoRequest<SetPositionNedRequest>, ) -> Result<Response<SetPositionNedResponse>, Status>
Set the position in NED coordinates and yaw.
Sourcepub async fn set_velocity_body(
&mut self,
request: impl IntoRequest<SetVelocityBodyRequest>,
) -> Result<Response<SetVelocityBodyResponse>, Status>
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.
Sourcepub async fn set_velocity_ned(
&mut self,
request: impl IntoRequest<SetVelocityNedRequest>,
) -> Result<Response<SetVelocityNedResponse>, Status>
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.
Sourcepub async fn set_position_velocity_ned(
&mut self,
request: impl IntoRequest<SetPositionVelocityNedRequest>,
) -> Result<Response<SetPositionVelocityNedResponse>, Status>
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>
impl<T: Clone> Clone for OffboardServiceClient<T>
Source§fn clone(&self) -> OffboardServiceClient<T>
fn clone(&self) -> OffboardServiceClient<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request