Esempio n. 1
0
        // native Ensemble units are mm/s for velocity and G for accel


        // Constructors & Finalizers -------------------------------------------
        public Axis(A3200HC a3200HC, string name, uint nodeId, uint pointId)
            : base(a3200HC, name, nodeId, pointId)
        {
            base.type     = Type.Axis;
            lastProfile   = new MoveProfile();
            nativeProfile = new MoveProfile();
        }
Esempio n. 2
0
 private void MakeNativeProfile(IMoveProfile moveProfile)
 {
     nativeProfile.Acceleration   = moveProfile.Acceleration * countsPerUnit; // convert acceleration to G's
     nativeProfile.Deceleration   = moveProfile.Deceleration * countsPerUnit;
     nativeProfile.Velocity       = moveProfile.Velocity * countsPerUnit;
     nativeProfile.FollowingError = moveProfile.FollowingError * countsPerUnit;
     nativeProfile.Jerk           = moveProfile.Jerk * countsPerUnit;
     nativeProfile.SettlingWindow = moveProfile.SettlingWindow * countsPerUnit;
 }
Esempio n. 3
0
        public void SetMoveProfile(IMoveProfile moveProfile)
        {
            if (lastProfile.Equals(moveProfile))
            {
                return;
            }
            UpdateLastProfile(moveProfile);

            a3200HC.SetMoveProfile(this, moveProfile);
        }
Esempio n. 4
0
 private bool ProfileUnchanged(IMoveProfile moveProfile)
 {
     return(moveProfile.MoveType == lastProfile.MoveType &
            moveProfile.Jerk == lastProfile.Jerk &
            moveProfile.Acceleration == lastProfile.Acceleration &
            moveProfile.Deceleration == lastProfile.Deceleration &
            moveProfile.Velocity == lastProfile.Velocity &
            moveProfile.SettlingWindow == lastProfile.SettlingWindow &
            moveProfile.SettlingTime == lastProfile.SettlingTime &
            moveProfile.FollowingError == lastProfile.FollowingError);
 }
Esempio n. 5
0
        public void MoveAbsoluteStart(IMoveProfile moveProfile, double position)
        {
            if (!this.IsHomed)
            {
                throw new HardwareException(string.Format("Axis [{0}] not homed. Cannot move absolutely.", this.Name));
            }

            SetMoveProfile(moveProfile);

            a3200HC.Move(this, position);
        }
Esempio n. 6
0
        private void UpdateLastProfile(IMoveProfile moveProfile)
        {
            lastProfile.MoveType       = moveProfile.MoveType;
            lastProfile.Jerk           = moveProfile.Jerk;
            lastProfile.Acceleration   = moveProfile.Acceleration;
            lastProfile.Deceleration   = moveProfile.Deceleration;
            lastProfile.Velocity       = moveProfile.Velocity;
            lastProfile.SettlingWindow = moveProfile.SettlingWindow;
            lastProfile.SettlingTime   = moveProfile.SettlingTime;
            lastProfile.FollowingError = moveProfile.FollowingError;

            MakeNativeProfile(moveProfile);
        }
        //public void InvertAxisDirection(AxisOrientation axisOrient, bool isInvert)
        //{
        //    switch (axisOrient)
        //    {
        //        case AxisOrientation.LeftRight:
        //            AxisAndMovePackage pkg = (AxisAndMovePackage)arrowButtonRight.Tag;
        //            arrowButtonRight.Tag = CreatePackage(pkg.Axis, pkg.MoveProfile, !isInvert);
        //            arrowButtonLeft.Tag = CreatePackage(pkg.Axis, pkg.MoveProfile, isInvert);
        //            break;
        //        case AxisOrientation.ForwardBackward:
        //            AxisAndMovePackage pkg2 = (AxisAndMovePackage)arrowButtonForward.Tag;
        //            arrowButtonForward.Tag = CreatePackage(pkg2.Axis, pkg2.MoveProfile, !isInvert);
        //            arrowButtonBackward.Tag = CreatePackage(pkg2.Axis, pkg2.MoveProfile, isInvert);
        //            break;
        //        case AxisOrientation.UpDown:
        //            AxisAndMovePackage pkg3 = (AxisAndMovePackage)arrowButtonUp.Tag;
        //            arrowButtonUp.Tag = CreatePackage(pkg3.Axis, pkg3.MoveProfile, !isInvert);
        //            arrowButtonDown.Tag = CreatePackage(pkg3.Axis, pkg3.MoveProfile, isInvert);
        //            break;
        //        case AxisOrientation.Rotation:
        //            AxisAndMovePackage pkg4 = (AxisAndMovePackage)arrowButtonCCW.Tag;
        //            arrowButtonCCW.Tag = CreatePackage(pkg4.Axis, pkg4.MoveProfile, !isInvert);
        //            arrowButtonCW.Tag = CreatePackage(pkg4.Axis, pkg4.MoveProfile, isInvert);
        //            break;
        //    }
        //}

        //public void AssignDigitalInputs(params IDigitalInput[] digitalInputs)
        //{
        //    if (digitalInputs == null)
        //        return;
        //    _digitalInputs = new List<IDigitalInput>();
        //    _digitalInputs.AddRange(digitalInputs);
        //    buttonDIO.Visible = true;
        //}

        //public void AssignDigitalOutputs(params IDigitalOutput[] digitalOutputs)
        //{
        //    if (digitalOutputs == null)
        //        return;
        //    _digitalOutputs = new List<IDigitalOutput>();
        //    _digitalOutputs.AddRange(digitalOutputs);
        //    buttonDIO.Visible = true;
        //}

        // Internal methods ----------------------------------------------------
        private AxisAndMovePackage CreatePackage(IAxis axis, IMoveProfile moveProfile, bool isPositiveMove)
        {
            if (axis != null)
            {
                AxisAndMovePackage pkg = new AxisAndMovePackage();
                pkg.Axis           = axis;
                pkg.MoveProfile    = moveProfile;
                pkg.IsPositiveMove = isPositiveMove;
                return(pkg);
            }
            else
            {
                return(null);
            }
        }
        // Methods -------------------------------------------------------------
        public void AssignData(string name, double position, IAxis axis, IMoveProfile axisMoveProfile, AxisOrientation orientation, string positionName)
        {
            if (axis == null)
            {
                throw new Exception("Axis cannot be null.");
            }

            labelName.Text     = name;
            labelAxesName.Text = positionName;//axis.Name;

            _teachPosition   = position;
            _axis            = axis;
            _axisMoveProfile = axisMoveProfile;

            textBoxMoveToPosition.Text = position.ToString();

            //
            if (orientation == AxisOrientation.LeftRight)
            {
                arrowButtonLeft.Visible  = true;
                arrowButtonRight.Visible = true;
                arrowButtonRight.Tag     = CreatePackage(axis, axisMoveProfile, true);
                arrowButtonLeft.Tag      = CreatePackage(axis, axisMoveProfile, false);
            }
            else if (orientation == AxisOrientation.ForwardBackward)
            {
                arrowButtonForward.Visible  = true;
                arrowButtonBackward.Visible = true;
                arrowButtonForward.Tag      = CreatePackage(axis, axisMoveProfile, true);
                arrowButtonBackward.Tag     = CreatePackage(axis, axisMoveProfile, false);
            }
            else if (orientation == AxisOrientation.UpDown)
            {
                arrowButtonUp.Visible   = true;
                arrowButtonDown.Visible = true;
                arrowButtonUp.Tag       = CreatePackage(axis, axisMoveProfile, false);
                arrowButtonDown.Tag     = CreatePackage(axis, axisMoveProfile, true);;
            }
            else
            {
                arrowButtonCCW.Visible = true;
                arrowButtonCW.Visible  = true;
                arrowButtonCCW.Tag     = CreatePackage(axis, axisMoveProfile, false);
                arrowButtonCW.Tag      = CreatePackage(axis, axisMoveProfile, true);
            }
        }
Esempio n. 9
0
        public void AssignAxis(IAxis axis, IMoveProfile moveProfile)
        {
            if (DesignMode)
            {
                return;
            }

            this.axis = axis;

            Axis _axis = (Axis)axis;

            groupBox1.Text        = _axis.Name;
            lbAxisNo.Text         = _axis.PointId.ToString();
            tNumAcceleration.Text = moveProfile.Acceleration.ToString();
            tNumVelocity.Text     = moveProfile.Velocity.ToString();

            //tmrUpdate.Enabled = true;
        }
        // Methods -------------------------------------------------------------
        public void AssignData(IAxis axisX, IAxis axisY, IAxis axisTheta, double positionX, double positionY, double positionTheta, IMoveProfile MoveProfileX, IMoveProfile MoveProfileY, IMoveProfile MoveProfileTheta, string positionName)
        {
            //if (axis == null)
            //    throw new Exception("Axis cannot be null.");

            labelName.Text     = "Precisor Station";
            labelAxesName.Text = positionName;

            _teachPositionX     = positionX;
            _teachPositionY     = positionY;
            _teachPositionTheta = positionTheta;

            _axisX     = axisX;
            _axisY     = axisY;
            _axisTheta = axisTheta;

            _axisMoveProfileX     = MoveProfileX;
            _axisMoveProfileY     = MoveProfileY;
            _axisMoveProfileTheta = MoveProfileTheta;

            textBoxMoveToPositionX.Text     = positionX.ToString();
            textBoxMoveToPositionY.Text     = positionY.ToString();
            textBoxMoveToPositionTheta.Text = positionTheta.ToString();

            arrowButtonLeft.Visible  = true;
            arrowButtonRight.Visible = true;
            arrowButtonRight.Tag     = CreatePackage(HSTMachine.Workcell.IOManifest.GetAxis((int)HSTIOManifest.Axes.X), _axisMoveProfileX, true);
            arrowButtonLeft.Tag      = CreatePackage(HSTMachine.Workcell.IOManifest.GetAxis((int)HSTIOManifest.Axes.X), _axisMoveProfileX, false);

            arrowButtonUp.Visible   = true;
            arrowButtonDown.Visible = true;
            arrowButtonUp.Tag       = CreatePackage(HSTMachine.Workcell.IOManifest.GetAxis((int)HSTIOManifest.Axes.Y), _axisMoveProfileY, true);
            arrowButtonDown.Tag     = CreatePackage(HSTMachine.Workcell.IOManifest.GetAxis((int)HSTIOManifest.Axes.Y), _axisMoveProfileY, false);;

            arrowButtonCCW.Visible = true;
            arrowButtonCW.Visible  = true;
            arrowButtonCCW.Tag     = CreatePackage(HSTMachine.Workcell.IOManifest.GetAxis((int)HSTIOManifest.Axes.Theta), _axisMoveProfileTheta, false);
            arrowButtonCW.Tag      = CreatePackage(HSTMachine.Workcell.IOManifest.GetAxis((int)HSTIOManifest.Axes.Theta), _axisMoveProfileTheta, true);
        }
Esempio n. 11
0
 public void MoveRelativeStart(IMoveProfile moveProfile, double positionRelative)
 {
     SetMoveProfile(moveProfile);
     a3200HC.MoveRel(this, positionRelative);
 }
Esempio n. 12
0
 public void MoveAbsolute(IMoveProfile moveProfile, double position, uint msecTimeOut)
 {
     MoveAbsoluteStart(moveProfile, position);
     WaitMoveDone(msecTimeOut);
 }
 private uint GetMoveTimeOutValue(IAxis axis, double targePosition, IMoveProfile moveProfile)
 {
     return(10000);
 }
Esempio n. 14
0
 public void ShowSingleAxisTeachForm(HSTIOManifest.Axes axis, /*TouchscreenNumBox*/ TextBox tsnb, IMoveProfile mp, SingleAxisForm.AxisOrientation or, string positionName)
 {
     new Thread(delegate()
     {
         IAxis ax         = HSTMachine.Workcell.IOManifest.GetAxis((int)axis);
         mp.Velocity      = 100;
         mp.Acceleration  = 500;
         mp.Deceleration  = 500;
         SingleAxisForm f = new SingleAxisForm();
         f.AssignData(ax.Name, Convert.ToDouble(tsnb.Text), ax, mp, or, positionName);
         //f.TopMost = true;
         if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             tsnb.BeginInvoke((MethodInvoker) delegate
             {
                 tsnb.Text = f.TeachPosition.ToString();
             });
         }
     }).Start();
 }
Esempio n. 15
0
 public void MoveRelative(IMoveProfile moveProfile, double positionRelative, uint msecTimeOut)
 {
     MoveRelativeStart(moveProfile, positionRelative);
     WaitMoveDone(msecTimeOut);
 }
Esempio n. 16
0
        public void ShowMultipleAxisTeachForm(HSTIOManifest.Axes axisX, HSTIOManifest.Axes axisY, HSTIOManifest.Axes axisTheta, /*TouchscreenNumBox*/ TextBox tsnbX, /*TouchscreenNumBox*/ TextBox tsnbY, /*TouchscreenNumBox*/ TextBox tsnbTheta, IMoveProfile mpX, IMoveProfile mpY, IMoveProfile mpTheta, string positionName)
        {
            Log.Info(this, "Text Box X:{0}, Text Box Y:{1}, Text Box Theta:{2}", tsnbX, tsnbY, tsnbTheta);

            new Thread(delegate()
            {
                IAxis axX     = HSTMachine.Workcell.IOManifest.GetAxis((int)axisX);
                IAxis axY     = HSTMachine.Workcell.IOManifest.GetAxis((int)axisY);
                IAxis axTheta = HSTMachine.Workcell.IOManifest.GetAxis((int)axisTheta);

                //temp do separate move profile, can join together and use same move profile if wannted later
                mpX.Velocity     = 100;
                mpX.Acceleration = 500;
                mpX.Deceleration = 500;

                mpY.Velocity     = 20;
                mpY.Acceleration = 100;
                mpY.Deceleration = 100;

                mpTheta.Velocity     = 20;
                mpTheta.Acceleration = 100;
                mpTheta.Deceleration = 100;

                MultipleAxisForm f = new MultipleAxisForm();
                f.AssignData(axX, axY, axTheta, Convert.ToDouble(tsnbX.Text), Convert.ToDouble(tsnbY.Text), Convert.ToDouble(tsnbTheta.Text), mpX, mpY, mpTheta, positionName);
                //f.TopMost = true;
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    tsnbX.BeginInvoke((MethodInvoker) delegate
                    {
                        tsnbX.Text = f.TeachPositionX.ToString();
                    });

                    tsnbY.BeginInvoke((MethodInvoker) delegate
                    {
                        tsnbY.Text = f.TeachPositionY.ToString();
                    });

                    tsnbX.BeginInvoke((MethodInvoker) delegate
                    {
                        tsnbTheta.Text = f.TeachPositionTheta.ToString();
                    });
                }
            }).Start();
        }
Esempio n. 17
0
 public void SetMoveProfile(IMoveProfile moveProfile)
 {
     a3200HC.SetMoveProfile(this, moveProfile);
 }