Exemplo n.º 1
0
 public RosTopicServer(string nodeId, string topicName, Uri slaveUri)
 {
     NodeId    = nodeId;
     _logger   = RosOutLogManager.GetCurrentNodeLogger(NodeId);
     TopicName = topicName;
     SlaveUri  = slaveUri;
 }
Exemplo n.º 2
0
        public RosTopicClient(string nodeId, string topicName)
        {
            Connected = false;
            NodeId    = nodeId;
            _logger   = RosOutLogManager.GetCurrentNodeLogger(NodeId);

            TopicName = topicName;
        }
Exemplo n.º 3
0
        public ServiceInstance(string nodeId, IService service, Socket s)
        {
            NodeId   = nodeId;
            _logger  = RosOutLogManager.GetCurrentNodeLogger(NodeId);
            _service = service;

            _client = new TcpRosClient(s);
        }
Exemplo n.º 4
0
        internal Subscriber(string topicName, string nodeId, bool nodelay = true)
        {
            NodeId    = nodeId;
            _logger   = RosOutLogManager.GetCurrentNodeLogger(NodeId);
            TopicName = topicName;
            var dummy = new TMessage();

            MessageType = dummy.MessageType;
            _nodelay    = nodelay;
        }
Exemplo n.º 5
0
        internal Publisher(string topicName, string nodeId, bool latching = false)
        {
            NodeId = nodeId;
            var dummy = new TMessage();

            TopicName   = topicName;
            MessageType = dummy.MessageType;

            _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId);

            _latching = latching;
        }
Exemplo n.º 6
0
        public ServiceProxy(string nodeId, string serviceName, TService service, TcpRosClient client)
        {
            NodeId  = nodeId;
            _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId);

            ServiceName = serviceName;
            Service     = service;
            _client     = client;

            Service.SetAction(Invoke);

            Service.Disposing += _ => DisposeAsync();
        }
Exemplo n.º 7
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するときの名前に/を入れるとだめ。
        }
Exemplo n.º 8
0
        public Node(string nodeId)
        {
            _disposed = false;

            NodeId = nodeId;

            _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId);

            if (_logger.IsDebugEnabled)
            {
                LogLevel = Log.DEBUG;
            }
            else if (_logger.IsInfoEnabled)
            {
                LogLevel = Log.INFO;
            }
            else if (_logger.IsWarnEnabled)
            {
                LogLevel = Log.WARN;
            }
            else if (_logger.IsErrorEnabled)
            {
                LogLevel = Log.ERROR;
            }
            else if (_logger.IsFatalEnabled)
            {
                LogLevel = Log.FATAL;
            }

            _masterClient          = new MasterClient(Ros.MasterUri);
            _parameterServerClient = new ParameterServerClient(Ros.MasterUri);

            _serviceProxyFactory = new ServiceProxyFactory(NodeId);

            _topicContainer = new TopicContainer();
            _slaveServer    = new SlaveServer(NodeId, 0, _topicContainer);

            _slaveServer.ParameterUpdated += SlaveServerOnParameterUpdated;

            _logger.InfoFormat("Create Node: {0}", nodeId);
        }
Exemplo n.º 9
0
        Task IParameter.InitializeAsync(string nodeId, string paramName, Uri slaveUri, ParameterServerClient client)
        {
            NodeId  = nodeId;
            _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId);

            Name      = paramName;
            _slaveUri = slaveUri;

            _parameterServerClient = client;

            return(_parameterServerClient.HasParamAsync(NodeId, Name)
                   .ContinueWith(task =>
            {
                if (task.Result)
                {
                    return _parameterServerClient.GetParamAsync(NodeId, Name);
                }
                else
                {
                    return _parameterServerClient.SetParamAsync(NodeId, Name, new XmlRpcStruct());
                }
            })
                   .Unwrap());
        }
Exemplo n.º 10
0
 public ServiceServer(string nodeId)
 {
     NodeId  = nodeId;
     _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId);
 }
Exemplo n.º 11
0
 public ServiceProxyFactory(string nodeId)
 {
     NodeId  = nodeId;
     _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId);
 }