public static IAcsWrapper CreateInstance(ILogger logger, IRobotControlSetting robotSettings,
                                                 MachineCalibrationSetting machineCalSettings)
        {
            AcsWrapper acs;

            if (AcsSimHelper.IsEnable())
            {
                AcsSimHelper.Start();
                if (AcsSimHelper.Config.SimulationMode == SimulationMode.MockPlatform)
                {
                    return(new AcsMocker());
                }
                else
                {
                    acs = new AcsWrapper(logger, robotSettings, machineCalSettings);
                    try {
                        acs.Connect();
                        return(acs);
                    }
                    catch (Exception e) {
                        // if failed to connect, return AcsMocker
                        return(new AcsMocker());
                    }
                }
            }

            acs = new AcsWrapper(logger, robotSettings, machineCalSettings);
            acs.Connect();
            return(acs);
        }
Example #2
0
        internal AcsAxis(Api api, AcsUtils utils, BufferHelper bufferHelper, GantryAxes axisId, Axis acsAxisId,
                         IRobotControlSetting config)
        {
            this.api          = api;
            this.bufferHelper = bufferHelper;
            acsUtils          = utils;
            axisConfig        = config;
            ApplicationAxisId = (int)axisId;
            AcsAxisId         = acsAxisId;
            Name = ApplicationAxisId.ToString();
            ReloadConfigParameters();
            HomeStopCondition = string.Format("FAULT({0}).#LL", (int)AcsAxisId);
            if (!Homed)
            {
                acsUtils.ClearBits("FDEF", (int)AcsAxisId, 64);
                acsUtils.ClearBits("FDEF", (int)AcsAxisId, 32);
            }

            acsUtils.SetBits("FDEF", (int)AcsAxisId, 3);
            if (Homed)
            {
                acsUtils.SetBits("FDEF", (int)AcsAxisId, 64);
                acsUtils.SetBits("FDEF", (int)AcsAxisId, 32);
            }

            switch (ApplicationAxisId)
            {
            case 0:
                HomeBuffer = 3;
                break;

            case 1:
                HomeBuffer = 0;
                break;

            case 2:
                HomeBuffer = 1;
                break;
            }
        }