Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            Ros.MasterUri = new Uri("http://localhost:11311/");
            Ros.HostName = "localhost";
            Ros.TopicTimeout = 3000;
            Ros.XmlRpcTimeout = 3000;

            _container = new TopicContainer();
            var listener = new TcpRosListener(0);

            _slaveServer = new SlaveServer("test", 0, _container);
            _slaveServer.AddListener("test", listener);

            _slaveClient = new SlaveClient(_slaveServer.SlaveUri);
        }
Ejemplo n.º 3
0
        internal SlaveServer(string nodeId, int portNumber, TopicContainer topicContainer)
        {
            NodeId = nodeId;
            _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId);

            _topicContainer = topicContainer;
            _tcpRosListener = new Dictionary<string, TcpRosListener>();

            string slaveName = "slave" + Guid.NewGuid().ToString("N");

            _channel = new HttpServerChannel(slaveName, portNumber, new XmlRpcServerFormatterSinkProvider());
            var tmp = new Uri(_channel.GetChannelUri());

            SlaveUri = new Uri("http://" + Ros.HostName + ":" + tmp.Port + "/" + slaveName);

            ChannelServices.RegisterChannel(_channel, false);
            RemotingServices.Marshal(this, slaveName); //Marshalするときの名前に/を入れるとだめ。
        }
Ejemplo n.º 4
0
        public void AddSubscriber_AlreadyAdded()
        {
            var container = new TopicContainer();
            ISubscriber sub;

            container.HasSubscriber("sub1").Is(false);
            container.GetSubscribers().Count.Is(0);

            container.AddSubscriber(new Subscriber<std_msgs.String>("sub1", "test")).Is(true);
            container.HasSubscriber("sub1").Is(true);
            container.GetSubscribers().Count.Is(1);
            container.GetSubscriber("sub1", out sub).Is(true);

            container.AddSubscriber(new Subscriber<std_msgs.String>("sub1", "test")).Is(false);
            container.HasSubscriber("sub1").Is(true);
            container.GetSubscribers().Count.Is(1);
            container.GetSubscriber("sub1", out sub).Is(true);
        }
Ejemplo n.º 5
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);
        }