Ejemplo n.º 1
0
    def test_do_advertise(self):
        proto = Protocol("hello")
        adv = Advertise(proto)
        topic = "/test_do_advertise"
        type = "std_msgs/String"

        msg = {"op": "advertise", "topic": topic, "type": type}
        adv.advertise(loads(dumps(msg)))
        self.assertTrue(self.is_topic_published(topic))
        adv.unadvertise(loads(dumps(msg)))
        self.assertFalse(self.is_topic_published(topic))
    def test_do_advertise(self):
        proto = Protocol("hello")
        adv = Advertise(proto)
        topic = "/test_do_advertise"
        type = "std_msgs/String"

        msg = {"op": "advertise", "topic": topic, "type": type}
        adv.advertise(loads(dumps(msg)))
        self.assertTrue(self.is_topic_published(topic))
        adv.unadvertise(loads(dumps(msg)))
        self.assertFalse(self.is_topic_published(topic))
Ejemplo n.º 3
0
    def test_valid_msg_classes(self):
        assortedmsgs = ["geometry_msgs/Pose", "actionlib_msgs/GoalStatus",
        "geometry_msgs/WrenchStamped", "stereo_msgs/DisparityImage",
        "nav_msgs/OccupancyGrid", "geometry_msgs/Point32", "std_msgs/String",
        "trajectory_msgs/JointTrajectoryPoint", "diagnostic_msgs/KeyValue",
        "visualization_msgs/InteractiveMarkerUpdate", "nav_msgs/GridCells",
        "sensor_msgs/PointCloud2"]

        proto = Protocol("hello")
        adv = Advertise(proto)

        for valid_type in assortedmsgs:
            msg = {"op": "advertise", "topic": "/" + valid_type,
                   "type": valid_type}
            adv.advertise(loads(dumps(msg)))
            adv.unadvertise(loads(dumps(msg)))
Ejemplo n.º 4
0
    def test_valid_msg_classes(self):
        assortedmsgs = [
            "geometry_msgs/Pose", "actionlib_msgs/GoalStatus",
            "geometry_msgs/WrenchStamped", "stereo_msgs/DisparityImage",
            "nav_msgs/OccupancyGrid", "geometry_msgs/Point32",
            "std_msgs/String", "trajectory_msgs/JointTrajectoryPoint",
            "diagnostic_msgs/KeyValue",
            "visualization_msgs/InteractiveMarkerUpdate", "nav_msgs/GridCells",
            "sensor_msgs/PointCloud2"
        ]

        proto = Protocol("hello")
        adv = Advertise(proto)

        for valid_type in assortedmsgs:
            msg = {
                "op": "advertise",
                "topic": "/" + valid_type,
                "type": valid_type
            }
            adv.advertise(loads(dumps(msg)))
            adv.unadvertise(loads(dumps(msg)))