5 from geometry_msgs.msg
import Twist, TwistStamped
8 PKG =
'rr_control_input_manager' 13 super(TestLatency, self).
__init__(*args, **kwargs)
23 test_method_name = self._testMethodName
24 subscribers = {
'test_twist_unstamped_latency': (
'/test/outputA', Twist),
25 'test_twist_stamped_latency': (
'/test/outputF', TwistStamped)
27 publishers = {
'test_twist_unstamped_latency': (
'/test/inputA', TwistStamped),
28 'test_twist_stamped_latency': (
'/test/inputF', TwistStamped),
31 if test_method_name
in subscribers.keys():
32 self.
sub = rospy.Subscriber(subscribers[test_method_name][0],
33 subscribers[test_method_name][1],
36 if test_method_name
in publishers.keys():
37 self.
pub = rospy.Publisher(publishers[test_method_name][0],
38 publishers[test_method_name][1],
74 msg.header.stamp = time
75 msg.header.frame_id = frame_id
76 msg.twist.linear.x = x
77 msg.twist.linear.y = y
78 msg.twist.linear.z = z
79 msg.twist.angular.x = ax
80 msg.twist.angular.y = ay
81 msg.twist.angular.z = az
86 result = msg1.header.stamp == msg2.header.stamp \
87 and msg1.header.frame_id == msg2.header.frame_id \
88 and msg1.twist == msg2.twist
93 rate = rospy.Rate(100)
95 for i
in range(self.
trials):
99 for timeout
in range(1000):
113 rate = rospy.Rate(100)
115 for i
in range(self.
trials):
117 self.pub.publish(msg)
119 for timeout
in range(1000):
124 self.assertEqual(msg.twist, self.
msg)
133 rospy.init_node(
'test_control_input_manager_latency_test')
134 rosunit.unitrun(PKG,
'test_control_input_manager_latency', TestLatency)
def generate_twist(self, x=0, y=0, z=0, rx=0, ry=0, rz=0)
def test_twist_unstamped_latency(self)
def reset_message_info(self)
def compare_twist_stamped(self, msg1, msg2)
def generate_twist_stamped(self, time, seq=0, frame_id='', x=0, y=0, z=0, ax=0, ay=0, az=0)
def __init__(self, args, kwargs)
def test_twist_stamped_latency(self)