self.assertFalse(timeout_t < time.time(), "timeout exceeded")
        self.assertFalse(rospy.is_shutdown(), "node shutdown")            
        self.assertFalse(self.fixture_curr is None, "no data from fixture")
        m = self.fixture_curr
        self.assertAlmostEqual(m.a.x, m.b.x)
        self.assertAlmostEqual(m.a.y, m.b.y)
        self.assertAlmostEqual(m.a.z, m.b.z)

        # another 20 seconds to validate client
        timeout_t = time.time() + 20.
        print("waiting for 20 seconds for client to verify")
        while self.test_curr is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.assertFalse(self.test_curr is None, "no data from test")
        m = self.test_curr
        self.assertAlmostEqual(m.a.x, m.b.x)
        self.assertAlmostEqual(m.a.y, m.b.y)
        self.assertAlmostEqual(m.a.z, m.b.z)

        # a.w = a.x + a.y + a.z.  Just make sure we're in the ballpark
        a = self.test_curr.a
        self.assertTrue(abs(a.x + a.y + a.z - a.w) < 10.)

if __name__ == '__main__':
    import rostest
    rostest.run(PKG, NAME, CompositePassthrough, sys.argv)
        print "waiting for 20 seconds for fixture to verify"
        while self.fixture_curr is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.failIf(timeout_t < time.time(), "timeout exceeded")
        self.failIf(rospy.is_shutdown(), "node shutdown")            
        self.failIf(self.fixture_curr is None, "no data from fixture")
        self.assertEquals('/node0', self.fixture_curr.caller_id)
        self.assertEquals('', self.fixture_curr.orig_caller_id)

        # another 20 seconds to validate client
        timeout_t = time.time() + 20.
        print "waiting for 20 seconds for client to verify"
        while self.test_curr is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.failIf(self.test_curr is None, "no data from test")
        self.assertEquals('/rosjava_node', self.test_curr.caller_id)
        self.assertEquals('/node0', self.test_curr.orig_caller_id)
        t = self.test_curr.header.stamp.to_sec()
        # be really generous here, just need to be in the ballpark.
        self.assert_(abs(time.time() - t) < 60.)

if __name__ == '__main__':
    import rostest
    rostest.run(PKG, NAME, TestHeaderPassthrough, sys.argv)
Beispiel #3
0
        self.failIf(timeout_t < time.time(), "timeout exceeded")
        self.failIf(rospy.is_shutdown(), "node shutdown")            
        self.assertEquals(self.nodes_set, self.fixture_nodes_cb, "fixture did not validate: %s vs %s"%(self.nodes_set, self.fixture_nodes_cb))

        # another 20 seconds to validate client
        timeout_t = time.time() + 20.
        print "waiting for 20 seconds for client to verify"
        while not self.test_nodes_cb == self.nodes_set and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.assertEquals(self.nodes_set, self.test_nodes_cb, "passthrough did not pass along all message")

        # Create a new Publisher here.  This will validate publisherUpdate()
        pub = rospy.Publisher('string_in', String)
        msg = 'test_publisherUpdate'
        timeout_t = time.time() + 20.
        print "waiting for 20 seconds for client to verify"
        while not msg in self.nodes_set and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            pub.publish(data=msg)
            time.sleep(0.2)

        

if __name__ == '__main__':
    import rostest
    rostest.run(PKG, NAME, TestStringPassthrough, sys.argv)
        self.failIf(timeout_t < time.time(), "timeout exceeded")
        self.failIf(rospy.is_shutdown(), "node shutdown")            
        self.failIf(self.fixture_curr is None, "no data from fixture")
        m = self.fixture_curr
        self.assertAlmostEquals(m.a.x, m.b.x)
        self.assertAlmostEquals(m.a.y, m.b.y)
        self.assertAlmostEquals(m.a.z, m.b.z)

        # another 20 seconds to validate client
        timeout_t = time.time() + 20.
        print "waiting for 20 seconds for client to verify"
        while self.test_curr is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.failIf(self.test_curr is None, "no data from test")
        m = self.test_curr
        self.assertAlmostEquals(m.a.x, m.b.x)
        self.assertAlmostEquals(m.a.y, m.b.y)
        self.assertAlmostEquals(m.a.z, m.b.z)

        # a.w = a.x + a.y + a.z.  Just make sure we're in the ballpark
        a = self.test_curr.a
        self.assert_(abs(a.x + a.y + a.z - a.w) < 10.)

if __name__ == '__main__':
    import rostest
    rostest.run(PKG, NAME, CompositePassthrough, sys.argv)
Beispiel #5
0
    def test_int64_passthrough(self):
        # 20 seconds to validate fixture
        timeout_t = time.time() + 20.
        print("waiting for 20 seconds for fixture to verify")
        while self.fixture_prev is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.assertFalse(timeout_t < time.time(), "timeout exceeded")
        self.assertFalse(rospy.is_shutdown(), "node shutdown")            
        self.assertFalse(self.fixture_prev is None, "no data from fixture")
        self.assertFalse(self.fixture_curr is None, "no data from fixture")
        self.assertEqual(self.fixture_prev.data + 1, self.fixture_curr.data, "fixture should incr by one")

        # another 20 seconds to validate client
        timeout_t = time.time() + 20.
        print("waiting for 20 seconds for client to verify")
        while self.test_prev is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.assertFalse(self.test_prev is None, "no data from test")
        self.assertEqual(self.test_prev.data + 1, self.test_curr.data, "test does not appear to match fixture data")


if __name__ == '__main__':
    import rostest
    rostest.run(PKG, NAME, TestInt64Passthrough, sys.argv)
        ns_source = rospy.get_param('parameter_namespace')
        ns_target = rospy.get_param('target_namespace')
        tests = self.tests
        for t in tests:
            source_name = roslib.names.ns_join(ns_source, t)
            target_name = roslib.names.ns_join(ns_target, t)
            source_value = rospy.get_param(source_name)
            target_value = rospy.get_param(target_name)
            if t != 'float':
                self.assertEquals(source_value, target_value)
            else:
                self.assertAlmostEquals(source_value, target_value)
        
    def test_tilde_parameter(self):
        timeout_t = time.time() + 20.
        print "waiting for 20 seconds for client to load"
        while self.tilde_msg is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.failIf(timeout_t < time.time(), "timeout exceeded")
        self.failIf(rospy.is_shutdown(), "node shutdown")            
        self.failIf(self.tilde_msg is None)
        
        self.assertEquals(rospy.get_param('param_client/tilde'), self.tilde_msg.data)

if __name__ == '__main__':
    import rostest
    rostest.run(PKG, NAME, TestParameterClient, sys.argv)
    def test_int64_passthrough(self):
        # 20 seconds to validate fixture
        timeout_t = time.time() + 20.
        print "waiting for 20 seconds for fixture to verify"
        while self.fixture_prev is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.failIf(timeout_t < time.time(), "timeout exceeded")
        self.failIf(rospy.is_shutdown(), "node shutdown")            
        self.failIf(self.fixture_prev is None, "no data from fixture")
        self.failIf(self.fixture_curr is None, "no data from fixture")
        self.assertEquals(self.fixture_prev.data + 1, self.fixture_curr.data, "fixture should incr by one")

        # another 20 seconds to validate client
        timeout_t = time.time() + 20.
        print "waiting for 20 seconds for client to verify"
        while self.test_prev is None and \
                not rospy.is_shutdown() and \
                timeout_t > time.time():
            time.sleep(0.2)

        self.failIf(self.test_prev is None, "no data from test")
        self.assertEquals(self.test_prev.data + 1, self.test_curr.data, "test does not appear to match fixture data")


if __name__ == '__main__':
    import rostest
    rostest.run(PKG, NAME, TestInt64Passthrough, sys.argv)