예제 #1
0
    def test_get_publisher_unknown(self):
        topic = 'unknown_type'
        topic_type_str = self.topics_and_types[topic]

        pub_map = LanguageToMessageTranslator.get_publisher(
            topic, topic_type_str)

        self.assertIsNotNone(pub_map)
        self.assertEqual(0, len(pub_map))
예제 #2
0
    def test_get_publisher_float(self):
        topic = 'not/a/global/topic'
        topic_type_str = self.topics_and_types[topic]

        pub_map = LanguageToMessageTranslator.get_publisher(
            topic, topic_type_str)

        self.assertIsNotNone(pub_map)
        self.assertEqual(1, len(pub_map))
        self.assertTrue(topic in pub_map)

        pub = pub_map[topic]
        self.assertIsInstance(pub, rospy.Publisher)
        self.assertEqual('std_msgs/Float32', pub.type)