test_range.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rospy
3 from sensor_msgs.msg import Range
4 
5 import unittest
6 
7 class TestRangePlugin(unittest.TestCase):
8 
9  def test_max_range(self):
10  msg = rospy.wait_for_message('/sonar2', Range)
11  self.assertAlmostEqual(msg.range, msg.max_range)
12 
13  def test_inside_range(self):
14  msg = rospy.wait_for_message('/sonar', Range)
15  self.assertTrue(msg.range < 0.25 and msg.range > 0.22)
16 
17 if __name__ == '__main__':
18  import rostest
19  PKG_NAME = 'gazebo_plugins'
20  TEST_NAME = PKG_NAME + 'range_test'
21  rospy.init_node(TEST_NAME)
22  rostest.rosrun(PKG_NAME, TEST_NAME, TestRangePlugin)


gazebo_plugins
Author(s): John Hsu
autogenerated on Tue Mar 26 2019 02:31:27