Пример #1
0
        ////when stop move triggers, we check whether we have moved the minium distance,
        ////if not, we move the remaining distance
        public void StopMove()
        {
            Axis axis = ConvertDir2Axis(dir);

            dir = Direction.None;
            e_RSPErrorCode res = MoveController.Instance.StopMove(enumMapper[armType], axis);
        }
Пример #2
0
 private bool IsRotateOrClip(WorkstationController.Hardware.Direction dir)
 {
     return(dir == WorkstationController.Hardware.Direction.ClampOff ||
            dir == WorkstationController.Hardware.Direction.ClampOn ||
            dir == WorkstationController.Hardware.Direction.RotateCW ||
            dir == WorkstationController.Hardware.Direction.RotateCCW);
 }
Пример #3
0
        public void StartMove(ArmType armType, WorkstationController.Hardware.Direction dir, int speedMMPerSecond)
        {
            startPosition         = GetPosition(armType);
            this.dir              = dir;
            this.armType          = armType;
            this.speedMMPerSecond = speedMMPerSecond;
            if (armType == ArmType.Roma)
            {
                GetClipperInfo(ref degree, ref clipWidth);
            }

            var eArmType = enumMapper[armType];
            //var res = MoveController.Instance.StartMove(enumMapper[armType], (Direction)dir, speedMMPerSecond);
            e_RSPErrorCode res         = e_RSPErrorCode.RSP_ERROR_NONE;
            e_CanMotorID   motorID     = e_CanMotorID.CanMotorID_Max;
            double         absPosition = 0;

            switch (dir)
            {
            case Direction.Left:
            case Direction.Right:
                motorID     = armType == ArmType.Liha ? e_CanMotorID.CanMotorID_Left_x : e_CanMotorID.CanMotorID_Right_x;
                absPosition = dir == Direction.Left ? 0 : 700;
                res         = MoveController.Instance.StartMove(eArmType, Axis.X, speedMMPerSecond, absPosition, 0);
                Debug.WriteLine(string.Format("movex result:{0}", res.ToString()));
                break;

            case Direction.Up:
            case Direction.Down:
                motorID     = armType == ArmType.Liha ? e_CanMotorID.CanMotorID_Left_y : e_CanMotorID.CanMotorID_Right_y;
                absPosition = dir == Direction.Down ? 400 : 0;
                res         = MoveController.Instance.StartMove(eArmType, Axis.Y, speedMMPerSecond, absPosition, 0);
                break;

            case Direction.ZDown:
            case Direction.ZUp:
                motorID     = armType == ArmType.Liha ? e_CanMotorID.CanMotorID_Left_z : e_CanMotorID.CanMotorID_Right_z;
                absPosition = dir == Direction.ZUp ? 0 : 300;
                res         = MoveController.Instance.StartMove(eArmType, Axis.Z, speedMMPerSecond, absPosition, 0);
                break;

            case Direction.RotateCCW:
            case Direction.RotateCW:
                this.armType = ArmType.Roma;
                motorID      = e_CanMotorID.CanMotorID_Rotate;
                absPosition  = dir == Direction.RotateCCW ? 360 : 720;
                res          = MoveController.Instance.StartMove(_eARM.右臂, Axis.R, speedMMPerSecond, absPosition, 0);
                break;

            case Direction.ClampOff:
            case Direction.ClampOn:
                this.armType = ArmType.Roma;
                motorID      = e_CanMotorID.CanMotorID_Clipper;
                absPosition  = dir == Direction.ClampOff ? 0 : 20;
                res          = MoveController.Instance.StartMove(_eARM.右臂, Axis.Clipper, speedMMPerSecond, absPosition, 0);
                break;
            }
            ThrowIfErrorHappened(res);
        }