1#![allow(unused_variables)]
5#![allow(clippy::useless_conversion, clippy::unit_arg)]
6
7use abi_stable::{rtry, std_types::{RBox, RDuration, ROk, RResult, RStr}};
8use super::*;
9pub(crate) type PluginTraitObject = RPluginTrait_TO<RBox<()>>;
10#[sabi_trait]
11pub(crate) trait RPluginTrait: Send + Sync + 'static {
12 fn new_gamepad(
13 &self,
14 args: RString,
15 ) -> RResult<ROption<crate::GamepadProxy>, RError>;
16 fn new_joint_trajectory_client(
17 &self,
18 args: RString,
19 ) -> RResult<ROption<crate::JointTrajectoryClientProxy>, RError>;
20 fn new_localization(
21 &self,
22 args: RString,
23 ) -> RResult<ROption<crate::LocalizationProxy>, RError>;
24 fn new_motor_drive_position(
25 &self,
26 args: RString,
27 ) -> RResult<ROption<crate::MotorDrivePositionProxy>, RError>;
28 fn new_motor_drive_velocity(
29 &self,
30 args: RString,
31 ) -> RResult<ROption<crate::MotorDriveVelocityProxy>, RError>;
32 fn new_motor_drive_effort(
33 &self,
34 args: RString,
35 ) -> RResult<ROption<crate::MotorDriveEffortProxy>, RError>;
36 fn new_move_base(
37 &self,
38 args: RString,
39 ) -> RResult<ROption<crate::MoveBaseProxy>, RError>;
40 fn new_navigation(
41 &self,
42 args: RString,
43 ) -> RResult<ROption<crate::NavigationProxy>, RError>;
44 fn new_speaker(
45 &self,
46 args: RString,
47 ) -> RResult<ROption<crate::SpeakerProxy>, RError>;
48 fn new_transform_resolver(
49 &self,
50 args: RString,
51 ) -> RResult<ROption<crate::TransformResolverProxy>, RError>;
52}
53impl<T> RPluginTrait for T
54where
55 T: crate::Plugin,
56{
57 fn new_gamepad(
58 &self,
59 args: RString,
60 ) -> RResult<ROption<crate::GamepadProxy>, RError> {
61 ROk(
62 rtry!(crate ::Plugin::new_gamepad(self, args.into()))
63 .map(crate::GamepadProxy::new)
64 .into(),
65 )
66 }
67 fn new_joint_trajectory_client(
68 &self,
69 args: RString,
70 ) -> RResult<ROption<crate::JointTrajectoryClientProxy>, RError> {
71 ROk(
72 rtry!(crate ::Plugin::new_joint_trajectory_client(self, args.into()))
73 .map(crate::JointTrajectoryClientProxy::new)
74 .into(),
75 )
76 }
77 fn new_localization(
78 &self,
79 args: RString,
80 ) -> RResult<ROption<crate::LocalizationProxy>, RError> {
81 ROk(
82 rtry!(crate ::Plugin::new_localization(self, args.into()))
83 .map(crate::LocalizationProxy::new)
84 .into(),
85 )
86 }
87 fn new_motor_drive_position(
88 &self,
89 args: RString,
90 ) -> RResult<ROption<crate::MotorDrivePositionProxy>, RError> {
91 ROk(
92 rtry!(crate ::Plugin::new_motor_drive_position(self, args.into()))
93 .map(crate::MotorDrivePositionProxy::new)
94 .into(),
95 )
96 }
97 fn new_motor_drive_velocity(
98 &self,
99 args: RString,
100 ) -> RResult<ROption<crate::MotorDriveVelocityProxy>, RError> {
101 ROk(
102 rtry!(crate ::Plugin::new_motor_drive_velocity(self, args.into()))
103 .map(crate::MotorDriveVelocityProxy::new)
104 .into(),
105 )
106 }
107 fn new_motor_drive_effort(
108 &self,
109 args: RString,
110 ) -> RResult<ROption<crate::MotorDriveEffortProxy>, RError> {
111 ROk(
112 rtry!(crate ::Plugin::new_motor_drive_effort(self, args.into()))
113 .map(crate::MotorDriveEffortProxy::new)
114 .into(),
115 )
116 }
117 fn new_move_base(
118 &self,
119 args: RString,
120 ) -> RResult<ROption<crate::MoveBaseProxy>, RError> {
121 ROk(
122 rtry!(crate ::Plugin::new_move_base(self, args.into()))
123 .map(crate::MoveBaseProxy::new)
124 .into(),
125 )
126 }
127 fn new_navigation(
128 &self,
129 args: RString,
130 ) -> RResult<ROption<crate::NavigationProxy>, RError> {
131 ROk(
132 rtry!(crate ::Plugin::new_navigation(self, args.into()))
133 .map(crate::NavigationProxy::new)
134 .into(),
135 )
136 }
137 fn new_speaker(
138 &self,
139 args: RString,
140 ) -> RResult<ROption<crate::SpeakerProxy>, RError> {
141 ROk(
142 rtry!(crate ::Plugin::new_speaker(self, args.into()))
143 .map(crate::SpeakerProxy::new)
144 .into(),
145 )
146 }
147 fn new_transform_resolver(
148 &self,
149 args: RString,
150 ) -> RResult<ROption<crate::TransformResolverProxy>, RError> {
151 ROk(
152 rtry!(crate ::Plugin::new_transform_resolver(self, args.into()))
153 .map(crate::TransformResolverProxy::new)
154 .into(),
155 )
156 }
157}
158pub(crate) type LocalizationTraitObject = RLocalizationTrait_TO<RBox<()>>;
159#[abi_stable::sabi_trait]
160pub(crate) trait RLocalizationTrait: Send + Sync + 'static {
161 fn current_pose(&self, frame_id: RStr<'_>) -> RResult<RIsometry2F64, RError>;
162}
163impl<T> RLocalizationTrait for T
164where
165 T: arci::Localization + 'static,
166{
167 fn current_pose(&self, frame_id: RStr<'_>) -> RResult<RIsometry2F64, RError> {
168 ROk(rtry!(arci::Localization::current_pose(self, frame_id.into())).into())
169 }
170}
171pub(crate) type MotorDrivePositionTraitObject = RMotorDrivePositionTrait_TO<RBox<()>>;
172#[abi_stable::sabi_trait]
173pub(crate) trait RMotorDrivePositionTrait: Send + Sync + 'static {
174 fn set_motor_position(&self, position: Rf64) -> RResult<(), RError>;
175 fn get_motor_position(&self) -> RResult<Rf64, RError>;
176}
177impl<T> RMotorDrivePositionTrait for T
178where
179 T: arci::MotorDrivePosition + 'static,
180{
181 fn set_motor_position(&self, position: Rf64) -> RResult<(), RError> {
182 ROk(
183 rtry!(arci::MotorDrivePosition::set_motor_position(self, position.into()))
184 .into(),
185 )
186 }
187 fn get_motor_position(&self) -> RResult<Rf64, RError> {
188 ROk(rtry!(arci::MotorDrivePosition::get_motor_position(self)).into())
189 }
190}
191pub(crate) type MotorDriveVelocityTraitObject = RMotorDriveVelocityTrait_TO<RBox<()>>;
192#[abi_stable::sabi_trait]
193pub(crate) trait RMotorDriveVelocityTrait: Send + Sync + 'static {
194 fn set_motor_velocity(&self, velocity: Rf64) -> RResult<(), RError>;
195 fn get_motor_velocity(&self) -> RResult<Rf64, RError>;
196}
197impl<T> RMotorDriveVelocityTrait for T
198where
199 T: arci::MotorDriveVelocity + 'static,
200{
201 fn set_motor_velocity(&self, velocity: Rf64) -> RResult<(), RError> {
202 ROk(
203 rtry!(arci::MotorDriveVelocity::set_motor_velocity(self, velocity.into()))
204 .into(),
205 )
206 }
207 fn get_motor_velocity(&self) -> RResult<Rf64, RError> {
208 ROk(rtry!(arci::MotorDriveVelocity::get_motor_velocity(self)).into())
209 }
210}
211pub(crate) type MotorDriveEffortTraitObject = RMotorDriveEffortTrait_TO<RBox<()>>;
212#[abi_stable::sabi_trait]
213pub(crate) trait RMotorDriveEffortTrait: Send + Sync + 'static {
214 fn set_motor_effort(&self, effort: Rf64) -> RResult<(), RError>;
215 fn get_motor_effort(&self) -> RResult<Rf64, RError>;
216}
217impl<T> RMotorDriveEffortTrait for T
218where
219 T: arci::MotorDriveEffort + 'static,
220{
221 fn set_motor_effort(&self, effort: Rf64) -> RResult<(), RError> {
222 ROk(rtry!(arci::MotorDriveEffort::set_motor_effort(self, effort.into())).into())
223 }
224 fn get_motor_effort(&self) -> RResult<Rf64, RError> {
225 ROk(rtry!(arci::MotorDriveEffort::get_motor_effort(self)).into())
226 }
227}
228pub(crate) type MoveBaseTraitObject = RMoveBaseTrait_TO<RBox<()>>;
229#[abi_stable::sabi_trait]
230pub(crate) trait RMoveBaseTrait: Send + Sync + 'static {
231 fn send_velocity(&self, velocity: RBaseVelocity) -> RResult<(), RError>;
232 fn current_velocity(&self) -> RResult<RBaseVelocity, RError>;
233}
234impl<T> RMoveBaseTrait for T
235where
236 T: arci::MoveBase + 'static,
237{
238 fn send_velocity(&self, velocity: RBaseVelocity) -> RResult<(), RError> {
239 ROk(rtry!(arci::MoveBase::send_velocity(self, & velocity.into())).into())
240 }
241 fn current_velocity(&self) -> RResult<RBaseVelocity, RError> {
242 ROk(rtry!(arci::MoveBase::current_velocity(self)).into())
243 }
244}
245pub(crate) type NavigationTraitObject = RNavigationTrait_TO<RBox<()>>;
246#[abi_stable::sabi_trait]
247pub(crate) trait RNavigationTrait: Send + Sync + 'static {
248 fn send_goal_pose(
249 &self,
250 goal: RIsometry2F64,
251 frame_id: RStr<'_>,
252 timeout: RDuration,
253 ) -> RResult<RBlockingWait, RError>;
254 fn cancel(&self) -> RResult<(), RError>;
255}
256impl<T> RNavigationTrait for T
257where
258 T: arci::Navigation + 'static,
259{
260 fn send_goal_pose(
261 &self,
262 goal: RIsometry2F64,
263 frame_id: RStr<'_>,
264 timeout: RDuration,
265 ) -> RResult<RBlockingWait, RError> {
266 ROk(
267 rtry!(
268 arci::Navigation::send_goal_pose(self, goal.into(), frame_id.into(),
269 timeout.into())
270 )
271 .into(),
272 )
273 }
274 fn cancel(&self) -> RResult<(), RError> {
275 ROk(rtry!(arci::Navigation::cancel(self)).into())
276 }
277}
278pub(crate) type SpeakerTraitObject = RSpeakerTrait_TO<RBox<()>>;
279#[abi_stable::sabi_trait]
280pub(crate) trait RSpeakerTrait: Send + Sync + 'static {
281 fn speak(&self, message: RStr<'_>) -> RResult<RBlockingWait, RError>;
282}
283impl<T> RSpeakerTrait for T
284where
285 T: arci::Speaker + 'static,
286{
287 fn speak(&self, message: RStr<'_>) -> RResult<RBlockingWait, RError> {
288 ROk(rtry!(arci::Speaker::speak(self, message.into())).into())
289 }
290}
291pub(crate) type TransformResolverTraitObject = RTransformResolverTrait_TO<RBox<()>>;
292#[abi_stable::sabi_trait]
293pub(crate) trait RTransformResolverTrait: Send + Sync + 'static {
294 fn resolve_transformation(
295 &self,
296 from: RStr<'_>,
297 to: RStr<'_>,
298 time: RSystemTime,
299 ) -> RResult<RIsometry3F64, RError>;
300}
301impl<T> RTransformResolverTrait for T
302where
303 T: arci::TransformResolver + 'static,
304{
305 fn resolve_transformation(
306 &self,
307 from: RStr<'_>,
308 to: RStr<'_>,
309 time: RSystemTime,
310 ) -> RResult<RIsometry3F64, RError> {
311 ROk(
312 rtry!(
313 arci::TransformResolver::resolve_transformation(self, from.into(), to
314 .into(), rtry!(time.try_into()))
315 )
316 .into(),
317 )
318 }
319}