Skip to content

Commit

Permalink
test: Add move_joint integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-caspers committed Dec 18, 2024
1 parent 4e01534 commit 6c57311
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/helpers/opc_ua_test_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use opcua::server::prelude::{
};
use opcua::server::session::SessionManager;
use opcua::sync::RwLock;
use opcua::types::{CallMethodRequest, CallMethodResult, ObjectId, StatusCode, Variant};
use opcua::types::{
Array, CallMethodRequest, CallMethodResult, ObjectId, StatusCode, Variant, VariantTypeId,
};
use std::path::PathBuf;
use std::sync::mpsc::Sender;
use std::sync::Arc;
Expand Down Expand Up @@ -102,6 +104,33 @@ fn add_methods(server: &mut Server, namespace: u16, assertion_tx: Sender<String>
"impedance_control/disable".to_string(),
assertion_tx.clone(),
);
add_method_stub(
server,
NodeId::new(namespace, 100210),
NodeId::new(namespace, 100211),
Some(vec![
Variant::Boolean(false),
Variant::UInt32(0),
// The opcua crate creates an array with dimension = Some([]) when decoding an empty array.
// The default trait used in the ros service caller generates an empty vector so this is the workaround
// to still have a useful assertion.
Array::new_multi(VariantTypeId::Double, Vec::new(), Vec::new())
.unwrap()
.into(),
Variant::UInt32(0),
Variant::Double(0.0),
Variant::Boolean(false),
Variant::Double(0.0),
Array::new_multi(VariantTypeId::Int32, Vec::new(), Vec::new())
.unwrap()
.into(),
Variant::UInt32(0),
Variant::Boolean(false),
]),
None,
"move_joints".to_string(),
assertion_tx.clone(),
);
}

/// Creates an OPC UA variable that is monotonously increasing.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_bridge_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
use common::{wait_for_function_to_pass, ManagedRosBridge};
use helpers::opc_ua_test_server::OPCUATestServer;
use std_srvs::srv::Empty;
use voraus_interfaces::srv::MoveJoints;

pub mod common;
pub mod helpers;
Expand Down Expand Up @@ -63,3 +64,4 @@ make_testcase_method!(
Empty,
test_disable_impedance_control
);
make_testcase_method!("move_joints", MoveJoints, test_move_joints);

0 comments on commit 6c57311

Please sign in to comment.