Example #1
0
        public void AddPublisher_AlreadyAdded()
        {
            var container = new TopicContainer();
            IPublisher pub;

            container.HasPublisher("pub1").Is(false);
            container.GetPublishers().Count.Is(0);

            container.AddPublisher(new Publisher<std_msgs.String>("pub1", "test")).Is(true);
            container.HasPublisher("pub1").Is(true);
            container.GetPublishers().Count.Is(1);
            container.GetPublisher("pub1", out pub).Is(true);

            container.AddPublisher(new Publisher<std_msgs.String>("pub1", "test")).Is(false);
            container.HasPublisher("pub1").Is(true);
            container.GetPublishers().Count.Is(1);
            container.GetPublisher("pub1", out pub).Is(true);
        }
Example #2
0
        public void Initialize()
        {
            Ros.MasterUri = new Uri("http://localhost:11311/");
            Ros.HostName = "localhost";

            var topicContainer = new TopicContainer();
            topicContainer.AddPublisher(new Publisher<std_msgs.String>("/test_topic", "test"));

            var tcpListener = new TcpRosListener(0);
            _slaveServer = new SlaveServer("test", 0, topicContainer);
            _slaveServer.AddListener("/test_topic", tcpListener);
        }