Esempio n. 1
0
 public SimTime()
 {
     new Thread(() =>
     {
         try
         {
             while (!ROS.isStarted() && !ROS.shutting_down)
             {
                 Thread.Sleep(100);
             }
             if (!ROS.shutting_down)
             {
                 nodeHandle        = new NodeHandle();
                 simTimeSubscriber = nodeHandle.subscribe <Clock>("/clock", 1, SimTimeCallback);
             }
         }
         catch (Exception e)
         {
             ROS.Error()($"[{ThisNode.Name}] Caught exception in sim time thread: {e.Message}");
         }
     }).Start();
 }
Esempio n. 2
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;
            }
        }