Пример #1
0
        void StartPalms()
        {
            leftPalm = TfListener.GetOrCreateFrame($"{MyId}/controller/left_palm");
            leftPalm.transform.localScale = 0.05f * Vector3.one;

            leftPalm    = TfListener.GetOrCreateFrame($"{MyId}/controller/left_hand");
            node        = FrameNode.Instantiate("Hololens");
            node.Parent = leftPalm;

            leftPalmPose = new Pose(Vector3.up * 1f, Quaternion.identity);
            leftPalm.SetPose(leftPalmPose);
            leftPalm.ParentCanChange = false;

            LeftHandScale = 0.1f;
        }
Пример #2
0
        public TfModuleData([NotNull] ModuleDataConstructor constructor) :
            base(constructor.GetConfiguration <TfConfiguration>()?.Topic ?? constructor.Topic,
                 constructor.Type)
        {
            panel    = DataPanelManager.GetPanelByResourceType <TfPanelContents>(ModuleType.TF);
            listener = new TfListener(this);
            if (constructor.Configuration != null)
            {
                listener.Config = (TfConfiguration)constructor.Configuration;
            }
            else
            {
                listener.Config.Topic = Topic;
            }

            listener.StartListening();
            UpdateModuleButton();
        }
Пример #3
0
        void Update()
        {
            if (highlightFrameStart == null)
            {
                return;
            }

            float srcAlpha = 1 - (Time.time - highlightFrameStart.Value) / HighlightDuration;

            if (srcAlpha < 0)
            {
                this.ReturnToPool();
                return;
            }

            float alpha = Mathf.Sqrt(srcAlpha);
            var   color = Color.white.WithAlpha(alpha);

            axisResource.Tint       = color;
            tooltip.CaptionColor    = color;
            tooltip.BackgroundColor = Resource.Colors.HighlighterBackground.WithAlpha(alpha);

            var(pX, pY, pZ) = TfListener.RelativePositionToFixedFrame(node.Transform.position).Unity2RosVector3();
            string px = pX.ToString("#,0.##", UnityUtils.Culture);
            string py = pY.ToString("#,0.##", UnityUtils.Culture);
            string pz = pZ.ToString("#,0.##", UnityUtils.Culture);

            StringBuilder str = BuilderPool.Rent();

            try
            {
                str.Append("<font=Bold>").Append(node.ParentId).Append("</font>\n");
                str.Append(px).Append(", ").Append(py).Append(", ").Append(pz);
                tooltip.SetCaption(str);
            }
            finally
            {
                BuilderPool.Return(str);
            }
        }