コード例 #1
0
ファイル: _Init.cs プロジェクト: YaseenAlk/ROS.NET
        /// <summary>
        ///     Finishes intialization This is called by the first NodeHandle when it initializes
        /// </summary>
        internal static void Start()
        {
            lock (startMutex)
            {
                if (started)
                {
                    return;
                }

                RaiseRosStarting();

                ServiceManager.Reset();
                XmlRpcManager.Reset();
                TopicManager.Reset();
                ConnectionManager.Reset();

                XmlRpcManager.Instance.Bind("shutdown", ShutdownCallback);
                TopicManager.Instance.Start();
                ServiceManager.Instance.Start();
                ConnectionManager.Instance.Start();
                XmlRpcManager.Instance.Start();

                shuttingDown = false;
                started      = true;
                _ok          = true;

                RaiseRosStarted();
            }
        }
コード例 #2
0
ファイル: _Init.cs プロジェクト: YaseenAlk/ROS.NET
        /// <summary>
        /// Internal ROS deinitialization method. Called by checkForShutdown.
        /// </summary>
        private static void _shutdown()
        {
            if (started)
            {
                logger.LogInformation("ROS is shutting down.");
                RaiseRosShuttingDown();

                SimTime.Terminate();
                RosOutAppender.Terminate();
                GlobalNodeHandle.Shutdown().Wait();
                GlobalCallbackQueue.Disable();
                GlobalCallbackQueue.Clear();

                XmlRpcManager.Instance.Unbind("shutdown");
                Param.Terminate();

                TopicManager.Terminate();
                ServiceManager.Terminate();
                XmlRpcManager.Terminate();
                ConnectionManager.Terminate();

                lock (startMutex)
                {
                    started = false;
                    ResetStaticMembers();
                }

                RaiseRosShutDown();
            }
        }
コード例 #3
0
 public void Start()
 {
     shuttingDown      = false;
     pollManager       = PollManager.Instance;
     connectionManager = ConnectionManager.Instance;
     xmlrpcManager     = XmlRpcManager.Instance;
 }
コード例 #4
0
        private void RequestTopicCallback(XmlRpcValue parm, XmlRpcValue res)
        {
            string topic = parm[1].GetString();

            if (!RequestTopic(topic, parm[2], ref res))
            {
                const string error = "Unknown error while handling XmlRpc call to requestTopic";
                this.logger.LogError(error);
                XmlRpcManager.ResponseInt(0, error, 0)(res);
            }
        }
コード例 #5
0
 private void requestTopicCallback(XmlRpcValue parm, XmlRpcValue res)
 {
     //XmlRpcValue res = XmlRpcValue.Create(ref result)
     //	, parm = XmlRpcValue.Create(ref parms);
     //result = res.instance;
     if (!requestTopic(parm[1].GetString(), parm[2], ref res))
     {
         string error = $"[{ThisNode.Name}] Unknown error while handling XmlRpc call to requestTopic";
         ROS.Error()(error);
         XmlRpcManager.ResponseInt(0, error, 0)(res);
     }
 }
コード例 #6
0
ファイル: TopicManager.cs プロジェクト: wiwing/ROS.NET
 private void RequestTopicCallback(XmlRpcValue parm, XmlRpcValue res)
 {
     //XmlRpcValue res = XmlRpcValue.Create(ref result)
     //	, parm = XmlRpcValue.Create(ref parms);
     //result = res.instance;
     if (!RequestTopic(parm[1].GetString(), parm[2], ref res))
     {
         const string error = "Unknown error while handling XmlRpc call to requestTopic";
         this.logger.LogError(error);
         XmlRpcManager.ResponseInt(0, error, 0)(res);
     }
 }
コード例 #7
0
ファイル: _Init.cs プロジェクト: YaseenAlk/ROS.NET
        /// <summary>
        ///     This is called when rosnode kill is invoked
        /// </summary>
        /// <param name="p"> pointer to unmanaged XmlRpcValue containing params </param>
        /// <param name="r"> pointer to unmanaged XmlRpcValue that will contain return value </param>
        private static void ShutdownCallback(XmlRpcValue parms, XmlRpcValue r)
        {
            int num_params = 0;

            if (parms.Type == XmlRpcType.Array)
            {
                num_params = parms.Count;
            }
            if (num_params > 1)
            {
                string reason = parms[1].GetString();
                logger.LogInformation("Shutdown request received.");
                logger.LogInformation("Reason given for shutdown: [" + reason + "]");
                Shutdown();
            }
            XmlRpcManager.ResponseInt(1, "", 0)(r);
        }
コード例 #8
0
        private void publisherUpdateCallback(XmlRpcValue parm, XmlRpcValue result)
        {
            var pubs = new List <string>();

            for (int idx = 0; idx < parm[2].Count; idx++)
            {
                pubs.Add(parm[2][idx].GetString());
            }
            if (pubUpdate(parm[1].GetString(), pubs))
            {
                XmlRpcManager.ResponseInt(1, "", 0)(result);
            }
            else
            {
                string error = $"[{ThisNode.Name}] Unknown error while handling XmlRpc call to pubUpdate";
                ROS.Error()(error);
                XmlRpcManager.ResponseInt(0, error, 0)(result);
            }
        }
コード例 #9
0
ファイル: TopicManager.cs プロジェクト: wiwing/ROS.NET
        private void PublisherUpdateCallback(XmlRpcValue parm, XmlRpcValue result)
        {
            var pubs = new List <string>();

            for (int idx = 0; idx < parm[2].Count; idx++)
            {
                pubs.Add(parm[2][idx].GetString());
            }
            var pubUpdateTask = PubUpdate(parm[1].GetString(), pubs);

            pubUpdateTask.WhenCompleted().WhenCompleted().Wait();
            if (pubUpdateTask.IsCompletedSuccessfully && pubUpdateTask.Result)
            {
                XmlRpcManager.ResponseInt(1, "", 0)(result);
            }
            else
            {
                const string error = "Unknown error while handling XmlRpc call to pubUpdate";
                this.logger.LogError(error);
                XmlRpcManager.ResponseInt(0, error, 0)(result);
            }
        }
コード例 #10
0
        private void PublisherUpdateCallback(XmlRpcValue parm, XmlRpcValue result)
        {
            string        topic           = parm[1].GetString();
            List <string> publicationUris = parm[2].Select(x => x.GetString()).ToList();

            this.logger.LogDebug($"PublisherUpdateCallback for topic '{topic}' with URIs: {string.Join(", ", publicationUris)}");

            var pubUpdateTask = PubUpdate(topic, publicationUris);

            pubUpdateTask.WhenCompleted().WhenCompleted().Wait();

            if (pubUpdateTask.HasCompletedSuccessfully() && pubUpdateTask.Result)
            {
                XmlRpcManager.ResponseInt(1, "", 0)(result);
            }
            else
            {
                const string error = "Unknown error while handling XmlRpc call to pubUpdate";
                this.logger.LogError(error);
                XmlRpcManager.ResponseInt(0, error, 0)(result);
            }
        }
コード例 #11
0
 public void Start()
 {
     connectionManager = ConnectionManager.Instance;
     xmlRpcManager     = XmlRpcManager.Instance;
 }