Exemple #1
0
 private void btStopDg_Click(object sender, EventArgs e)
 {
     dgMotionEnabled = false;
     PosFixture.setPosition("X0 Y0 Z0");
     // Normal
     PosFixture.sendCommand("$xvm=2000");             // xMax rate (mm/min)
     PosFixture.sendCommand("$yvm=2000");             // yMax rate (mm/min)
     PosFixture.sendCommand("$zvm=2000");             // zMax rate (mm/min)
     PosFixture.sendCommand("$xjm=20");               // xMax jerk (mm/min)
     PosFixture.sendCommand("$yjm=20");               // yMax jerk (mm/min)
     PosFixture.sendCommand("$zjm=20");               // zMax jerk (mm/min)
     System.Threading.Thread.Sleep(2000);
 }
Exemple #2
0
        public MainForm()
        {
            InitializeComponent();

            // Give classes access to mainform
            Chart.setParentForm(this);
            PosFixture.setPort("COM40");

            // Create LRU Instances
            lru0 = new CalTool.LruCom(0);
            // Need to add dropdown box for this
            lru0.selectedComPort = "COM50";

            // Default scale
            Chart.MAX_RATE = 100;
            Chart.MIN_RATE = -100;
        }
Exemple #3
0
        private void btStartRandom_Click(object sender, EventArgs e)
        {
            randomEnabled = true;
            // Start motion to enable motion stop for normal logic above
            Random r  = new Random();
            int    r1 = r.Next(-tbRandomScaleY.Value, +tbRandomScaleY.Value);
            int    r2 = r.Next(-tbRandomScaleR.Value, +tbRandomScaleR.Value);
            int    r3 = r.Next(-tbRandomScaleP.Value, +tbRandomScaleP.Value);

            if (cbRandomXEnabled.Checked != true)
            {
                r1 = 0;
            }
            if (cbRandomYEnabled.Checked != true)
            {
                r2 = 0;
            }
            if (cbRandomZEnabled.Checked != true)
            {
                r3 = 0;
            }
            PosFixture.setPosition("X" + r1.ToString() + " Y" + r2.ToString() + " Z" + r3.ToString());
        }
Exemple #4
0
 private void btMoveRoll0_Click(object sender, EventArgs e)
 {
     PosFixture.setPosition("X0 Y0 Z0");
 }
Exemple #5
0
 private void btStopRandom_Click(object sender, EventArgs e)
 {
     randomEnabled = false;
     PosFixture.setPosition("X0 Y0 Z0");
 }
Exemple #6
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            lru0.update();

            // Setup outputs
            if ((lru0.unitConnected) && firstConnect)
            {
                lru0.setParameterReq((int)PARAM.STATUS, RATE.RATE_1HZ);
                firstConnect = false;
            }

            //btGyroZRaw.Text = lru0.dataParam[(int)PARAM.BTEMP].ToString();
            //btVolts.Text = lru0.dataParam[(int)PARAM.VOLTS].ToString();


            switch (dataSource)
            {
            case (int)SOURCE.GYRO_RAW0:
                // Gyro display
                lbSource.Text = "Gyro 0 Raw";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.GYROXR0], lru0.dataParam[(int)PARAM.GYROYR0], lru0.dataParam[(int)PARAM.GYROZR0]);
                btParmX.Text = lru0.dataParam[(int)PARAM.GYROXR0].ToString("0.00000");
                btParmY.Text = lru0.dataParam[(int)PARAM.GYROYR0].ToString("0.00000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.GYROZR0].ToString("0.00000");
                btParmA.Text = lru0.dataParam[(int)PARAM.FIFOCOUNT].ToString("000");
                break;

            case (int)SOURCE.GYRO_RAW1:
                // Gyro display
                lbSource.Text = "Gyro 1 Raw";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.GYROXR1], lru0.dataParam[(int)PARAM.GYROYR1], lru0.dataParam[(int)PARAM.GYROZR1]);
                btParmX.Text = lru0.dataParam[(int)PARAM.GYROXR1].ToString("0.00000");
                btParmY.Text = lru0.dataParam[(int)PARAM.GYROYR1].ToString("0.00000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.GYROZR1].ToString("0.00000");
                btParmA.Text = lru0.dataParam[(int)PARAM.FIFOCOUNT].ToString("000");
                break;

            case (int)SOURCE.GYRO_CAL:
                // Gyro display
                lbSource.Text = "Cal Gyro";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.GYROXC], lru0.dataParam[(int)PARAM.GYROYC], lru0.dataParam[(int)PARAM.GYROZC]);
                btParmX.Text = lru0.dataParam[(int)PARAM.GYROXC].ToString("0.00000");
                btParmY.Text = lru0.dataParam[(int)PARAM.GYROYC].ToString("0.00000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.GYROZC].ToString("0.00000");
                btParmA.Text = ("-");
                break;

            case (int)SOURCE.GYRO_SUM:
                // Gyro sum display
                //Chart.addNewPoint(lru0.dataParam[(int)PARAM.GYROXSUM], lru0.dataParam[(int)PARAM.GYROYSUM], lru0.dataParam[(int)PARAM.GYROZSUM]);
                //btParmX.Text = lru0.dataParam[(int)PARAM.GYROXSUM].ToString("000.00");
                //btParmY.Text = lru0.dataParam[(int)PARAM.GYROYSUM].ToString("000.00");
                //btParmZ.Text = lru0.dataParam[(int)PARAM.GYROZSUM].ToString("000.00");
                lbSource.Text = "Gyro Bias";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.OI0], lru0.dataParam[(int)PARAM.OI1], lru0.dataParam[(int)PARAM.OI2]);
                btParmX.Text = lru0.dataParam[(int)PARAM.OI0].ToString("0.0000");
                btParmY.Text = lru0.dataParam[(int)PARAM.OI1].ToString("0.0000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.OI2].ToString("0.0000");
                btParmA.Text = ("-");
                break;

            case (int)SOURCE.ACCEL_RAW0:
                // Accel display
                lbSource.Text = "Accel 0 Raw";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.ACCELXR0], lru0.dataParam[(int)PARAM.ACCELYR0], lru0.dataParam[(int)PARAM.ACCELZR0]);
                btParmX.Text = lru0.dataParam[(int)PARAM.ACCELXR0].ToString("0.00000");
                btParmY.Text = lru0.dataParam[(int)PARAM.ACCELYR0].ToString("0.00000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.ACCELZR0].ToString("0.00000");
                btParmA.Text = ("-");
                break;

            case (int)SOURCE.ACCEL_RAW1:
                // Accel display
                lbSource.Text = "Accel 1 Raw";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.ACCELXR1], lru0.dataParam[(int)PARAM.ACCELYR1], lru0.dataParam[(int)PARAM.ACCELZR1]);
                btParmX.Text = lru0.dataParam[(int)PARAM.ACCELXR1].ToString("0.00000");
                btParmY.Text = lru0.dataParam[(int)PARAM.ACCELYR1].ToString("0.00000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.ACCELZR1].ToString("0.00000");
                btParmA.Text = ("-");
                break;


            case (int)SOURCE.ACCEL_CAL:
                // Accel display
                lbSource.Text = "Accel Cal";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.ACCELXC], lru0.dataParam[(int)PARAM.ACCELYC], lru0.dataParam[(int)PARAM.ACCELZC]);
                btParmX.Text = lru0.dataParam[(int)PARAM.ACCELXC].ToString("0.00000");
                btParmY.Text = lru0.dataParam[(int)PARAM.ACCELYC].ToString("0.00000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.ACCELZC].ToString("0.00000");
                btParmA.Text = ("-");
                break;

            case (int)SOURCE.RPY:
                // Roll Pitch Yaw
                lbSource.Text = "Roll Pitch Yaw";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.ROLL], lru0.dataParam[(int)PARAM.PITCH], lru0.dataParam[(int)PARAM.YAW]);
                btParmX.Text = lru0.dataParam[(int)PARAM.ROLL].ToString("000.000");
                btParmY.Text = lru0.dataParam[(int)PARAM.PITCH].ToString("000.000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.YAW].ToString("000.000");
                btParmA.Text = lru0.dataParam[(int)PARAM.YAWT].ToString("000.000");

                break;

            case (int)SOURCE.WEIGHT:
                // Weighting
                lbSource.Text = "Weight";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.RPYWEIGHT], lru0.dataParam[(int)PARAM.BIASWEIGHT], lru0.dataParam[(int)PARAM.AHRSRPYGATE]);
                btParmX.Text = lru0.dataParam[(int)PARAM.RPYWEIGHT].ToString("00.0");
                btParmY.Text = lru0.dataParam[(int)PARAM.BIASWEIGHT].ToString("00.0");
                btParmZ.Text = lru0.dataParam[(int)PARAM.AHRSRPYGATE].ToString("0.000");
                btParmA.Text = ("-");
                break;

            case (int)SOURCE.STATS1:
                // Status Group 1
                Chart.addNewPoint(0, lru0.dataParam[(int)PARAM.BATVOLTS], 0);
                lbSource.Text = "Stats Group 1";
                btParmX.Text  = lru0.dataParam[(int)PARAM.UPDATERATE].ToString("00.0");
                btParmY.Text  = lru0.dataParam[(int)PARAM.BATVOLTS].ToString("00.0");
                btParmA.Text  = ("-");
                break;

            case (int)SOURCE.ADC:
                // Air Data
                Chart.addNewPoint(0, lru0.dataParam[(int)PARAM.IAS], lru0.dataParam[(int)PARAM.VS]);
                lbSource.Text = "Air Data";
                btParmX.Text  = (lru0.dataParam[(int)PARAM.BCA] * 10).ToString("00,000.0");                         // Scaled
                btParmY.Text  = lru0.dataParam[(int)PARAM.IAS].ToString("000.0");
                btParmZ.Text  = lru0.dataParam[(int)PARAM.AOA].ToString("000.0");

                btParmA.Text = ("-");
                break;

            case (int)SOURCE.HEATERS:
                // Heaters
                lbSource.Text = "Heater Temps";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.TEMPP], lru0.dataParam[(int)PARAM.TEMPS], 0);
                btParmX.Text = lru0.dataParam[(int)PARAM.TEMPP].ToString("00.0");
                btParmY.Text = lru0.dataParam[(int)PARAM.TEMPS].ToString("00.0");
                btParmZ.Text = lru0.dataParam[(int)PARAM.OATRAW].ToString("0000");
                btParmA.Text = ("-");
                break;

            case (int)SOURCE.AIRRAW:
                // Heaters
                lbSource.Text = "Air Data Raw";
                //Chart.addNewPoint(lru0.dataParam[(int)PARAM.TEMPP], lru0.dataParam[(int)PARAM.TEMPS], 0);
                btParmX.Text = lru0.dataParam[(int)PARAM.SENP].ToString("0000.0");
                btParmY.Text = lru0.dataParam[(int)PARAM.SENS].ToString("0000.0");
                btParmZ.Text = lru0.dataParam[(int)PARAM.OATRAW].ToString("0000");
                btParmA.Text = ("-");
                break;

            case (int)SOURCE.RATES:
                // Heaters
                lbSource.Text = "AHRS Rates";
                Chart.addNewPoint(lru0.dataParam[(int)PARAM.ROLLRATE], lru0.dataParam[(int)PARAM.PITCHRATE], lru0.dataParam[(int)PARAM.YAWRATE]);
                btParmX.Text = lru0.dataParam[(int)PARAM.ROLLRATE].ToString("000.000");
                btParmY.Text = lru0.dataParam[(int)PARAM.PITCHRATE].ToString("000.000");
                btParmZ.Text = lru0.dataParam[(int)PARAM.YAWRATE].ToString("000.000");
                btParmA.Text = ("-");
                break;
            }

            // Status
            int status = (int)lru0.dataParam[(int)PARAM.STATUS];

            // Pitot Stable
            if ((status & 0x01) == 0x01)
            {
                btPitotHeatStable.BackColor = Color.ForestGreen;
            }
            else
            {
                btPitotHeatStable.BackColor = Color.DarkGray;
            }

            // Static Stable
            if ((status & 0x02) == 0x02)
            {
                btStaticHeatStable.BackColor = Color.ForestGreen;
            }
            else
            {
                btStaticHeatStable.BackColor = Color.DarkGray;
            }

            // AHRS Stable
            if ((status & 0x04) == 0x04)
            {
                btAhrsStable.BackColor = Color.ForestGreen;
            }
            else
            {
                btAhrsStable.BackColor = Color.DarkGray;
            }

            // AHRS Align Complete
            if ((status & 0x08) == 0x08)
            {
                btAhrsAlignComplete.BackColor = Color.ForestGreen;
            }
            else
            {
                btAhrsAlignComplete.BackColor = Color.DarkGray;
            }

            //// Source Display
            //if (dataSource == (int)SOURCE.GYRO_RAW)
            //	lbSource.Text = "G RAW";
            //if (dataSource == (int)SOURCE.RPY)
            //	lbSource.Text = "RPY";


            // Chart min max labels
            lbMaxChartVal.Text = Chart.MAX_RATE.ToString();
            lbMinChartVal.Text = Chart.MIN_RATE.ToString();
            lbTrgTemp.Text     = Chart.TRG_RATE.ToString();
            lbTrgTemp.Top      = (int)Chart.rateToYLoc(Chart.TRG_RATE) + 20;

            this.Invalidate();

            if (freeGyroMode == true)
            {
                timeInFreeMode       += 0.10;
                lbTimeInFreeMode.Text = timeInFreeMode.ToString("000.0") + " Sec";
            }


            // Positioning Fixture Random Motion
            if (randomEnabled)
            {
                if (!PosFixture.getInMotion())
                {
                    Random r  = new Random();
                    int    r1 = r.Next(-tbRandomScaleY.Value, +tbRandomScaleY.Value);
                    int    r2 = r.Next(-tbRandomScaleR.Value, +tbRandomScaleR.Value);
                    int    r3 = r.Next(-tbRandomScaleP.Value, +tbRandomScaleP.Value);
                    if (cbRandomXEnabled.Checked != true)
                    {
                        r1 = 0;
                    }
                    if (cbRandomYEnabled.Checked != true)
                    {
                        r2 = 0;
                    }
                    if (cbRandomZEnabled.Checked != true)
                    {
                        r3 = 0;
                    }
                    PosFixture.setPosition("X" + r1.ToString() + " Y" + r2.ToString() + " Z" + r3.ToString());
                }
            }
            else
            {
                //PosFixture.setPosition("X0 Y0 Z0");
            }

            // DG Motion Test
            if (dgMotionEnabled)
            {
                if (!PosFixture.getInMotion())
                {
                    //if (!dgSlowInit)
                    //{
                    //	// Slow
                    //	PosFixture.sendCommand("$xvm=35"); // xMax rate (mm/min)
                    //	PosFixture.sendCommand("$yvm=35"); // yMax rate (mm/min)
                    //	PosFixture.sendCommand("$zvm=35"); // zMax rate (mm/min)
                    //	PosFixture.sendCommand("$xjm=.1");   // xMax jerk (mm/min)
                    //	PosFixture.sendCommand("$yjm=.1");   // yMax jerk (mm/min)
                    //	PosFixture.sendCommand("$zjm=.1");   // zMax jerk (mm/min)
                    //	System.Threading.Thread.Sleep(2000);
                    //	dgSlowInit = true;
                    //}

                    // Toggle between left and right
                    if (dgCycleCount < 6)
                    {
                        // Cycle 1
                        if (dgRightSide)
                        {
                            PosFixture.setPosition("X7.5 Y7.5 Z7.5");
                            dgRightSide = false;
                        }
                        else
                        {
                            PosFixture.setPosition("X-7.5 Y-7.5 Z-7.5");
                            dgRightSide = true;
                            //dgCycleCount++;
                        }
                    }
                    else
                    {
                        // Cycle 2
                        if (dgRightSide)
                        {
                            PosFixture.setPosition("X7.5 Y-7.5 Z-7.5");
                            dgRightSide = false;
                        }
                        else
                        {
                            PosFixture.setPosition("X-7.5 Y7.5 Z-7.5");
                            dgRightSide = true;
                            dgCycleCount++;
                        }
                    }
                    if (dgCycleCount > 12)
                    {
                        dgCycleCount = 0;
                    }
                    System.Threading.Thread.Sleep(100);
                }
            }

            PosFixture.update();

            //// Trend
            //lbOmegaITrend0.Text = lru0.dataParam[(int)PARAM.OIT0].ToString("0000.00");
            //lbOmegaITrend1.Text = lru0.dataParam[(int)PARAM.OIT1].ToString("0000.00");
            //lbOmegaITrend2.Text = lru0.dataParam[(int)PARAM.OIT2].ToString("0000.00");
        }