21 from geometry_msgs.msg
import WrenchStamped
23 from uuv_gazebo_ros_plugins_msgs.msg
import FloatStamped
26 PKG =
'uuv_thruster_manager' 27 roslib.load_manifest(PKG)
31 AXIS_X_TAM = np.array([
33 [0.87758256, 0, -0.47942554, 0.47942554, 0.47942554, 0.87758256],
34 [0.87758256, 0.47942554, 0, -0.47942554, 0.87758256, -0.87758256]
37 AXIS_Y_TAM = np.array([
38 [0, 0.87758256, 0.47942554, 0, 0.47942554, -0.87758256],
40 [-0.47942554, 0.87758256, 0, -0.87758256, -0.47942554, 0.47942554]
43 AXIS_Z_TAM = np.array([
44 [0, -0.47942554, 0.87758256, 0, 0.87758256, 0.47942554],
45 [0.47942554, 0, 0.87758256, -0.87758256, -0.87758256, 0.47942554],
46 [0., 0., 1., 1., 0., 0.]
52 'thruster_manager/get_thrusters_info',
53 'thruster_manager/get_thruster_curve',
54 'thruster_manager/set_config',
55 'thruster_manager/get_config' 59 rospy.wait_for_service(
'/{}/{}'.format(NS, srv), timeout=1000)
62 axis = rospy.get_param(
'axis')
63 ref_config = rospy.get_param(
'/{}/thruster_manager'.format(NS))
65 rospy.wait_for_service(
'/{}/thruster_manager/get_config'.format(NS), timeout=1000)
66 srv = rospy.ServiceProxy(
'/{}/thruster_manager/get_config'.format(NS), GetThrusterManagerConfig)
69 self.assertEqual(tm_config.tf_prefix,
'/test_vehicle/')
70 self.assertEqual(tm_config.base_link,
'base_link')
71 self.assertEqual(tm_config.thruster_frame_base,
'thruster_')
72 self.assertEqual(tm_config.thruster_topic_suffix,
'/input')
73 self.assertEqual(tm_config.timeout, -1)
74 self.assertEqual(tm_config.max_thrust, 1000.0)
75 self.assertEqual(tm_config.n_thrusters, 3)
78 tam_flat = AXIS_X_TAM.flatten()
80 tam_flat = AXIS_Y_TAM.flatten()
82 tam_flat = AXIS_Z_TAM.flatten()
84 self.assertEqual(len(tm_config.allocation_matrix), tam_flat.size)
85 for x, y
in zip(tam_flat, tm_config.allocation_matrix):
86 self.assertAlmostEqual(x, y)
89 if __name__ ==
'__main__':
91 rosunit.unitrun(PKG,
'test_thruster_allocator', TestThrusterAllocator)
def test_services_exist(self)