34 import roslib; roslib.load_manifest(
'calibration_launch')
48 cache.reconfigure([
"cam1"], [], [])
49 cache.set_max_sizes( {
"cam1":100}, {}, {})
52 msg = CameraMeasurement()
53 msg.header.stamp = rospy.Time(n*10,0)
54 cache.add_cam_measurement(
"cam1", msg)
56 m_robot = cache.request_robot_measurement(rospy.Time(19,0), rospy.Time(31,0))
58 self.assertTrue(m_robot
is not None)
59 self.assertEquals( len(m_robot.M_cam), 1 )
60 self.assertEquals( len(m_robot.M_chain), 0 )
61 self.assertEquals( len(m_robot.M_laser), 0 )
63 m_robot = cache.request_robot_measurement(rospy.Time(21,0), rospy.Time(29,0))
64 self.assertTrue(m_robot
is None)
68 cache.reconfigure([
"cam1",
"cam2"], [], [])
69 cache.set_max_sizes( {
"cam1":100,
"cam2":100}, {}, {})
72 msg = CameraMeasurement()
73 msg.header.stamp = rospy.Time(n*10,0)
74 cache.add_cam_measurement(
"cam1", msg)
77 msg = CameraMeasurement()
78 msg.header.stamp = rospy.Time(n*10+1,0)
79 cache.add_cam_measurement(
"cam2", msg)
81 m_robot = cache.request_robot_measurement(rospy.Time(18,0), rospy.Time(32,0))
83 self.assertTrue(m_robot
is not None)
84 self.assertEquals( len(m_robot.M_cam), 2 )
85 self.assertEquals( len(m_robot.M_chain), 0 )
86 self.assertEquals( len(m_robot.M_laser), 0 )
88 m_robot = cache.request_robot_measurement(rospy.Time(20,0), rospy.Time(30,0))
89 self.assertTrue(m_robot
is None)
93 cache.reconfigure([], [
"chain1"], [])
94 cache.set_max_sizes( {}, {
"chain1":100}, {})
97 msg = ChainMeasurement()
98 msg.header.stamp = rospy.Time(n*10,0)
99 cache.add_chain_measurement(
"chain1", msg)
101 m_robot = cache.request_robot_measurement(rospy.Time(18,0), rospy.Time(32,0))
103 self.assertTrue(m_robot
is not None)
104 self.assertEquals( len(m_robot.M_cam), 0 )
105 self.assertEquals( len(m_robot.M_chain), 1 )
106 self.assertEquals( len(m_robot.M_laser), 0 )
108 m_robot = cache.request_robot_measurement(rospy.Time(21,0), rospy.Time(29,0))
109 self.assertTrue(m_robot
is None)
113 cache.reconfigure([], [], [
"laser1"])
114 cache.set_max_sizes( {}, {}, {
"laser1":100})
116 for n
in range(1,11):
117 msg = LaserMeasurement()
118 cache.add_laser_measurement(
"laser1", msg, rospy.Time(n*10,0), rospy.Time(n*10+2,0))
120 m_robot = cache.request_robot_measurement(rospy.Time(19,0), rospy.Time(32,0))
122 self.assertTrue(m_robot
is not None)
123 self.assertEquals( len(m_robot.M_cam), 0 )
124 self.assertEquals( len(m_robot.M_chain), 0 )
125 self.assertEquals( len(m_robot.M_laser), 1 )
127 m_robot = cache.request_robot_measurement(rospy.Time(20,0), rospy.Time(21,0))
128 self.assertTrue(m_robot
is None)
130 if __name__ ==
'__main__':
132 rostest.unitrun(
'pr2_calibration_executive',
'test_robot_measurement_cache', TestCache)
def test_one_sensor_easy(self)
test 1 == 1
A sample python unit test.
def test_chain_easy(self)
def test_laser_easy(self)
def test_multi_cam_easy(self)