Ejemplo n.º 1
0
 /// <summary>
 /// Starts calibration target picking mode (user is expected to place the target with the mouse, then change the radius so the calibration can take place)
 /// </summary>
 /// <param name="_Notify"></param>
 public void                             StartCalibrationTargetPicking(CalibrationDone _Notify)
 {
     m_CalibrationDelegate = _Notify;
     m_CalibrationRadius   = 0.0f;
     ManipulationState     = MANIPULATION_STATE.CALIBRATION_TARGET;
     m_CalibrationStage    = CALIBRATION_STAGE.PICK_CENTER;
 }
Ejemplo n.º 2
0
 private void btnCalib_Click(object sender, System.EventArgs e)
 {
     ThreadManager.CreateThread(link =>
     {
         link.Name = "Calibration";
         Recalibration.Calibration();
         picCalibration.InvokeAuto(() => picCalibration.Image = Properties.Resources.ValidOk96);
         CalibrationDone?.Invoke();
     }).StartThread();
     btnTrap.Focus();
 }
Ejemplo n.º 3
0
        private void ZeroCalibrationHandler(object sender, EventArgs eventArgs)
        {
            if (_adcList.Count < _zeroCalibrationCount)
            {
                _adcList.Add((double[])CurrAdcVals.Clone());
            }
            else
            {
                ParseDone -= ZeroCalibrationHandler;
                var zeroVals = new double[4];

                for (int i = 0; i < zeroVals.Count(); i++)
                {
                    zeroVals[i] = _adcList.Average(doubles => doubles[i]);
                    if (_startupCalib)
                    {
                        var w              = 0.1;
                        var koef_new       = w / zeroVals[i];
                        var koef_old       = w / MainConfig.ZeroAdcVals[i];
                        var offset_percent = (100 * koef_new) / koef_old;

                        offset_percent = (100 - offset_percent) * 10;


                        WeightKoefs[i] += (WeightKoefs[i] * offset_percent) / 100;
                    }
                }

                if (!_startupCalib)
                {
                    MainConfig.Update(null, zeroVals);
                }
                zeroAdcVals = zeroVals;

                if (CalibrationDone != null)
                {
                    CalibrationDone.Invoke(null, null);
                }
                _zeroCorrection = true;
                _startupCalib   = false;
                _adcList.Clear();
            }
            //------------
        }
Ejemplo n.º 4
0
 private void WeightCalibrationHandler(object o, EventArgs eventArgs)
 {
     if (_adcList.Count < _calibrationParams.EntryCount)
     {
         _adcList.Add((double[])CurrAdcVals.Clone());
     }
     else
     {
         ParseDone -= WeightCalibrationHandler;
         var    aver = _adcList.Average(val => val[_calibrationParams.TenzNumber]);
         double koef = _calibrationParams.Weight / aver;
         WeightKoefs[_calibrationParams.TenzNumber] = koef;
         if (CalibrationDone != null)
         {
             CalibrationDone.Invoke(null, null);
         }
         _adcList.Clear();
         _calibrationParams    = null;
         ExchangeConfig.Period = _periodBuf;
     }
 }
Ejemplo n.º 5
0
        void Calibration()
        {
            Int32 speedX = CalibrateAxis(ref calStateX, moveToZeroSpeedX, moveFromZeroSpeedX, !lx);
            Int32 speedY = CalibrateAxis(ref calStateY, moveToZeroSpeedY, moveFromZeroSpeedY, !ly);
            Int32 speedZ = CalibrateAxis(ref calStateZ, moveToZeroSpeedZ, moveFromZeroSpeedZ, !lz);
            Int32 speedA = CalibrateAxis(ref calStateA, moveToZeroSpeedA, moveFromZeroSpeedA, !la);

            if (calStateX == AxisCalStates.calIdle && calStateY == AxisCalStates.calIdle && calStateZ == AxisCalStates.calIdle && calStateA == AxisCalStates.calIdle)
            {
                Stop();
                state = States.Idle;
                SetCoordinates(0, 0, 0, 0);
                if (CalibrationDone != null)
                {
                    CalibrationDone.Invoke(this, null);
                }
            }
            else
            {
                Move(speedX, speedY, -speedZ, speedA);
            }
        }
Ejemplo n.º 6
0
        private void FastWeightCalibrationHandler(object o, EventArgs eventArgs)
        {
            if (_adcList.Count < _calibrationParams.EntryCount)
            {
                _adcList.Add((double[])CurrAdcVals.Clone());
            }
            else
            {
                ParseDone -= FastWeightCalibrationHandler;
                for (int i = 0; i < 4; i++)
                {
                    var    aver = _adcList.Average(val => val[i]);
                    double koef = _calibrationParams.Weight / aver;
                    WeightKoefs[i] = koef;
                }

                if (CalibrationDone != null)
                {
                    CalibrationDone.Invoke(null, null);
                }
                _adcList.Clear();
                _calibrationParams = null;
            }
        }
Ejemplo n.º 7
0
 public static extern void StartCalibration(IntPtr apiHandle, CalibrationDone doneCallback);
Ejemplo n.º 8
0
 /// <summary>
 /// Starts calibration target picking mode (user is expected to place the target with the mouse, then change the radius so the calibration can take place)
 /// </summary>
 /// <param name="_Notify"></param>
 public void StartCalibrationTargetPicking( CalibrationDone _Notify )
 {
     m_CalibrationDelegate = _Notify;
     m_CalibrationRadius = 0.0f;
     ManipulationState = MANIPULATION_STATE.CALIBRATION_TARGET;
     m_CalibrationStage = CALIBRATION_STAGE.PICK_CENTER;
 }