Beispiel #1
0
        public void Start()
        {
            if (_ch.IsConnected == false)
            {
                _ch.OpenCommEthernet(_ip, 701);
            }
            _motion = new EthercatMotion(_ch, 5);
            _motion.Setup();
            _io = new EthercatIo(_ch, 72, 7, 4);
            _io.Setup();
            _conveyor = new PickAndPlaceConveyor(_io);

            if (_gripperIsOnline)
            {
                if (_gripper == null)
                {
                    _gripper = new Stepper("COM3");
                }
                _gripper.Setup();
            }

            SetSpeed(10);

            SetupComplete = true;
        }
        public void Start()
        {
            SetupComplete = false;

            if (EthercatOnline)
            {
                if (_ch.IsConnected == false)
                {
                    EnableEvent();
                    _ch.OpenCommEthernet(_ip, 701);
                }
                if (EcatIo == null)
                {
                    EcatIo = new EthercatIo(_ch, 72, 7, 4);
                }
                EcatIo.Setup();
            }

            if (MotorsOnline)
            {
                if (Motion == null)
                {
                    Motion = new EthercatMotion(_ch, 5);
                }

                if (Motion.MotorSetupComplete == false)
                {
                    Motion.Setup();
                }
                Motion.LoadPositions();
                SetMotorSpeed(DefaultRobotSpeed);

                if (EthercatOnline)
                {
                    EcatIo.MapEtherCAT();
                }
            }

            if (StepperOnline)
            {
                if (Steppers == null)
                {
                    Steppers = new Stepper("COM2");
                }
                Steppers.Setup();
                SetStepperSpeed(DefaultRobotSpeed);
            }

            if (ConveyorOnline)
            {
                if (Conveyor == null)
                {
                    Conveyor = new Conveyor(EcatIo);
                }

                Conveyor.Start();

                Conveyor.ErrorOccured -= Conveyor_ErrorOccured;
                Conveyor.ErrorOccured += Conveyor_ErrorOccured;

                StartConveyorManager();
            }

            if (ShieldBoxOnline)
            {
                ShieldBoxSetup();
                if (TesterOnline)
                {
                    TesterSetup();
                }
            }

            if (ScannerOnline)
            {
                if (Scanner == null)
                {
                    Scanner               = new Scanner("COM44");
                    Scanner.InfoOccured  -= Scanner_InfoOccured;
                    Scanner.InfoOccured  += Scanner_InfoOccured;
                    Scanner.ErrorOccured -= Scanner_ErrorOccured;
                    Scanner.ErrorOccured += Scanner_ErrorOccured;
                }
                Scanner.Start();
            }

            GoldPhoneSetup();

            SelfChecking();

            SetupComplete = true;
        }