diff --git a/src/main.rs b/src/main.rs index 0237470..39cec30 100644 --- a/src/main.rs +++ b/src/main.rs @@ -68,12 +68,12 @@ fn main() -> Result<(), RclrsError> { NodeId::new(1, 100182), NodeId::new(1, 100267), Some(vec![ - msg.force.x, - msg.force.y, - msg.force.z, - msg.torque.x, - msg.torque.y, - msg.torque.z, + msg.force.x.into(), + msg.force.y.into(), + msg.force.z.into(), + msg.torque.x.into(), + msg.torque.y.into(), + msg.torque.z.into(), ]), ); }, @@ -88,12 +88,12 @@ fn main() -> Result<(), RclrsError> { NodeId::new(1, 100182), NodeId::new(1, 100265), Some(vec![ - msg.translation.x, - msg.translation.y, - msg.translation.z, - msg.rotation.x, - msg.rotation.y, - msg.rotation.z, + msg.translation.x.into(), + msg.translation.y.into(), + msg.translation.z.into(), + msg.rotation.x.into(), + msg.rotation.y.into(), + msg.rotation.z.into(), ]), ); }, diff --git a/src/opc_ua_client.rs b/src/opc_ua_client.rs index 6cf93ab..d4b301a 100644 --- a/src/opc_ua_client.rs +++ b/src/opc_ua_client.rs @@ -117,14 +117,14 @@ impl OPCUAClient { Ok(()) } - pub fn call_method(&self, object_id: NodeId, method_id: NodeId, args: Option>) - where - T: Into, - { + pub fn call_method( + &self, + object_id: NodeId, + method_id: NodeId, + arguments: Option>, + ) { let cloned_session_lock = self.session.clone().unwrap(); let session = cloned_session_lock.read(); - let arguments: Option> = - args.map(|vec| vec.into_iter().map(Into::into).collect()); let method = CallMethodRequest { object_id, method_id, diff --git a/src/ros_services.rs b/src/ros_services.rs index 19caf21..ecdec07 100644 --- a/src/ros_services.rs +++ b/src/ros_services.rs @@ -1,7 +1,7 @@ use std::sync::{Arc, Mutex}; use log::info; -use opcua::types::NodeId; +use opcua::types::{NodeId, Variant}; use std_srvs::srv::{Empty_Request, Empty_Response}; use crate::opc_ua_client::OPCUAClient; @@ -26,7 +26,7 @@ impl ROSServices { self.opc_ua_client .lock() .unwrap() - .call_method(object_id, method_id, None::>); + .call_method(object_id, method_id, None::>); Empty_Response { structure_needs_at_least_one_member: 0, } @@ -42,7 +42,7 @@ impl ROSServices { self.opc_ua_client .lock() .unwrap() - .call_method(object_id, method_id, None::>); + .call_method(object_id, method_id, None::>); Empty_Response { structure_needs_at_least_one_member: 0, }