Esempio n. 1
0
            public ToStringVisual(string topic, MessageSubtopic subtopic)
            {
                ROSConnection ros   = ROSConnection.GetOrCreateInstance();
                RosTopicState state = ros.GetTopic(topic);

                if (subtopic == MessageSubtopic.Response)
                {
                    state = state.ServiceResponseTopic;
                }
                state.AddSubscriber(AddMessage);
            }
Esempio n. 2
0
        void OnNewTopic(RosTopicState state)
        {
            VisualizationTopicsTabEntry vis;

            if (!m_Topics.TryGetValue(state.Topic, out vis))
            {
                vis = new VisualizationTopicsTabEntry(state, m_FillTexture);
                m_Topics.Add(state.Topic, vis);
                m_TopicsSorted = null;
            }
        }
Esempio n. 3
0
        public VisualizationTopicsTabEntry(RosTopicState baseState, Texture2D background)
        {
            m_TopicState = baseState;
            m_Background = background;

            if (baseState.ServiceResponseTopic != null)
            {
                m_ServiceResponseTopic = new VisualizationTopicsTabEntry(baseState.ServiceResponseTopic, background);
            }

            m_CachedRosMessageName = RosMessageName;
        }
            public MarkersVisual(string topic)
            {
                ROSConnection ros   = ROSConnection.GetOrCreateInstance();
                RosTopicState state = ros.GetTopic(topic);

                if (state.RosMessageName == MarkerArrayMsg.k_RosMessageName)
                {
                    ros.Subscribe <MarkerArrayMsg>(topic, OnMarkerArray);
                }
                else if (state.RosMessageName == MarkerMsg.k_RosMessageName)
                {
                    ros.Subscribe <MarkerMsg>(topic, OnMarker);
                }
            }
Esempio n. 5
0
        void LoadLayout(HUDLayoutSave saveState)
        {
            foreach (var savedRule in saveState.Rules)
            {
                RosTopicState topicState = m_Connection.GetOrCreateTopic(savedRule.Topic, savedRule.RosMessageName, savedRule.IsService);
                VisualizationTopicsTabEntry vis;
                if (!m_Topics.TryGetValue(savedRule.Topic, out vis))
                {
                    vis = new VisualizationTopicsTabEntry(topicState, m_FillTexture);
                    m_Topics.Add(savedRule.Topic, vis);
                }

                vis.LoadSaveState(savedRule);
            }
        }
Esempio n. 6
0
        public static IVisual GetVisual(string topic, MessageSubtopic subtopic = MessageSubtopic.Default)
        {
            RosTopicState topicState = ROSConnection.GetOrCreateInstance().GetTopic(topic);

            if (topicState != null && subtopic == MessageSubtopic.Response)
            {
                topicState = topicState.ServiceResponseTopic;
            }

            if (topicState == null)
            {
                return(null);
            }

            IVisualFactory factory = VisualFactoryRegistry.GetVisualFactory(topic, topicState.RosMessageName, subtopic);

            if (factory == null)
            {
                return(null);
            }

            return(factory.GetOrCreateVisual(topic));
        }