Beispiel #1
0
        private void SendAdvertiseOperation(ROSBridgePublisher subscriber)
        {
            string s = ROSBridgeMsg.Advertise(subscriber.Topic, ((IMsg)Activator.CreateInstance(subscriber.MessageType)).ROSMessageType);

            Debug.Log($"Sending: {s}");
            _ws?.Send(s);
        }
Beispiel #2
0
        private void SendUnAdvertiseOperation(ROSBridgePublisher publisher)
        {
            string s = ROSBridgeMsg.UnAdvertise(publisher.Topic);

            Debug.Log($"Sending: {s}");
            _ws?.Send(s);
        }
Beispiel #3
0
        public ROSBridgePublisher Advertise <T>(string topic) where T : IMsg
        {
            Type messageType = typeof(T);

            ThrowIfTopicExistsUnderDifferentType(topic, messageType, "advertise");

            ROSBridgePublisher publisher;

            if (!publishers.TryGetValue(topic, out publisher))
            {
                publisher = new ROSBridgePublisher(_ws, topic, messageType);
                publishers.Add(topic, publisher);
                CacheTopic(topic, messageType);
                SendAdvertiseOperation(publisher);
            }

            return(publisher);
        }