test_rearrange_bounding_box_rotation.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from jsk_recognition_msgs.msg import BoundingBoxArray
4 import message_filters
5 from nose.tools import assert_false
6 from nose.tools import assert_true
7 import rospy
8 import sys
9 import unittest
10 
11 PKG = 'jsk_pcl_ros'
12 NAME = 'test_rearrange_bounding_box_rotation'
13 
14 class TestRearrangeBoundingBoxRotation(unittest.TestCase):
15  def __init__(self, *args):
16  super(TestRearrangeBoundingBoxRotation, self).__init__(*args)
17  self.msg = None
18  rospy.init_node(NAME)
19  rotated_boxes_sub = rospy.Subscriber("/rearrange_bounding_box_check/output",
20  BoundingBoxArray, self._cb)
21 
22  def test_rotation(self):
23  while not rospy.is_shutdown():
24  if self.msg:
25  rospy.loginfo("Test rotated bounding box")
26  assert_false((abs(self.msg.boxes[0].pose.orientation.w - 1.0) < 1e-7 and
27  abs(self.msg.boxes[0].pose.orientation.x) < 1e-7 and
28  abs(self.msg.boxes[0].pose.orientation.y) < 1e-7 and
29  abs(self.msg.boxes[0].pose.orientation.z) < 1e-7),
30  "The rotation calculations are not correct.")
31  break
32 
33  def _cb(self, msg):
34  self.msg = msg
35 
36 if __name__ == '__main__':
37  import rostest
38  rostest.run(PKG, NAME, TestRearrangeBoundingBoxRotation, sys.argv)
test_rearrange_bounding_box_rotation.TestRearrangeBoundingBoxRotation.__init__
def __init__(self, *args)
Definition: test_rearrange_bounding_box_rotation.py:15
msg
test_rearrange_bounding_box_rotation.TestRearrangeBoundingBoxRotation
Definition: test_rearrange_bounding_box_rotation.py:14
test_rearrange_bounding_box_rotation.TestRearrangeBoundingBoxRotation._cb
def _cb(self, msg)
Definition: test_rearrange_bounding_box_rotation.py:33
test_rearrange_bounding_box_rotation.TestRearrangeBoundingBoxRotation.test_rotation
def test_rotation(self)
Definition: test_rearrange_bounding_box_rotation.py:22
test_rearrange_bounding_box_rotation.TestRearrangeBoundingBoxRotation.msg
msg
Definition: test_rearrange_bounding_box_rotation.py:17


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Tue Jan 7 2025 04:05:45