Exemple #1
0
 public void Jog(Motor motor, double velocity)
 {
 }
Exemple #2
0
 public void BreakToPoint(Motor motor, double point)
 {
     Break(motor);
     point *= motor.Direction;
     Ch.ToPoint(MotionFlags.ACSC_AMF_MAXIMUM, motor.Id, point);
 }
Exemple #3
0
 public double GetJerk(Motor motor)
 {
     return(0);
 }
Exemple #4
0
 public void Disable(Motor motor, int timeout = 2000)
 {
     Ch.Disable(motor.Id);
     //Wait till enabled
     Ch.WaitMotorEnabled(motor.Id, 0, timeout);
 }
Exemple #5
0
 private void WriteVariable(Motor motor, string acsVariable, object value)
 {
     Ch.WriteVariable(value, acsVariable, ProgramBuffer.ACSC_NONE,
                      (int)motor.Id, (int)motor.Id, -1, -1);
 }
Exemple #6
0
 public double GetDeceleration(Motor motor)
 {
     return(0);
 }
Exemple #7
0
 public void SetJerk(Motor motor, double jerk)
 {
 }
Exemple #8
0
 public void Halt(Motor motor)
 {
     Ch.Halt(motor.Id);
 }
Exemple #9
0
 public void SetAcceleration(Motor motor, double acceleration)
 {
 }
Exemple #10
0
 public void SetDeceleration(Motor motor, double deceleration)
 {
 }
Exemple #11
0
 public void SetVelocity(Motor motor, double velocity)
 {
     Ch.SetVelocity(motor.Id, velocity);
 }
Exemple #12
0
 public void SetPosition(Motor motor, double position)
 {
 }
Exemple #13
0
 private string GetEcatActPosName(Motor motor)
 {
     return(EcatActPosName + motor.EcatPosActValAddr);
 }
Exemple #14
0
 public void Break(Motor motor)
 {
     Ch.Break(motor.Id);
 }
Exemple #15
0
 public double GetPosition(Motor motor)
 {
     return(Ch.GetFPosition(motor.Id) * motor.Direction);
 }
Exemple #16
0
 /// <summary>
 /// Catch exception and Send kill command to motor if needed.
 /// </summary>
 /// <param name="motor"></param>
 /// <param name="point"></param>
 /// <param name="timeout"></param>
 public void ToPointWaitTillEnd(Motor motor, double point, int timeout = 60000)
 {
     point *= motor.Direction;
     Ch.ToPoint(MotionFlags.ACSC_AMF_MAXIMUM, motor.Id, point);
     Ch.WaitMotionEnd(motor.Id, timeout);
 }
Exemple #17
0
 public double GetVelocity(Motor motor)
 {
     return(Ch.GetVelocity(motor.Id));
 }
Exemple #18
0
 public void WaitTillEnd(Motor motor, int timeout = 60000)
 {
     Ch.WaitMotionEnd(motor.Id, timeout);
 }
Exemple #19
0
        public void Setup()
        {
            #region Motor parameters setup

            MotorZ = new Motor(Axis.ACSC_AXIS_0)
            {
                EcatPosActValAddr = 145,
                EncCtsPerR        = 131072,
                BallScrewLead     = 32,
                HomeOffset        = 365,
                CriticalErrAcc    = 100,
                CriticalErrVel    = 100,
                CriticalErrIdle   = 5,
                SoftLimitNagtive  = -10,
                SoftLimitPositive = 730,
                SpeedFactor       = 0.9,
                JerkFactor        = 16
            };
            //For Sanyo, axisAddrOffset = 18

            MotorX1 = new Motor(Axis.ACSC_AXIS_1)
            {
                EcatPosActValAddr = MotorZ.EcatPosActValAddr + 18,
                EncCtsPerR        = 131072,
                BallScrewLead     = 16,
                HomeOffset        = 793.5,
                CriticalErrAcc    = 100,
                CriticalErrVel    = 100,
                CriticalErrIdle   = 5,
                SoftLimitNagtive  = -5,
                SoftLimitPositive = 590,
                SpeedFactor       = 0.9,
                JerkFactor        = 16
            };
            //For Sanyo, axisAddrOffset = 18

            MotorX1.MaxTravel = MotorX1.SoftLimitPositive - 10;

            MotorX2 = new Motor(Axis.ACSC_AXIS_2)
            {
                EcatPosActValAddr = MotorX1.EcatPosActValAddr + 18,
                EncCtsPerR        = 131072,
                BallScrewLead     = 16,
                HomeOffset        = 12.7,
                CriticalErrAcc    = 100,
                CriticalErrVel    = 100,
                CriticalErrIdle   = 5,
                SoftLimitNagtive  = -5,
                SoftLimitPositive = 760,
                SpeedFactor       = 1.0,
                JerkFactor        = 20
            };
            //For Sanyo, axisAddrOffset = 18

            MotorX2.MaxTravel = MotorX2.SoftLimitPositive - 10;

            MotorY = new Motor(Axis.ACSC_AXIS_3)
            {
                EcatPosActValAddr = MotorX2.EcatPosActValAddr + 18,
                EncCtsPerR        = 131072,
                BallScrewLead     = 16,
                HomeOffset        = 12.4,
                CriticalErrAcc    = 100,
                CriticalErrVel    = 100,
                CriticalErrIdle   = 5,
                SoftLimitNagtive  = -330,
                SoftLimitPositive = 4,
                SpeedFactor       = 0.8,
                JerkFactor        = 20,
                Direction         = -1
            };
            //For Sanyo, axisAddrOffset = 18


            //Todo , is two gripper is 60,    MotorR.EncCtsPerR  error?
            MotorR = new Motor(Axis.ACSC_AXIS_4)
            {
                EcatPosActValAddr = 113,
                EncCtsPerR        = 10000,
                BallScrewLead     = 360.0 * 1.0 / 100.0,
                HomeOffset        = -1.9,
                CriticalErrAcc    = 100,
                CriticalErrVel    = 100,
                CriticalErrIdle   = 5,
                SoftLimitNagtive  = -40,
                SoftLimitPositive = 40,
                SpeedFactor       = 0.18,
                JerkFactor        = 3.6
            };
            //Warning: double calculation, need to add .0 to each number.

            #endregion

            Motors = new Motor[5] {
                MotorZ, MotorX1, MotorX2, MotorY, MotorR
            };
            DeclareVariableInDBuffer();

            DisableAll();
            foreach (var mtr in Motors)
            {
                //Todo need disable motors?
                SetFPosition(mtr);
                SetSafety(mtr);
            }
            EnableAll();
            //Todo script inside acs to stop all motor is any error occur.

            HomePosition          = LoadPosition(TeachPos.Home, Location.Home);
            PickPosition          = LoadPosition(TeachPos.Pick, Location.Pick);
            BinPosition           = LoadPosition(TeachPos.Bin, Location.Bin);
            ConveyorLeftPosition  = LoadPosition(TeachPos.ConveyorLeft, Location.NoWhere);
            ConveyorRightPosition = LoadPosition(TeachPos.ConveyorRight, Location.NoWhere);

            Holder1 = LoadPosition(TeachPos.Holder1, Location.Holder1);
            Holder2 = LoadPosition(TeachPos.Holder2, Location.Holder2);
            Holder3 = LoadPosition(TeachPos.Holder3, Location.Holder3);
            Holder4 = LoadPosition(TeachPos.Holder4, Location.Holder4);
            Holder5 = LoadPosition(TeachPos.Holder5, Location.Holder5);
            Holder6 = LoadPosition(TeachPos.Holder6, Location.Holder6);

            Gold1 = LoadPosition(TeachPos.Gold1, Location.Gold1);
            Gold2 = LoadPosition(TeachPos.Gold2, Location.Gold2);
            Gold3 = LoadPosition(TeachPos.Gold3, Location.Gold3);
            Gold4 = LoadPosition(TeachPos.Gold4, Location.Gold4);
            Gold5 = LoadPosition(TeachPos.Gold5, Location.Gold5);

            Locations = new TargetPosition[14] {
                Holder1, Holder2, Holder3, Holder4, Holder5, Holder6,
                HomePosition, PickPosition, BinPosition, Gold1, Gold2, Gold3, Gold4, Gold5
            };
        }