Esempio n. 1
0
        private void Construct(string ns, bool validate_name)
        {
            if (!ROS.initialized)
            {
                throw new Exception("You must call ROS.Init() before instantiating the first nodehandle");
            }

            collection          = new NodeHandleBackingCollection();
            UnresolvedNamespace = ns;
            Namespace           = validate_name ? ResolveName(ns) : ResolveName(ns, true, true);

            OK = true;
            lock (gate)
            {
                if (referenceCount == 0 && !ROS.IsStarted())
                {
                    initializedRos = true;
                    ROS.Start();
                }
                ++referenceCount;
            }
        }
Esempio n. 2
0
        private SimTime()
        {
            new Thread(() =>
            {
                try
                {
                    while (!ROS.IsStarted() && !ROS.ShuttingDown)
                    {
                        Thread.Sleep(100);
                    }

                    if (!ROS.ShuttingDown)
                    {
                        nodeHandle        = new NodeHandle();
                        simTimeSubscriber = nodeHandle.Subscribe <Clock>("/clock", 1, SimTimeCallback);
                    }
                }
                catch (Exception e)
                {
                    logger.LogError(e, "Caught exception in sim time thread: " + e.Message);
                }
            }).Start();
        }