Exemple #1
0
        /// <summary>
        /// Attempts to automatically calibrate the <see cref="FindLocation" /> method.
        /// </summary>
        /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns>
        public static void Calibrate(CalibrationInfo[] info)
        {
            m_LocationPointer = null;

            ProcessStream pc = ProcessStream;

            if (pc == null)
            {
                return;
            }

            int ptrX = 0, sizeX = 0;
            int ptrY = 0, sizeY = 0;
            int ptrZ = 0, sizeZ = 0;
            int ptrF = 0, sizeF = 0;

            for (int i = 0; i < info.Length; ++i)
            {
                CalibrationInfo ci = info[i];

                int ptr = Search(pc, ci.Mask, ci.Vals);

                if (ptr == 0)
                {
                    continue;
                }

                if (ptrX == 0 && ci.DetX.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetX, out ptrX, out sizeX);
                }

                if (ptrY == 0 && ci.DetY.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetY, out ptrY, out sizeY);
                }

                if (ptrZ == 0 && ci.DetZ.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetZ, out ptrZ, out sizeZ);
                }

                if (ptrF == 0 && ci.DetF.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetF, out ptrF, out sizeF);
                }

                if (ptrX != 0 && ptrY != 0 && ptrZ != 0 && ptrF != 0)
                {
                    break;
                }
            }

            if (ptrX != 0 || ptrY != 0 || ptrZ != 0 || ptrF != 0)
            {
                m_LocationPointer = new LocationPointer(ptrX, ptrY, ptrZ, ptrF, sizeX, sizeY, sizeZ, sizeF);
            }
        }
Exemple #2
0
        private void Save()
        {
            CalibrationInfo info = null;

            if (_service.TrySaveCalibration(SaveName, _resultData, out info))
            {
                IsSaved = true;

                var oldInfo = Calibrations.FirstOrDefault(i => i.Id == info.Id);
                if (oldInfo != null)
                {
                    Calibrations.Remove(oldInfo);
                }
                Calibrations.Insert(0, info);
            }
        }
Exemple #3
0
        private void calibrationBtn_Click(object sender, EventArgs e)
        {
            if (calibrationDroneComboBox.SelectedIndex < 0)
            {
                parent.ShowMessageBox("Please select drone");
                return;
            }

            int index = -1;

            try
            {
                index = int.Parse((string)calibrationDroneComboBox.SelectedItem);
            }
            catch (FormatException ex)
            {
                parent.ShowMessageBox("Id가 숫자가 아닙니다.");
                return;
            }
            droneList[index].CheckConnection();
            droneList[index].AddACKCheckEvent(
                delegate() {
                System.Threading.Thread thread = new System.Threading.Thread(
                    delegate()
                {
                    CalibrationInfo cInfo = CalibrationManager.Calibrate(parent,
                                                                         droneList[index],
                                                                         parent.GetUWBManager(),
                                                                         droneList[index].GetTagID(),
                                                                         "temp",
                                                                         powers.ToArray(),
                                                                         times.ToArray());
                    CalibrationList.AddCalibrationData(parent, "temp", cInfo);
                });
                thread.Start();
            }, 3000, "Check your device is connected to the drone.");

            this.Close();
        }
Exemple #4
0
 /// <summary>
 /// Attempts to automatically calibrate the <see cref="FindLocation" /> method.
 /// </summary>
 /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns>
 public static void Calibrate()
 {
     Calibrate(CalibrationInfo.GetList());
 }
Exemple #5
0
        private void LoadNIFilter()
        {
            String exePath           = System.AppDomain.CurrentDomain.BaseDirectory;
            string CalibrationFolder = exePath + "CalibrationFiles\\";

            if (!Directory.Exists(CalibrationFolder))
            {
                MessageBox.Show("Calibration Folder Not Found.", "Calibration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string fileName = CalibrationFolder + "ND Filter T% reference data.csv";

            if (!File.Exists(fileName))
            {
                //MessageBox.Show("ND Calibration File Not Found." + fileName, "Calibration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string strread = "";

            NDInfo.Clear();
            StreamReader sr = new StreamReader(fileName);
            string       line;

            string[] row;
            int      Rowcnt = 0;

            while ((line = sr.ReadLine()) != null)
            {
                row = line.Split(',');
                if (row[0] == "")
                {
                    continue;
                }

                if (Rowcnt == 0)
                {
                    NDFileterInfo tmp = new NDFileterInfo();
                    tmp.Name = row[1];
                    NDInfo.Add(tmp);
                    NDFileterInfo tmp2 = new NDFileterInfo();
                    tmp2.Name = row[4];
                    NDInfo.Add(tmp2);
                    NDFileterInfo tmp3 = new NDFileterInfo();
                    tmp3.Name = row[7];
                    NDInfo.Add(tmp3);
                    NDFileterInfo tmp4 = new NDFileterInfo();
                    tmp4.Name = row[10];
                    NDInfo.Add(tmp4);
                    NDFileterInfo tmp5 = new NDFileterInfo();
                    tmp5.Name = row[13];
                    NDInfo.Add(tmp5);
                    NDFileterInfo tmp6 = new NDFileterInfo();
                    tmp6.Name = row[16];
                    NDInfo.Add(tmp6);
                    Rowcnt++;
                    continue;
                }

                int             Idx   = 1;
                CalibrationInfo info1 = new CalibrationInfo();
                info1.waveLength = int.Parse(row[0]);
                info1.Nominal    = double.Parse(row[Idx]);
                info1.min        = double.Parse(row[Idx + 1]);
                info1.max        = double.Parse(row[Idx + 2]);
                NDInfo[0].data.Add(info1);

                Idx = 4;
                CalibrationInfo info2 = new CalibrationInfo();
                info2.waveLength = int.Parse(row[0]);
                info2.Nominal    = double.Parse(row[Idx]);
                info2.min        = double.Parse(row[Idx + 1]);
                info2.max        = double.Parse(row[Idx + 2]);
                NDInfo[1].data.Add(info2);

                Idx = 7;
                CalibrationInfo info3 = new CalibrationInfo();
                info3.waveLength = int.Parse(row[0]);
                info3.Nominal    = double.Parse(row[Idx]);
                info3.min        = double.Parse(row[Idx + 1]);
                info3.max        = double.Parse(row[Idx + 2]);
                NDInfo[2].data.Add(info3);

                Idx = 10;
                CalibrationInfo info4 = new CalibrationInfo();
                info4.waveLength = int.Parse(row[0]);
                info4.Nominal    = double.Parse(row[Idx]);
                info4.min        = double.Parse(row[Idx + 1]);
                info4.max        = double.Parse(row[Idx + 2]);
                NDInfo[3].data.Add(info4);

                Idx = 13;
                CalibrationInfo info5 = new CalibrationInfo();
                info5.waveLength = int.Parse(row[0]);
                info5.Nominal    = double.Parse(row[Idx]);
                info5.min        = double.Parse(row[Idx + 1]);
                info5.max        = double.Parse(row[Idx + 2]);
                NDInfo[4].data.Add(info5);

                Idx = 16;
                CalibrationInfo info6 = new CalibrationInfo();
                info6.waveLength = int.Parse(row[0]);
                info6.Nominal    = double.Parse(row[Idx]);
                info6.min        = double.Parse(row[Idx + 1]);
                info6.max        = double.Parse(row[Idx + 2]);
                NDInfo[5].data.Add(info6);
            }

            // UpdateCaliUI();
            UpdateNDFilterLB();
        }
Exemple #6
0
        /// <summary>
        /// Attempts to automatically calibrate the <see cref="FindLocation" /> method.
        /// </summary>
        /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns>
        public static void Calibrate(CalibrationInfo[] info)
        {
            m_LocationPointer = null;

            ProcessStream pc = ProcessStream;

            if (pc == null)
                return;

            int ptrX = 0, sizeX = 0;
            int ptrY = 0, sizeY = 0;
            int ptrZ = 0, sizeZ = 0;
            int ptrF = 0, sizeF = 0;

            for (int i = 0; i < info.Length; ++i)
            {
                CalibrationInfo ci = info[i];

                int ptr = Search(pc, ci.Mask, ci.Vals);

                if (ptr == 0)
                    continue;

                if (ptrX == 0 && ci.DetX.Length > 0)
                    GetCoordDetails(pc, ptr, ci.DetX, out ptrX, out sizeX);

                if (ptrY == 0 && ci.DetY.Length > 0)
                    GetCoordDetails(pc, ptr, ci.DetY, out ptrY, out sizeY);

                if (ptrZ == 0 && ci.DetZ.Length > 0)
                    GetCoordDetails(pc, ptr, ci.DetZ, out ptrZ, out sizeZ);

                if (ptrF == 0 && ci.DetF.Length > 0)
                    GetCoordDetails(pc, ptr, ci.DetF, out ptrF, out sizeF);

                if (ptrX != 0 && ptrY != 0 && ptrZ != 0 && ptrF != 0)
                    break;
            }

            if (ptrX != 0 || ptrY != 0 || ptrZ != 0 || ptrF != 0)
                m_LocationPointer = new LocationPointer(ptrX, ptrY, ptrZ, ptrF, sizeX, sizeY, sizeZ, sizeF);
        }