/// <summary> /// Initializes ROS so nodehandles and nodes can exist /// </summary> /// <param name="remapping_args"> dictionary of remapping args </param> /// <param name="name"> node name </param> /// <param name="options"> options? </param> internal static void Init(IDictionary remapping_args, string name, int options) { // if we haven't sunk our fangs into the processes jugular so we can tell // when it has stopped kicking, do so now if (!atexit_registered) { atexit_registered = true; Process.GetCurrentProcess().EnableRaisingEvents = true; Process.GetCurrentProcess().Exited += (o, args) => _shutdown(); } // this needs to exist for connections and stuff to happen if (GlobalCallbackQueue == null) { GlobalCallbackQueue = new CallbackQueue(); } // kick the tires and light the fires if (!initialized) { init_options = options; _ok = true; network.init(remapping_args); master.init(remapping_args); this_node.Init(name, remapping_args, options); Param.init(remapping_args); initialized = true; GlobalNodeHandle = new NodeHandle(this_node.Namespace, remapping_args); } }
public override void spin(CallbackQueue callbackInterface) { if (callbackInterface == null) callbackInterface = ROS.GlobalCallbackQueue; NodeHandle spinnerhandle = new NodeHandle(); while (spinnerhandle.ok) { callbackInterface.callAvailable(ROS.WallDuration); } }
public override void spin(CallbackQueue callbackInterface) { if (callbackInterface == null) { callbackInterface = ROS.GlobalCallbackQueue; } NodeHandle spinnerhandle = new NodeHandle(); while (spinnerhandle.ok) { callbackInterface.callAvailable(ROS.WallDuration); } }
private void destruct() { collection.Dispose(); collection = null; lock (nh_refcount_mutex) { --nh_refcount; } _callback = null; if (nh_refcount == 0 && node_started_by_nh) { ROS.shutdown(); } }
/// <summary> /// Creates a subscriber /// </summary> /// <typeparam name="M">Topic type</typeparam> /// <param name="topic">Topic name</param> /// <param name="queue_size">How many messages to qeueue</param> /// <param name="cb">Function to fire when a message is recieved</param> /// <param name="allow_concurrent_callbacks">Probably breaks things when true</param> /// <returns>A subscriber</returns> public Subscriber <M> subscribe <M>(string topic, uint queue_size, CallbackInterface cb, bool allow_concurrent_callbacks) where M : IRosMessage, new() { if (_callback == null) { _callback = ROS.GlobalCallbackQueue; } SubscribeOptions <M> ops = new SubscribeOptions <M>(topic, queue_size, cb.func) { callback_queue = _callback, allow_concurrent_callbacks = allow_concurrent_callbacks }; ops.callback_queue.addCallback(cb); return(subscribe(ops)); }
/// <summary> /// Creates a subscriber /// </summary> /// <typeparam name="M">Topic type</typeparam> /// <param name="topic">Topic name</param> /// <param name="queue_size">How many messages to qeueue</param> /// <param name="cb">Function to fire when a message is recieved</param> /// <param name="thisisveryverybad">internal use</param> /// <returns>A subscriber</returns> public Subscriber <M> subscribe <M>(string topic, uint queue_size, CallbackInterface cb, string thisisveryverybad) where M : IRosMessage, new() { if (_callback == null) { _callback = ROS.GlobalCallbackQueue; } SubscribeOptions <M> ops = new SubscribeOptions <M>(topic, queue_size, cb.func) { callback_queue = _callback }; ops.callback_queue.addCallback(cb); return(subscribe(ops)); }
public virtual void spin(CallbackQueue queue) { }
public static AdvertiseOptions <M> Create <M>(string topic, int q_size, SubscriberStatusCallback connectcallback, SubscriberStatusCallback disconnectcallback, CallbackQueue queue) where M : IRosMessage, new() { return(new AdvertiseOptions <M>(topic, q_size, connectcallback, disconnectcallback) { callback_queue = queue }); }