Example #1
0
        void RouterPositionUpdate(object o, EventArgs e)
        {
            IRobotCommandWithStatus status = o as IRobotCommandWithStatus;

            if (status != null)
            {
                Vector3 position = status.CurrentPosition;
                float   time     = status.Time;
                float   distance = (lastPosition - position).Length;

                if ((lastPosition - position).Length > 0.0001f)
                {
                    lock (previousPoints)
                    {
                        //Console.WriteLine("{0},{1}", time, distance);
                        while (previousPoints.Count > 1000)
                        {
                            previousPoints.RemoveAt(0);
                        }
                        previousPoints.Add(new PreviousPoint(time, position));
                        lastPosition = position;
                    }
                }
            }
        }
Example #2
0
        void RobotStatusUpdate(object o, EventArgs e)
        {
            if (this.InvokeRequired && !this.Disposing)
            {
                try
                {
                    this.Invoke(new EventHandler(RobotStatusUpdate), new object[] { o, e });
                }
                catch (ObjectDisposedException)
                {
                }
            }
            else
            {
                IRobotCommandWithStatus status = o as IRobotCommandWithStatus;
                if (status != null)
                {
                    this.runButton.Enabled          = true;
                    this.steppersEnabledBox.Enabled = true;
                    this.zbox.Enabled = true;
                    this.zGo.Enabled  = true;

                    this.steppersEnabledBox.Checked = status.SteppersEnabled;
                    if (status.Pausing)
                    {
                        pause_resume_button.Text    = "Pausing...";
                        pause_resume_button.Enabled = false;
                    }
                    else
                    {
                        if (status.Paused)
                        {
                            if (pause_resume_button.Text != "Resume")
                            {
                                cancelButton.Enabled     = true;
                                pause_resume_button.Text = "Resume";
                            }
                        }
                        else
                        {
                            if (pause_resume_button.Text != "Pause")
                            {
                                pause_resume_button.Text = "Pause";
                            }
                        }
                        pause_resume_button.Enabled = true;
                    }
                }
            }
        }