Go to the documentation of this file.00001
00002 import rospy
00003 from sensor_msgs.msg import Range
00004
00005 import unittest
00006
00007 class TestRangePlugin(unittest.TestCase):
00008
00009 def test_max_range(self):
00010 msg = rospy.wait_for_message('/sonar2', Range)
00011 self.assertAlmostEqual(msg.range, msg.max_range)
00012
00013 def test_inside_range(self):
00014 msg = rospy.wait_for_message('/sonar', Range)
00015 self.assertTrue(msg.range < 0.25 and msg.range > 0.22)
00016
00017 if __name__ == '__main__':
00018 import rostest
00019 PKG_NAME = 'gazebo_plugins'
00020 TEST_NAME = PKG_NAME + 'range_test'
00021 rospy.init_node(TEST_NAME)
00022 rostest.rosrun(PKG_NAME, TEST_NAME, TestRangePlugin)