38 from tf.transformations
import quaternion_matrix, euler_from_matrix
43 PKG =
'hironx_ros_bridge' 51 self.rarm.wait_for_result()
54 tm0 = rospy.Time.now()
56 self.rarm.wait_for_result()
58 self.rarm.wait_for_result()
60 self.rarm.wait_for_result()
61 tm1 = rospy.Time.now()
62 data_time = (tm1 - tm0).to_sec()
65 min_data =
min([d[1]
for d
in data])
66 max_data = max([d[1]
for d
in data])
67 print "check setJointAnglesOfGroup(wait=True), tm = ", data_time,
", ok?", abs(data_time - 15.0) < 0.1
68 self.assertTrue(abs(data_time - 15.0) < 1.0)
69 print " min = ", min_data,
", ok?", abs(min_data - -140) < 5
70 self.assertTrue(abs(min_data - -140) < 5)
71 print " max = ", max_data,
", ok?", abs(max_data - -100) < 5
72 self.assertTrue(abs(max_data - -100) < 5)
75 clear_time = [4.5, 4.0, 3.5, 3.0, 2.5, 2.0, 1.5, 1.0]
76 clear_time = [4.5, 3.0, 1.0]
77 for i
in range(len(clear_time)):
79 self.rarm.wait_for_result()
82 tm0 = rospy.Time.now()
84 rospy.sleep(clear_time[i]);
86 self.rarm.wait_for_result()
87 tm1 = rospy.Time.now()
89 filename = self.
filename_base +
"-no-wait-"+str(clear_time[i])
91 data_time = (tm1 - tm0).to_sec()
92 min_data =
min([d[1]
for d
in data])
93 max_data = max([d[1]
for d
in data])
94 print "check setJointAnglesOfGroup(wait=False), tm = ", data_time,
", ok?", abs(data_time - (10.0 - (5 - clear_time[i]))) < 1.5,
" ", (10.0 - (5 - clear_time[i]))
95 self.assertTrue(abs(data_time - (10.0 - (5 - clear_time[i]))) < 1.5)
96 print " min = ", min_data,
", ok?", abs(min_data - (-140+i*40/len(clear_time))) < 20,
" ", -140+i*40/len(clear_time)
97 self.assertTrue(abs(min_data - (-140+i*40/len(clear_time))) < 20)
98 print " max = ", max_data,
", ok?", abs(max_data - -100) < 5
99 self.assertTrue(abs(max_data - -100) < 5)
102 clear_time = [1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5]
103 clear_time = [4.5, 4.0, 3.5, 3.0, 2.5, 2.0, 1.5, 1.0]
104 clear_time = [4.5, 3.0, 1.0]
105 for i
in range(len(clear_time)):
107 self.rarm.wait_for_result()
110 tm0 = rospy.Time.now()
112 self.rarm.wait_for_result()
114 rospy.sleep(clear_time[i])
115 self.rarm.cancel_goal()
116 self.rarm.wait_for_result()
117 tm1 = rospy.Time.now()
121 data_time = (tm1 - tm0).to_sec()
122 min_data =
min([d[1]
for d
in data])
123 max_data = max([d[1]
for d
in data])
124 print "check setJointAnglesOfGroup(clear "+str(clear_time[i])+
"), tm = ", data_time,
", ok?", abs(data_time - (10 - (5 - clear_time[i]))) < 0.5,
" ", (10 - (5 - clear_time[i]))
125 self.assertTrue(abs(data_time - (10 - (5 - clear_time[i]))) < 0.5)
126 print " min = ", min_data,
", ok?", abs(min_data - (-140+(i+1)*40/len(clear_time))) < 35,
" ", -140+(i+1)*40/len(clear_time)
127 self.assertTrue(abs(min_data - (-140+(i+1)*40/len(clear_time))) < 35)
128 print " max = ", max_data,
", ok?", abs(max_data - -100) < 5
129 self.assertTrue(abs(max_data - -100) < 5)
131 if __name__ ==
'__main__':
133 rostest.rosrun(PKG,
'test_hronx_ros_bridge_send', TestHiroROSBridgeSend)
def test_send_goal_and_wait(self)
def test_send_goal_and_nowait(self)
def setup_Positions(self, goal, positions, tm=1.0)
def test_send_goal_and_clear(self)
def check_q_data(self, name)