openrr-plugin 0.1.0

Plugin support for arci
Documentation
// This file is @generated by openrr-internal-codegen.
// It is not intended for manual editing.

#![allow(unused_variables)]
#![allow(clippy::useless_conversion, clippy::unit_arg)]

use abi_stable::{rtry, std_types::{RBox, RDuration, ROk, RResult, RStr}};
use super::*;
pub(crate) type PluginTraitObject = RPluginTrait_TO<RBox<()>>;
#[sabi_trait]
pub(crate) trait RPluginTrait: Send + Sync + 'static {
    fn new_gamepad(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::GamepadProxy>, RError>;
    fn new_joint_trajectory_client(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::JointTrajectoryClientProxy>, RError>;
    fn new_localization(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::LocalizationProxy>, RError>;
    fn new_motor_drive_position(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MotorDrivePositionProxy>, RError>;
    fn new_motor_drive_velocity(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MotorDriveVelocityProxy>, RError>;
    fn new_motor_drive_effort(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MotorDriveEffortProxy>, RError>;
    fn new_move_base(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MoveBaseProxy>, RError>;
    fn new_navigation(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::NavigationProxy>, RError>;
    fn new_speaker(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::SpeakerProxy>, RError>;
    fn new_transform_resolver(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::TransformResolverProxy>, RError>;
}
impl<T> RPluginTrait for T
where
    T: crate::Plugin,
{
    fn new_gamepad(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::GamepadProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_gamepad(self, args.into()))
                .map(crate::GamepadProxy::new)
                .into(),
        )
    }
    fn new_joint_trajectory_client(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::JointTrajectoryClientProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_joint_trajectory_client(self, args.into()))
                .map(crate::JointTrajectoryClientProxy::new)
                .into(),
        )
    }
    fn new_localization(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::LocalizationProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_localization(self, args.into()))
                .map(crate::LocalizationProxy::new)
                .into(),
        )
    }
    fn new_motor_drive_position(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MotorDrivePositionProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_motor_drive_position(self, args.into()))
                .map(crate::MotorDrivePositionProxy::new)
                .into(),
        )
    }
    fn new_motor_drive_velocity(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MotorDriveVelocityProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_motor_drive_velocity(self, args.into()))
                .map(crate::MotorDriveVelocityProxy::new)
                .into(),
        )
    }
    fn new_motor_drive_effort(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MotorDriveEffortProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_motor_drive_effort(self, args.into()))
                .map(crate::MotorDriveEffortProxy::new)
                .into(),
        )
    }
    fn new_move_base(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::MoveBaseProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_move_base(self, args.into()))
                .map(crate::MoveBaseProxy::new)
                .into(),
        )
    }
    fn new_navigation(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::NavigationProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_navigation(self, args.into()))
                .map(crate::NavigationProxy::new)
                .into(),
        )
    }
    fn new_speaker(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::SpeakerProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_speaker(self, args.into()))
                .map(crate::SpeakerProxy::new)
                .into(),
        )
    }
    fn new_transform_resolver(
        &self,
        args: RString,
    ) -> RResult<ROption<crate::TransformResolverProxy>, RError> {
        ROk(
            rtry!(crate ::Plugin::new_transform_resolver(self, args.into()))
                .map(crate::TransformResolverProxy::new)
                .into(),
        )
    }
}
pub(crate) type LocalizationTraitObject = RLocalizationTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RLocalizationTrait: Send + Sync + 'static {
    fn current_pose(&self, frame_id: RStr<'_>) -> RResult<RIsometry2F64, RError>;
}
impl<T> RLocalizationTrait for T
where
    T: arci::Localization + 'static,
{
    fn current_pose(&self, frame_id: RStr<'_>) -> RResult<RIsometry2F64, RError> {
        ROk(rtry!(arci::Localization::current_pose(self, frame_id.into())).into())
    }
}
pub(crate) type MotorDrivePositionTraitObject = RMotorDrivePositionTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RMotorDrivePositionTrait: Send + Sync + 'static {
    fn set_motor_position(&self, position: Rf64) -> RResult<(), RError>;
    fn get_motor_position(&self) -> RResult<Rf64, RError>;
}
impl<T> RMotorDrivePositionTrait for T
where
    T: arci::MotorDrivePosition + 'static,
{
    fn set_motor_position(&self, position: Rf64) -> RResult<(), RError> {
        ROk(
            rtry!(arci::MotorDrivePosition::set_motor_position(self, position.into()))
                .into(),
        )
    }
    fn get_motor_position(&self) -> RResult<Rf64, RError> {
        ROk(rtry!(arci::MotorDrivePosition::get_motor_position(self)).into())
    }
}
pub(crate) type MotorDriveVelocityTraitObject = RMotorDriveVelocityTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RMotorDriveVelocityTrait: Send + Sync + 'static {
    fn set_motor_velocity(&self, velocity: Rf64) -> RResult<(), RError>;
    fn get_motor_velocity(&self) -> RResult<Rf64, RError>;
}
impl<T> RMotorDriveVelocityTrait for T
where
    T: arci::MotorDriveVelocity + 'static,
{
    fn set_motor_velocity(&self, velocity: Rf64) -> RResult<(), RError> {
        ROk(
            rtry!(arci::MotorDriveVelocity::set_motor_velocity(self, velocity.into()))
                .into(),
        )
    }
    fn get_motor_velocity(&self) -> RResult<Rf64, RError> {
        ROk(rtry!(arci::MotorDriveVelocity::get_motor_velocity(self)).into())
    }
}
pub(crate) type MotorDriveEffortTraitObject = RMotorDriveEffortTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RMotorDriveEffortTrait: Send + Sync + 'static {
    fn set_motor_effort(&self, effort: Rf64) -> RResult<(), RError>;
    fn get_motor_effort(&self) -> RResult<Rf64, RError>;
}
impl<T> RMotorDriveEffortTrait for T
where
    T: arci::MotorDriveEffort + 'static,
{
    fn set_motor_effort(&self, effort: Rf64) -> RResult<(), RError> {
        ROk(rtry!(arci::MotorDriveEffort::set_motor_effort(self, effort.into())).into())
    }
    fn get_motor_effort(&self) -> RResult<Rf64, RError> {
        ROk(rtry!(arci::MotorDriveEffort::get_motor_effort(self)).into())
    }
}
pub(crate) type MoveBaseTraitObject = RMoveBaseTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RMoveBaseTrait: Send + Sync + 'static {
    fn send_velocity(&self, velocity: RBaseVelocity) -> RResult<(), RError>;
    fn current_velocity(&self) -> RResult<RBaseVelocity, RError>;
}
impl<T> RMoveBaseTrait for T
where
    T: arci::MoveBase + 'static,
{
    fn send_velocity(&self, velocity: RBaseVelocity) -> RResult<(), RError> {
        ROk(rtry!(arci::MoveBase::send_velocity(self, & velocity.into())).into())
    }
    fn current_velocity(&self) -> RResult<RBaseVelocity, RError> {
        ROk(rtry!(arci::MoveBase::current_velocity(self)).into())
    }
}
pub(crate) type NavigationTraitObject = RNavigationTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RNavigationTrait: Send + Sync + 'static {
    fn send_goal_pose(
        &self,
        goal: RIsometry2F64,
        frame_id: RStr<'_>,
        timeout: RDuration,
    ) -> RResult<RBlockingWait, RError>;
    fn cancel(&self) -> RResult<(), RError>;
}
impl<T> RNavigationTrait for T
where
    T: arci::Navigation + 'static,
{
    fn send_goal_pose(
        &self,
        goal: RIsometry2F64,
        frame_id: RStr<'_>,
        timeout: RDuration,
    ) -> RResult<RBlockingWait, RError> {
        ROk(
            rtry!(
                arci::Navigation::send_goal_pose(self, goal.into(), frame_id.into(),
                timeout.into())
            )
                .into(),
        )
    }
    fn cancel(&self) -> RResult<(), RError> {
        ROk(rtry!(arci::Navigation::cancel(self)).into())
    }
}
pub(crate) type SpeakerTraitObject = RSpeakerTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RSpeakerTrait: Send + Sync + 'static {
    fn speak(&self, message: RStr<'_>) -> RResult<RBlockingWait, RError>;
}
impl<T> RSpeakerTrait for T
where
    T: arci::Speaker + 'static,
{
    fn speak(&self, message: RStr<'_>) -> RResult<RBlockingWait, RError> {
        ROk(rtry!(arci::Speaker::speak(self, message.into())).into())
    }
}
pub(crate) type TransformResolverTraitObject = RTransformResolverTrait_TO<RBox<()>>;
#[abi_stable::sabi_trait]
pub(crate) trait RTransformResolverTrait: Send + Sync + 'static {
    fn resolve_transformation(
        &self,
        from: RStr<'_>,
        to: RStr<'_>,
        time: RSystemTime,
    ) -> RResult<RIsometry3F64, RError>;
}
impl<T> RTransformResolverTrait for T
where
    T: arci::TransformResolver + 'static,
{
    fn resolve_transformation(
        &self,
        from: RStr<'_>,
        to: RStr<'_>,
        time: RSystemTime,
    ) -> RResult<RIsometry3F64, RError> {
        ROk(
            rtry!(
                arci::TransformResolver::resolve_transformation(self, from.into(), to
                .into(), rtry!(time.try_into()))
            )
                .into(),
        )
    }
}