コード例 #1
0
 public SubscriberCallbacks(SubscriberStatusCallback connectCB, SubscriberStatusCallback disconnectCB,
     CallbackQueueInterface Callback)
 {
     connect = connectCB;
     disconnect = disconnectCB;
     this.Callback = Callback;
 }
コード例 #2
0
        public AdvertiseOptions(
            string topic,
            int queueSize,
            string md5Sum,
            string dataType,
            string messageDefinition,
            SubscriberStatusCallback connectcallback    = null,
            SubscriberStatusCallback disconnectcallback = null,
            ICallbackQueue callbackQueue = null
            )
        {
            this.topic         = topic;
            this.md5Sum        = md5Sum;
            this.queueSize     = queueSize;
            this.callbackQueue = callbackQueue;

            T tt = new T();

            this.dataType          = dataType.Length > 0 ? dataType : tt.MessageType;
            this.messageDefinition = string.IsNullOrEmpty(messageDefinition) ? tt.MessageDefinition() : messageDefinition;
            this.hasHeader         = tt.HasHeader();

            this.connectCB    = connectcallback;
            this.disconnectCB = disconnectcallback;
        }
コード例 #3
0
        public AdvertiseOptions(string t, int q_size, string md5, string dt, string message_def,
                                SubscriberStatusCallback connectcallback,
                                SubscriberStatusCallback disconnectcallback)
        {
            topic      = t;
            queue_size = q_size;
            md5sum     = md5;
            T tt = new T();

            if (dt.Length > 0)
            {
                datatype = dt;
            }
            else
            {
                datatype = tt.msgtype.ToString().Replace("__", "/");
            }
            if (message_def.Length == 0)
            {
                message_definition = tt.MessageDefinition;
            }
            else
            {
                message_definition = message_def;
            }
            has_header   = tt.HasHeader;
            connectCB    = connectcallback;
            disconnectCB = disconnectcallback;
        }
コード例 #4
0
 public SubscriberCallbacks(SubscriberStatusCallback connectCB, SubscriberStatusCallback disconnectCB,
                            CallbackQueueInterface Callback)
 {
     connect       = connectCB;
     disconnect    = disconnectCB;
     this.Callback = Callback;
 }
コード例 #5
0
ファイル: NodeHandle.cs プロジェクト: IAmUser4574/ROS.NET
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks, specify latching.
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queue_size">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectcallback">Callback to fire when this node connects</param>
 /// <param name="disconnectcallback">Callback to fire when this node disconnects</param>
 /// <param name="l">Boolean determines whether the given publisher will latch or not</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public Publisher <M> advertise <M>(string topic, int queue_size, SubscriberStatusCallback connectcallback,
                                    SubscriberStatusCallback disconnectcallback, bool l)
     where M : IRosMessage, new()
 {
     return(advertise(new AdvertiseOptions <M>(topic, queue_size, connectcallback, disconnectcallback)
     {
         latch = l
     }));
 }
コード例 #6
0
        Publisher <M> queue_advertise <M> (string topic, uint queue_size, SubscriberStatusCallback connect_cb, SubscriberStatusCallback disconnect_cb, CallbackQueueInterface queue) where M : IRosMessage, new()
        {
            AdvertiseOptions <M> ops = new AdvertiseOptions <M> (topic, (int)queue_size, connect_cb, disconnect_cb);

//			ops.tracked_object = ros::VoidPtr();
            ops.latch          = false;
            ops.callback_queue = queue;
            return(nodeHandle.advertise(ops));
        }
コード例 #7
0
 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
     });
 }
コード例 #8
0
 public AdvertiseOptions(string t, int q_size, SubscriberStatusCallback connectcallback,
                         SubscriberStatusCallback disconnectcallback) :
     this(
         t, q_size, new T().MD5Sum,
         new T().msgtype.ToString().Replace("__", "/"),
         new T().MessageDefinition,
         connectcallback, disconnectcallback)
 {
 }
コード例 #9
0
 public SubscriberCallbacks(
     SubscriberStatusCallback connectCB,
     SubscriberStatusCallback disconnectCB,
     ICallbackQueue callbackQueue
     )
 {
     this.connect       = connectCB;
     this.disconnect    = disconnectCB;
     this.CallbackQueue = callbackQueue;
 }
コード例 #10
0
 public SubscriberCallbacks(
     SubscriberStatusCallback onConnect,
     SubscriberStatusCallback onDisconnect,
     ICallbackQueue callbackQueue
     )
 {
     this.OnConnect     = onConnect;
     this.OnDisconnect  = onDisconnect;
     this.CallbackQueue = callbackQueue;
 }
コード例 #11
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queue_size">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectcallback">Callback to fire when this node connects</param>
 /// <param name="disconnectcallback">Callback to fire when this node disconnects</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public Publisher <M> advertise <M>(string topic, int queue_size, SubscriberStatusCallback connectcallback,
                                    SubscriberStatusCallback disconnectcallback)
     where M : IRosMessage, new()
 {
     if (started_by_visual_studio)
     {
         return(null);
     }
     return(advertise <M>(topic, queue_size, connectcallback, disconnectcallback, false));
 }
コード例 #12
0
ファイル: AdvertiseOptions.cs プロジェクト: cephdon/ROS.NET
        public AdvertiseOptions(string t, int q_size, string md5, string dt, string message_def,
                                SubscriberStatusCallback connectcallback,
                                SubscriberStatusCallback disconnectcallback)
        {
            topic      = t;
            queue_size = q_size;
            md5sum     = md5;
            T tt = new T();

            if (dt.Length > 0)
            {
                datatype = dt;
            }
            else
            {
                datatype = tt.msgtype.ToString().Replace("__", "/");
            }
            if (message_def.Length == 0)
            {
                message_definition = tt.MessageDefinition;
            }
            else
            {
                message_definition = message_def;
            }
            List <Type>         visited  = new List <Type>();
            Queue <IRosMessage> frontier = new Queue <IRosMessage>();
            IRosMessage         current  = tt;

            do
            {
                if (frontier.Count > 0)
                {
                    current             = frontier.Dequeue();
                    message_definition += "\n================================================================================\nMSG: " + current.msgtype.ToString().Replace("__", "/") + "\n" + current.MessageDefinition;
                }
                foreach (MsgFieldInfo fi in current.Fields.Values)
                {
                    if (fi.message_type == MsgTypes.Unknown)
                    {
                        continue;
                    }
                    IRosMessage field = IRosMessage.generate(fi.message_type);
                    if (field != null && fi.IsMetaType && !visited.Contains(fi.Type))
                    {
                        frontier.Enqueue(field);
                        visited.Add(fi.Type);
                    }
                }
            } while (frontier.Count > 0);
            has_header   = tt.HasHeader;
            connectCB    = connectcallback;
            disconnectCB = disconnectcallback;
        }
コード例 #13
0
 public static AdvertiseOptions <M> Create <M>(
     string topic,
     int queueSize,
     SubscriberStatusCallback connectcallback,
     SubscriberStatusCallback disconnectcallback,
     ICallbackQueue callbackQueue
     )
     where M : RosMessage, new()
 {
     return(new AdvertiseOptions <M>(topic, queueSize, connectcallback, disconnectcallback, callbackQueue));
 }
コード例 #14
0
 public AdvertiseOptions(
     string topic,
     int queueSize,
     SubscriberStatusCallback connectCallback,
     SubscriberStatusCallback disconnectCallback,
     ICallbackQueue callbackQueue = null
     )
     : this(
         topic,
         queueSize,
         new T().MD5Sum(),
         new T().MessageType,
         new T().MessageDefinition(),
         connectCallback,
         disconnectCallback
         )
 {
 }
コード例 #15
0
ファイル: Publication.cs プロジェクト: uml-robotics/ROS.NET
 public PeerConnDisconnCallback(SubscriberStatusCallback callback, SubscriberLink sub_link)
 {
     this.callback = callback;
     this.sub_link = sub_link;
 }
コード例 #16
0
 public Publisher <M> Advertise <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                    SubscriberStatusCallback disconnectCallback, bool latch) where M : RosMessage, new() =>
 AdvertiseAsync <M>(topic, queueSize, connectCallback, disconnectCallback, latch).Result;
コード例 #17
0
ファイル: Publication.cs プロジェクト: wiwing/ROS.NET
 public PeerConnDisconnCallback(SubscriberStatusCallback callback, SubscriberLink subscriberLink)
 {
     this.callback       = callback;
     this.subscriberLink = subscriberLink;
 }
コード例 #18
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks, specify latching.
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queueSize">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectCallback">Callback to fire when this node connects</param>
 /// <param name="disconnectCallback">Callback to fire when this node disconnects</param>
 /// <param name="latch">Boolean determines whether the given publisher will latch or not</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public async Task <Publisher <M> > AdvertiseAsync <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                                       SubscriberStatusCallback disconnectCallback, bool latch)
     where M : RosMessage, new()
 {
     return(await AdvertiseAsync(new AdvertiseOptions <M>(topic, queueSize, connectCallback, disconnectCallback) { Latch = latch }));
 }
コード例 #19
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queueSize">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectCallback">Callback to fire when this node connects</param>
 /// <param name="disconnectCallback">Callback to fire when this node disconnects</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public async Task <Publisher <M> > AdvertiseAsync <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                                       SubscriberStatusCallback disconnectCallback)
     where M : RosMessage, new()
 {
     return(await AdvertiseAsync <M>(topic, queueSize, connectCallback, disconnectCallback, false));
 }
コード例 #20
0
 public AdvertiseOptions(string t, int q_size, string md5, string dt, string message_def,
                         SubscriberStatusCallback connectcallback)
     : this(t, q_size, md5, dt, message_def, connectcallback, null)
 {
 }
コード例 #21
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queueSize">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectCallback">Callback to fire when this node connects</param>
 /// <param name="disconnectCallback">Callback to fire when this node disconnects</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public Publisher <M> advertise <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                    SubscriberStatusCallback disconnectCallback)
     where M : RosMessage, new()
 {
     return(advertise <M>(topic, queueSize, connectCallback, disconnectCallback, false));
 }