test_cluster_point_indices_decomposer_bbox.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 import math
5 import sys
6 import unittest
7 
8 from nose.tools import assert_false
9 from nose.tools import assert_true
10 
11 from jsk_recognition_msgs.msg import BoundingBoxArray
12 import rospy
13 import rostest
14 
15 
16 PKG = 'jsk_pcl_ros'
17 NAME = 'test_cluster_point_indices_decomposer_box'
18 
19 
20 class TestClusterPointIndicesDecomposerBbox(unittest.TestCase):
21  def __init__(self, *args):
22  super(TestClusterPointIndicesDecomposerBbox, self).__init__(*args)
23  rospy.init_node(NAME)
24  self.check_times = rospy.get_param('~check_times', 1)
25 
26  def test_bbox(self):
27  is_boxes_empty = True
28  for i in range(self.check_times):
29  msg = rospy.wait_for_message("~boxes", BoundingBoxArray)
30  for box in msg.boxes:
31  is_boxes_empty = False
32  assert_false(math.isnan(box.pose.position.x),
33  'pose.position.x is nan')
34  assert_false(math.isnan(box.pose.position.y),
35  'pose.position.y is nan')
36  assert_false(math.isnan(box.pose.position.z),
37  'pose.position.z is nan')
38  assert_false(math.isnan(box.pose.orientation.x),
39  'pose.orientation.x is nan')
40  assert_false(math.isnan(box.pose.orientation.y),
41  'pose.orientation.y is nan')
42  assert_false(math.isnan(box.pose.orientation.z),
43  'pose.orientation.z is nan')
44  assert_false(math.isnan(box.pose.orientation.w),
45  'pose.orientation.w is nan')
46  assert_false(math.isnan(box.dimensions.x),
47  'dimensions.x is nan')
48  assert_false(math.isnan(box.dimensions.y),
49  'dimensions.y is nan')
50  assert_false(math.isnan(box.dimensions.z),
51  'dimensions.z is nan')
52  assert_true(box.dimensions.x != 0, 'dimensions.x is 0')
53  assert_true(box.dimensions.y != 0, 'dimensions.y is 0')
54  assert_true(box.dimensions.z != 0, 'dimensions.z is 0')
55  assert_true(
56  not is_boxes_empty,
57  'Bboxes array is always empty in %d trials' % self.check_times
58  )
59 
60 
61 if __name__ == '__main__':
62  rostest.run(PKG, NAME, TestClusterPointIndicesDecomposerBbox, sys.argv)


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:47