public float GetAxis(AxisDefine axis) { if (axis == AxisDefine.Axis_Horizontal) { return(axisValue.x); } else if (axis == AxisDefine.Axis_Vertical) { return(axisValue.y); } return(0.0f); }
public static float GetAxis(AxisDefine axis) { if (axis == AxisDefine.Axis_Horizontal) { return(InputDevice.Instance.InputP1.GetAxis(FtGameInput.InputPlayer.AxisDefine.Axis_Horizontal)); } else if (axis == AxisDefine.Axis_Vertical) { return(InputDevice.Instance.InputP1.GetAxis(FtGameInput.InputPlayer.AxisDefine.Axis_Vertical)); } return(0.0f); }
private void Install_Load(object sender, EventArgs e) { bool rtn = MotionHelper.Instance.InitCard(PathDefine.sPathCard); if (!rtn) { MessageBox.Show("轴卡初始化失败"); } SystemConfig.Load(); MotionHelper.Instance.StartMointorIO(); SpeedDefine.Load(); // 速度配置 CameraDefine.Load(); // 相机配置 IODefine.Load(); // IO配置 AxisDefine.Load(); // 轴配置 }
private void bUpdate_Click(object sender, EventArgs e) { AxisDefine.Save(); }
public int SystemInit() { try { if (!SystemConfig.Load()) { throw new Exception("系统配置文件"); } if (!SpeedDefine.Load()) { throw new Exception("速度配置文件"); } if (!CameraDefine.Load()) { throw new Exception("相机配置文件"); } if (!IODefine.Load()) { throw new Exception("IO配置文件"); } if (!FeederDefine.Load()) { throw new Exception("Feeder配置文件"); } if (!HardwareOrgHelper.Load()) { throw new Exception("机械校验文件"); } if (!AxisDefine.Load()) { throw new Exception("轴卡配置文件"); } } catch (Exception ex) { return(Error.Invoke(new SystemErrorEventArg { Error = $"加载参数失败:[{ex.Message}]!!!" })); } bool rtn = MotionHelper.Instance.InitCard(PathDefine.sPathCard); if (!rtn) { return(Error.Invoke(new SystemErrorEventArg { Error = "轴卡初始化失败!!!" })); } Task <string> result = Task <string> .Factory.StartNew(() => { return(CameraDefine.Instance.CameraConnected()); }); Axis_Advantech.DisableCamDO(); MotionHelper.Instance.ResetAllOuput(); MotionHelper.Instance.StartMointorIO(); Track.TrackManager.Instance.TrackInit(); Thread.Sleep(100); if (MotionHelper.Instance.bServoWarning) { return(Error.Invoke(new SystemErrorEventArg { Error = "伺服报警,请重新上电再复位!!!" })); } if (MotionHelper.Instance.bEmg) { return(Error.Invoke(new SystemErrorEventArg { Error = "急停按下,请打开急停重新上电再复位!!!" })); } // 初始化实例 for (Module module = Module.Front; module <= Module.After; ++module) { Entiys.Add(module, new MachineEntiy(module)); this.FlowMachine.Add(module, new StateMachine(module)); Module index = module; Task.Factory.StartNew(() => { IODefine.Instance.MachineIO[index].Init(); IODefine.Instance.TrackIO[(Config.Track)(index)].Init(); if (index == Module.Front) { IODefine.Instance.OtherIO.Init(); } }); } result.Wait(); if (result.Result != string.Empty) { return(Error.Invoke(new SystemErrorEventArg { Error = result.Result })); } else { MotionHelper.Instance.MachineIOMointor.Tick += Entiys[Module.Front].MachineIOMointor; MotionHelper.Instance.MachineIOMointor.Tick += Entiys[Module.After].MachineIOMointor; } return(0); }