예제 #1
0
        /// <summary>
        /// Updates the diplay of the inverted pendulums and the charts.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void SetInvertedPendulumAngle(object sender, ElapsedEventArgs e)
        {
            if (!(DateTime.Now.Subtract(dateTime).TotalSeconds > RunTime))
            {
                this.BeginInvoke((Action)(() =>
                {
                    label1.Text = "Correction State: " + correctionState.ToString();

                    chart1.Series[0].Points.Add(anglePID);
                    chart1.Series[1].Points.Add(angleADRC);
                    chart1.Series[2].Points.Add(SetPoint);
                    chart1.Series[3].Points.Add(SetPoint + 360);

                    chart2.Series[0].Points.Add(outputPID);
                    chart2.Series[1].Points.Add(outputADRC);

                    chart1.Series[0].Color = Color.DarkGreen;
                    chart1.Series[1].Color = Color.Red;
                    chart1.Series[2].Color = Color.Magenta;

                    chart2.Series[0].Color = Color.DarkGreen;
                    chart2.Series[1].Color = Color.Red;

                    Bitmap PID = BitmapModifier.RotateImage(new Bitmap(Path.GetFullPath(@"..\..\PID.png")), (float)anglePID + 180f);
                    Bitmap ADRC = BitmapModifier.RotateImage(new Bitmap(Path.GetFullPath(@"..\..\ADRC.png")), (float)angleADRC + 180f);

                    pictureBox1.Image = BitmapModifier.CombineImages(PID, ADRC);
                }));
            }
        }
예제 #2
0
        /// <summary>
        /// Updates the diplay of the inverted pendulums and the charts.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void SetInvertedPendulumAngle(object sender, ElapsedEventArgs e)
        {
            if (!(DateTime.Now.Subtract(dateTime).TotalSeconds > RunTime))
            {
                Bitmap rotatedFeedbackBMP = BitmapModifier.RotateImage(feedbackBitmap, (float)currentAngle + 180f);

                this.BeginInvoke((Action)(() =>
                {
                    chart1.Series[0].Points.Add(currentAngle);
                    chart1.Series[1].Points.Add(SetPoint);

                    chart2.Series[0].Points.Add(currentOutput);

                    chart1.Series[0].Color = Color.DarkGreen;
                    chart1.Series[1].Color = Color.Red;

                    chart2.Series[0].Color = Color.Red;

                    pictureBox1.Image = rotatedFeedbackBMP;
                }));
            }
        }