Ejemplo n.º 1
0
 public void DrawEffort(Drawing3d drawing, JointPlacement[] placements, Color color, double[] radii)
 {
     for (int i = 0; i < placements.Length; i++)
     {
         VisualizationUtils.DrawRotationArrow(drawing, placements[i].Rotation, placements[i].Position, color, (float)radii[i]);
     }
 }
        public static void Draw <C>(QuaternionMsg message, Drawing3d drawing, GameObject drawAtPosition = null, float size = 0.1f, bool drawUnityAxes = false)
            where C : ICoordinateSpace, new()
        {
            Vector3 position = drawAtPosition != null ? drawAtPosition.transform.position : Vector3.zero;

            VisualizationUtils.DrawAxisVectors <C>(drawing, position.To <C>(), message, size, drawUnityAxes);
        }
Ejemplo n.º 3
0
        public void Start()
        {
            m_FillTexture = VisualizationUtils.MakeTexture(16, 16, new Color(0.125f, 0.19f, 0.25f));

            m_Connection = ROSConnection.GetOrCreateInstance();
            HudPanel.RegisterTab(this, (int)HudTabOrdering.Topics);
            HudPanel.RegisterTab(new VisualizationLayoutTab(this), (int)HudTabOrdering.Layout);
            LoadLayout();
            m_Connection.ListenForTopics(OnNewTopic, notifyAllExistingTopics: true);
        }
            public void AddMessage(Message message)
            {
                if (!VisualizationUtils.AssertMessageType <T>(message, m_Topic))
                {
                    return;
                }

                this.message = (T)message;
                this.meta    = new MessageMetadata(m_Topic, Time.time, DateTime.Now);
                m_GUIAction  = null;
            }
Ejemplo n.º 5
0
        public override void Draw(Drawing3d drawing, IEnumerable <Tuple <PointMsg, MessageMetadata> > messages)
        {
            Vector3 prevPoint = Vector3.zero;
            Color   color     = Color.white;
            string  label     = "";

            MessageMetadata meta = messages.FirstOrDefault().Item2;

            color = VisualizationUtils.SelectColor(m_Color, meta);
            label = VisualizationUtils.SelectLabel(m_Label, meta);
            drawing.DrawPath(messages.Select(tuple => tuple.Item1.From <FLU>()), color, m_Thickness);
            drawing.DrawLabel(label, prevPoint, color);
        }
            public void AddMessage(Message message)
            {
                if (!VisualizationUtils.AssertMessageType <T>(message, m_Topic))
                {
                    return;
                }

                this.message = (T)message;
                this.meta    = meta;
                m_Texture2D  = null;
                m_GUIAction  = null;

                // notify anyone who requested updates when the texture changes
                foreach (Action <Texture2D> callback in m_OnChangeCallbacks)
                {
                    callback(GetTexture());
                }
            }
            public virtual void AddMessage(Message message)
            {
                MessageMetadata meta = new MessageMetadata(m_Topic, Time.time, DateTime.Now);

                if (!VisualizationUtils.AssertMessageType <T>(message, m_Topic))
                {
                    return;
                }

                m_Message   = (T)message;
                m_Meta      = meta;
                m_GUIAction = null;

                // If messages are coming in faster than 1 per frame, we only update the drawing once per frame
                if (m_IsDrawingEnabled && Time.time > m_LastDrawingFrameTime)
                {
                    Redraw();
                }

                m_LastDrawingFrameTime = Time.time;
            }
        public void OnChanged(TFStream stream)
        {
            Drawing3d drawing;

            if (!drawings.TryGetValue(stream.Name, out drawing))
            {
                drawing = Drawing3d.Create();
                drawings[stream.Name] = drawing;
                if (stream.Parent != null)
                {
                    OnChanged(stream.Parent);
                    Drawing3d parentStream;
                    if (drawings.TryGetValue(stream.Parent.Name, out parentStream))
                    {
                        drawing.transform.parent = parentStream.transform;
                    }
                }
            }

            TFFrame frame = stream.GetLocalTF();

            drawing.transform.localPosition = frame.translation;
            drawing.transform.localRotation = frame.rotation;
            drawing.Clear();
            EnsureSettings(stream);
            if (m_ShowAxes[stream])
            {
                VisualizationUtils.DrawAxisVectors <FLU>(drawing, Vector3.zero.To <FLU>(), Quaternion.identity.To <FLU>(), axesScale, false);
            }

            if (m_ShowLinks[stream])
            {
                drawing.DrawLine(Quaternion.Inverse(frame.rotation) * -frame.translation, Vector3.zero, color, lineThickness);
            }

            if (m_ShowNames[stream])
            {
                drawing.DrawLabel(stream.Name, Vector3.zero, color);
            }
        }
Ejemplo n.º 9
0
 public override Action CreateGUI(TwistWithCovarianceStampedMsg message, MessageMetadata meta) => () =>
 {
     message.header.GUI();
     message.twist.twist.GUI();
     VisualizationUtils.GUIGrid(message.twist.covariance, 6, ref m_ViewCovariance);
 };
 public static void Draw <C>(TwistMsg message, Drawing3d drawing, Color color, Vector3 origin, float lengthScale = 1, float sphereRadius = 1, float thickness = 0.01f) where C : ICoordinateSpace, new()
 {
     drawing.DrawArrow(origin, origin + message.linear.From <C>() * lengthScale, color, thickness);
     VisualizationUtils.DrawAngularVelocityArrow(drawing, message.angular.From <C>(), origin, color, sphereRadius, thickness);
 }
 public static void Draw <C>(QuaternionMsg message, Drawing3d drawing, Vector3 position, float size = 0.1f, bool drawUnityAxes = false)
     where C : ICoordinateSpace, new()
 {
     VisualizationUtils.DrawAxisVectors <C>(drawing, position.To <C>(), message, size, drawUnityAxes);
 }
 public virtual Action CreateGUI(T message, MessageMetadata meta)
 {
     return(VisualizationUtils.CreateDefaultGUI(message, meta));
 }
 public string SelectLabel(string userLabel, MessageMetadata meta)
 {
     return(VisualizationUtils.SelectLabel(userLabel, meta));
 }
 public Color SelectColor(Color userColor, MessageMetadata meta)
 {
     return(VisualizationUtils.SelectColor(userColor, meta));
 }