openrr_plugin/gen/
api.rs

1// This file is @generated by openrr-internal-codegen.
2// It is not intended for manual editing.
3
4#![allow(unused_variables)]
5#![allow(clippy::useless_conversion, clippy::unit_arg)]
6
7use arci::{BaseVelocity, Error, Isometry2, Isometry3, WaitFuture};
8use abi_stable::StableAbi;
9use super::*;
10/// The plugin trait.
11pub trait Plugin: Send + Sync + 'static {
12    /// Creates a new instance of [`arci::Gamepad`] with the specified arguments.
13    fn new_gamepad(
14        &self,
15        args: String,
16    ) -> Result<Option<Box<dyn arci::Gamepad>>, arci::Error> {
17        let _ = args;
18        Ok(None)
19    }
20    /// Creates a new instance of [`arci::JointTrajectoryClient`] with the specified arguments.
21    fn new_joint_trajectory_client(
22        &self,
23        args: String,
24    ) -> Result<Option<Box<dyn arci::JointTrajectoryClient>>, arci::Error> {
25        let _ = args;
26        Ok(None)
27    }
28    /// Creates a new instance of [`arci::Localization`] with the specified arguments.
29    fn new_localization(
30        &self,
31        args: String,
32    ) -> Result<Option<Box<dyn arci::Localization>>, arci::Error> {
33        let _ = args;
34        Ok(None)
35    }
36    /// Creates a new instance of [`arci::MotorDrivePosition`] with the specified arguments.
37    fn new_motor_drive_position(
38        &self,
39        args: String,
40    ) -> Result<Option<Box<dyn arci::MotorDrivePosition>>, arci::Error> {
41        let _ = args;
42        Ok(None)
43    }
44    /// Creates a new instance of [`arci::MotorDriveVelocity`] with the specified arguments.
45    fn new_motor_drive_velocity(
46        &self,
47        args: String,
48    ) -> Result<Option<Box<dyn arci::MotorDriveVelocity>>, arci::Error> {
49        let _ = args;
50        Ok(None)
51    }
52    /// Creates a new instance of [`arci::MotorDriveEffort`] with the specified arguments.
53    fn new_motor_drive_effort(
54        &self,
55        args: String,
56    ) -> Result<Option<Box<dyn arci::MotorDriveEffort>>, arci::Error> {
57        let _ = args;
58        Ok(None)
59    }
60    /// Creates a new instance of [`arci::MoveBase`] with the specified arguments.
61    fn new_move_base(
62        &self,
63        args: String,
64    ) -> Result<Option<Box<dyn arci::MoveBase>>, arci::Error> {
65        let _ = args;
66        Ok(None)
67    }
68    /// Creates a new instance of [`arci::Navigation`] with the specified arguments.
69    fn new_navigation(
70        &self,
71        args: String,
72    ) -> Result<Option<Box<dyn arci::Navigation>>, arci::Error> {
73        let _ = args;
74        Ok(None)
75    }
76    /// Creates a new instance of [`arci::Speaker`] with the specified arguments.
77    fn new_speaker(
78        &self,
79        args: String,
80    ) -> Result<Option<Box<dyn arci::Speaker>>, arci::Error> {
81        let _ = args;
82        Ok(None)
83    }
84    /// Creates a new instance of [`arci::TransformResolver`] with the specified arguments.
85    fn new_transform_resolver(
86        &self,
87        args: String,
88    ) -> Result<Option<Box<dyn arci::TransformResolver>>, arci::Error> {
89        let _ = args;
90        Ok(None)
91    }
92}
93/// FFI-safe equivalent of [`Box<dyn Plugin>`](Plugin).
94#[derive(StableAbi)]
95#[repr(C)]
96pub struct PluginProxy(pub(crate) crate::proxy::PluginTraitObject);
97impl PluginProxy {
98    /// Creates a new `PluginProxy`.
99    pub fn new<T>(inner: T) -> Self
100    where
101        T: Plugin + 'static,
102    {
103        Self(
104            crate::proxy::PluginTraitObject::from_value(
105                inner,
106                abi_stable::erased_types::TD_Opaque,
107            ),
108        )
109    }
110}
111impl PluginProxy {
112    /// Creates a new instance of [`arci::Gamepad`] with the specified arguments.
113    pub fn new_gamepad(
114        &self,
115        args: String,
116    ) -> Result<Option<GamepadProxy>, arci::Error> {
117        Ok(self.0.new_gamepad(args.into()).into_result()?.into_option())
118    }
119    /// Creates a new instance of [`arci::JointTrajectoryClient`] with the specified arguments.
120    pub fn new_joint_trajectory_client(
121        &self,
122        args: String,
123    ) -> Result<Option<JointTrajectoryClientProxy>, arci::Error> {
124        Ok(self.0.new_joint_trajectory_client(args.into()).into_result()?.into_option())
125    }
126    /// Creates a new instance of [`arci::Localization`] with the specified arguments.
127    pub fn new_localization(
128        &self,
129        args: String,
130    ) -> Result<Option<LocalizationProxy>, arci::Error> {
131        Ok(self.0.new_localization(args.into()).into_result()?.into_option())
132    }
133    /// Creates a new instance of [`arci::MotorDrivePosition`] with the specified arguments.
134    pub fn new_motor_drive_position(
135        &self,
136        args: String,
137    ) -> Result<Option<MotorDrivePositionProxy>, arci::Error> {
138        Ok(self.0.new_motor_drive_position(args.into()).into_result()?.into_option())
139    }
140    /// Creates a new instance of [`arci::MotorDriveVelocity`] with the specified arguments.
141    pub fn new_motor_drive_velocity(
142        &self,
143        args: String,
144    ) -> Result<Option<MotorDriveVelocityProxy>, arci::Error> {
145        Ok(self.0.new_motor_drive_velocity(args.into()).into_result()?.into_option())
146    }
147    /// Creates a new instance of [`arci::MotorDriveEffort`] with the specified arguments.
148    pub fn new_motor_drive_effort(
149        &self,
150        args: String,
151    ) -> Result<Option<MotorDriveEffortProxy>, arci::Error> {
152        Ok(self.0.new_motor_drive_effort(args.into()).into_result()?.into_option())
153    }
154    /// Creates a new instance of [`arci::MoveBase`] with the specified arguments.
155    pub fn new_move_base(
156        &self,
157        args: String,
158    ) -> Result<Option<MoveBaseProxy>, arci::Error> {
159        Ok(self.0.new_move_base(args.into()).into_result()?.into_option())
160    }
161    /// Creates a new instance of [`arci::Navigation`] with the specified arguments.
162    pub fn new_navigation(
163        &self,
164        args: String,
165    ) -> Result<Option<NavigationProxy>, arci::Error> {
166        Ok(self.0.new_navigation(args.into()).into_result()?.into_option())
167    }
168    /// Creates a new instance of [`arci::Speaker`] with the specified arguments.
169    pub fn new_speaker(
170        &self,
171        args: String,
172    ) -> Result<Option<SpeakerProxy>, arci::Error> {
173        Ok(self.0.new_speaker(args.into()).into_result()?.into_option())
174    }
175    /// Creates a new instance of [`arci::TransformResolver`] with the specified arguments.
176    pub fn new_transform_resolver(
177        &self,
178        args: String,
179    ) -> Result<Option<TransformResolverProxy>, arci::Error> {
180        Ok(self.0.new_transform_resolver(args.into()).into_result()?.into_option())
181    }
182}
183/// FFI-safe equivalent of [`Box<dyn arci::Localization>`](arci::Localization).
184#[derive(StableAbi)]
185#[repr(C)]
186pub struct LocalizationProxy(pub(crate) crate::proxy::LocalizationTraitObject);
187impl LocalizationProxy {
188    /// Creates a new `LocalizationProxy`.
189    pub fn new<T>(inner: T) -> Self
190    where
191        T: arci::Localization + 'static,
192    {
193        Self(
194            crate::proxy::LocalizationTraitObject::from_value(
195                inner,
196                abi_stable::erased_types::TD_Opaque,
197            ),
198        )
199    }
200}
201impl arci::Localization for LocalizationProxy {
202    fn current_pose(&self, frame_id: &str) -> Result<Isometry2<f64>, Error> {
203        Ok(self.0.current_pose(frame_id.into()).into_result()?.into())
204    }
205}
206impl std::fmt::Debug for LocalizationProxy {
207    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
208        f.debug_struct("LocalizationProxy").finish()
209    }
210}
211/// FFI-safe equivalent of [`Box<dyn arci::MotorDrivePosition>`](arci::MotorDrivePosition).
212#[derive(StableAbi)]
213#[repr(C)]
214pub struct MotorDrivePositionProxy(
215    pub(crate) crate::proxy::MotorDrivePositionTraitObject,
216);
217impl MotorDrivePositionProxy {
218    /// Creates a new `MotorDrivePositionProxy`.
219    pub fn new<T>(inner: T) -> Self
220    where
221        T: arci::MotorDrivePosition + 'static,
222    {
223        Self(
224            crate::proxy::MotorDrivePositionTraitObject::from_value(
225                inner,
226                abi_stable::erased_types::TD_Opaque,
227            ),
228        )
229    }
230}
231impl arci::MotorDrivePosition for MotorDrivePositionProxy {
232    fn set_motor_position(&self, position: f64) -> Result<(), Error> {
233        Ok(self.0.set_motor_position(position.into()).into_result()?.into())
234    }
235    fn get_motor_position(&self) -> Result<f64, Error> {
236        Ok(self.0.get_motor_position().into_result()?.into())
237    }
238}
239impl std::fmt::Debug for MotorDrivePositionProxy {
240    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
241        f.debug_struct("MotorDrivePositionProxy").finish()
242    }
243}
244/// FFI-safe equivalent of [`Box<dyn arci::MotorDriveVelocity>`](arci::MotorDriveVelocity).
245#[derive(StableAbi)]
246#[repr(C)]
247pub struct MotorDriveVelocityProxy(
248    pub(crate) crate::proxy::MotorDriveVelocityTraitObject,
249);
250impl MotorDriveVelocityProxy {
251    /// Creates a new `MotorDriveVelocityProxy`.
252    pub fn new<T>(inner: T) -> Self
253    where
254        T: arci::MotorDriveVelocity + 'static,
255    {
256        Self(
257            crate::proxy::MotorDriveVelocityTraitObject::from_value(
258                inner,
259                abi_stable::erased_types::TD_Opaque,
260            ),
261        )
262    }
263}
264impl arci::MotorDriveVelocity for MotorDriveVelocityProxy {
265    fn set_motor_velocity(&self, velocity: f64) -> Result<(), Error> {
266        Ok(self.0.set_motor_velocity(velocity.into()).into_result()?.into())
267    }
268    fn get_motor_velocity(&self) -> Result<f64, Error> {
269        Ok(self.0.get_motor_velocity().into_result()?.into())
270    }
271}
272impl std::fmt::Debug for MotorDriveVelocityProxy {
273    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
274        f.debug_struct("MotorDriveVelocityProxy").finish()
275    }
276}
277/// FFI-safe equivalent of [`Box<dyn arci::MotorDriveEffort>`](arci::MotorDriveEffort).
278#[derive(StableAbi)]
279#[repr(C)]
280pub struct MotorDriveEffortProxy(pub(crate) crate::proxy::MotorDriveEffortTraitObject);
281impl MotorDriveEffortProxy {
282    /// Creates a new `MotorDriveEffortProxy`.
283    pub fn new<T>(inner: T) -> Self
284    where
285        T: arci::MotorDriveEffort + 'static,
286    {
287        Self(
288            crate::proxy::MotorDriveEffortTraitObject::from_value(
289                inner,
290                abi_stable::erased_types::TD_Opaque,
291            ),
292        )
293    }
294}
295impl arci::MotorDriveEffort for MotorDriveEffortProxy {
296    fn set_motor_effort(&self, effort: f64) -> Result<(), Error> {
297        Ok(self.0.set_motor_effort(effort.into()).into_result()?.into())
298    }
299    fn get_motor_effort(&self) -> Result<f64, Error> {
300        Ok(self.0.get_motor_effort().into_result()?.into())
301    }
302}
303impl std::fmt::Debug for MotorDriveEffortProxy {
304    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
305        f.debug_struct("MotorDriveEffortProxy").finish()
306    }
307}
308/// FFI-safe equivalent of [`Box<dyn arci::MoveBase>`](arci::MoveBase).
309#[derive(StableAbi)]
310#[repr(C)]
311pub struct MoveBaseProxy(pub(crate) crate::proxy::MoveBaseTraitObject);
312impl MoveBaseProxy {
313    /// Creates a new `MoveBaseProxy`.
314    pub fn new<T>(inner: T) -> Self
315    where
316        T: arci::MoveBase + 'static,
317    {
318        Self(
319            crate::proxy::MoveBaseTraitObject::from_value(
320                inner,
321                abi_stable::erased_types::TD_Opaque,
322            ),
323        )
324    }
325}
326impl arci::MoveBase for MoveBaseProxy {
327    fn send_velocity(&self, velocity: &BaseVelocity) -> Result<(), Error> {
328        Ok(self.0.send_velocity((*velocity).into()).into_result()?.into())
329    }
330    fn current_velocity(&self) -> Result<BaseVelocity, Error> {
331        Ok(self.0.current_velocity().into_result()?.into())
332    }
333}
334impl std::fmt::Debug for MoveBaseProxy {
335    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
336        f.debug_struct("MoveBaseProxy").finish()
337    }
338}
339/// FFI-safe equivalent of [`Box<dyn arci::Navigation>`](arci::Navigation).
340#[derive(StableAbi)]
341#[repr(C)]
342pub struct NavigationProxy(pub(crate) crate::proxy::NavigationTraitObject);
343impl NavigationProxy {
344    /// Creates a new `NavigationProxy`.
345    pub fn new<T>(inner: T) -> Self
346    where
347        T: arci::Navigation + 'static,
348    {
349        Self(
350            crate::proxy::NavigationTraitObject::from_value(
351                inner,
352                abi_stable::erased_types::TD_Opaque,
353            ),
354        )
355    }
356}
357impl arci::Navigation for NavigationProxy {
358    fn send_goal_pose(
359        &self,
360        goal: Isometry2<f64>,
361        frame_id: &str,
362        timeout: std::time::Duration,
363    ) -> Result<WaitFuture, Error> {
364        Ok(
365            self
366                .0
367                .send_goal_pose(goal.into(), frame_id.into(), timeout.into())
368                .into_result()?
369                .into(),
370        )
371    }
372    fn cancel(&self) -> Result<(), Error> {
373        Ok(self.0.cancel().into_result()?.into())
374    }
375}
376impl std::fmt::Debug for NavigationProxy {
377    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
378        f.debug_struct("NavigationProxy").finish()
379    }
380}
381/// FFI-safe equivalent of [`Box<dyn arci::Speaker>`](arci::Speaker).
382#[derive(StableAbi)]
383#[repr(C)]
384pub struct SpeakerProxy(pub(crate) crate::proxy::SpeakerTraitObject);
385impl SpeakerProxy {
386    /// Creates a new `SpeakerProxy`.
387    pub fn new<T>(inner: T) -> Self
388    where
389        T: arci::Speaker + 'static,
390    {
391        Self(
392            crate::proxy::SpeakerTraitObject::from_value(
393                inner,
394                abi_stable::erased_types::TD_Opaque,
395            ),
396        )
397    }
398}
399impl arci::Speaker for SpeakerProxy {
400    fn speak(&self, message: &str) -> Result<WaitFuture, Error> {
401        Ok(self.0.speak(message.into()).into_result()?.into())
402    }
403}
404impl std::fmt::Debug for SpeakerProxy {
405    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
406        f.debug_struct("SpeakerProxy").finish()
407    }
408}
409/// FFI-safe equivalent of [`Box<dyn arci::TransformResolver>`](arci::TransformResolver).
410#[derive(StableAbi)]
411#[repr(C)]
412pub struct TransformResolverProxy(pub(crate) crate::proxy::TransformResolverTraitObject);
413impl TransformResolverProxy {
414    /// Creates a new `TransformResolverProxy`.
415    pub fn new<T>(inner: T) -> Self
416    where
417        T: arci::TransformResolver + 'static,
418    {
419        Self(
420            crate::proxy::TransformResolverTraitObject::from_value(
421                inner,
422                abi_stable::erased_types::TD_Opaque,
423            ),
424        )
425    }
426}
427impl arci::TransformResolver for TransformResolverProxy {
428    fn resolve_transformation(
429        &self,
430        from: &str,
431        to: &str,
432        time: std::time::SystemTime,
433    ) -> Result<Isometry3<f64>, Error> {
434        Ok(
435            self
436                .0
437                .resolve_transformation(from.into(), to.into(), time.try_into()?)
438                .into_result()?
439                .into(),
440        )
441    }
442}
443impl std::fmt::Debug for TransformResolverProxy {
444    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
445        f.debug_struct("TransformResolverProxy").finish()
446    }
447}