Main Page
Namespaces
Classes
Files
File List
File Members
test
test_polygon_array_likelihood_filter.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
# Copyright: Yuki Furuta <furushchev@jsk.imi.i.u-tokyo.ac.jp>
4
5
import
rospy
6
from
unittest
import
TestCase
7
8
from
jsk_recognition_msgs.msg
import
PolygonArray
9
10
11
class
TestPolygonArrayLikelihoodFilter
(TestCase):
12
def
polygon_cb
(self, msg):
13
self.
msg
= msg
14
15
def
test_filter
(self):
16
self.
msg
=
None
17
self.
sub_polygon
= rospy.Subscriber(
"/polygon_array_likelihood_filter/output_polygons"
,
18
PolygonArray, self.
polygon_cb
)
19
20
for
i
in
range(30):
21
if
self.
msg
is
not
None
:
22
self.sub_polygon.unregister()
23
break
24
rospy.sleep(1.0)
25
self.assertIsNotNone(self.
msg
,
"No message received for 30 seconds"
)
26
27
self.assertEqual(len(self.msg.polygons), 2,
28
"polygons that have likelihood more than 0.8 are 2"
)
29
for
l
in
self.msg.likelihood:
30
self.assertGreaterEqual(l, 0.8,
"likelihood is greater equal 0.8"
)
31
32
33
if
__name__ ==
'__main__'
:
34
import
rostest
35
rospy.init_node(
"test_polygon_array_likelihood_filter"
)
36
rostest.rosrun(
"jsk_pcl_ros_utils"
,
"polygon_array_likelihood_filter"
, TestPolygonArrayLikelihoodFilter)
test_polygon_array_likelihood_filter.TestPolygonArrayLikelihoodFilter.msg
msg
Definition:
test_polygon_array_likelihood_filter.py:13
test_polygon_array_likelihood_filter.TestPolygonArrayLikelihoodFilter.test_filter
def test_filter(self)
Definition:
test_polygon_array_likelihood_filter.py:15
test_polygon_array_likelihood_filter.TestPolygonArrayLikelihoodFilter.polygon_cb
def polygon_cb(self, msg)
Definition:
test_polygon_array_likelihood_filter.py:12
test_polygon_array_likelihood_filter.TestPolygonArrayLikelihoodFilter
Definition:
test_polygon_array_likelihood_filter.py:11
test_polygon_array_likelihood_filter.TestPolygonArrayLikelihoodFilter.sub_polygon
sub_polygon
Definition:
test_polygon_array_likelihood_filter.py:17
jsk_pcl_ros_utils
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:15