コード例 #1
0
        internal void UpdateRobotStatus()
        {
            if (bot == null)
            {
                ResetRobotStatus();
                return;
            }

            uiContext.Post(x =>
            {
                MVector pos   = bot.GetCurrentPosition();
                string posStr = pos?.ToString(true) ?? "-";
                lbl_Status_TCP_Position_Value.Content = posStr;

                MOrientation ori = bot.GetCurrentRotation();
                string oriStr    = ori?.ToString(true) ?? "-";
                lbl_Status_TCP_Orientation_Value.Content = oriStr;

                Joints axes    = bot.GetCurrentAxes();
                string axesStr = axes?.ToString(true) ?? "-";
                lbl_Status_Axes_Value.Content = axesStr;

                ExternalAxes extax = bot.GetCurrentExternalAxes();
                bool nullext       = true;
                if (extax != null)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        if (extax[i] != null)
                        {
                            nullext = false;
                            break;
                        }
                    }
                }
                lbl_Status_Ext_Axes_Value.Content = nullext ? "-" : extax.ToString(true);

                double speed    = bot.GetCurrentSpeed();
                double acc      = bot.GetCurrentAcceleration();
                string speedacc = Math.Round(speed, MMath.STRING_ROUND_DECIMALS_MM) + " mm/s / " + Math.Round(acc, MMath.STRING_ROUND_DECIMALS_MM) + " mm/s^2";
                lbl_Status_SpeedAcceleration_Value.Content = speedacc;

                double precision = bot.GetCurrentPrecision();
                lbl_Status_Precision_Value.Content =
                    Math.Round(precision, MMath.STRING_ROUND_DECIMALS_MM) + " mm";

                MotionType mtype = bot.GetCurrentMotionMode();
                lbl_Status_MotionMode_Value.Content = mtype.ToString();

                lbl_Status_Tool_Value.Content = bot.GetCurrentTool()?.name ?? "(no tool)";
            }, null);
        }