Example #1
0
        public void SetServoFriction(ETcServoAxis axis, int dir, float kf, float kv)
        {
            string sPid = string.Format(".gv.Axis[{0}].friction[{1}].", (int)axis, dir);

            TcComm.WriteReal(sPid + "Kf", (float)kf, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Kv", (float)kv, ETcRunTime.RT1);
        }
Example #2
0
 // Stop servo command //
 public void StopServo(ETcServoAxis axis)
 {
     lock (cmdLock)
     {
         cmd.CData.Command = (int)ETcMainCmd.StopServo;
         cmd.CData.Iarg1   = (int)axis;
         SendBlocking(1000);
     }
 }
Example #3
0
 // Reset servo encoder command //
 public void ResetServoEncoder(ETcServoAxis axis)
 {
     lock (cmdLock)
     {
         cmd.CData.Command = (int)ETcMainCmd.ResetServoEncoder;
         cmd.CData.Iarg1   = (int)axis;
         SendBlocking(1000);
     }
 }
Example #4
0
 // Set servo speed command //
 public void StartServoSpeed(ETcServoAxis axis, double value)
 {
     lock (cmdLock)
     {
         cmd.CData.Command = (int)ETcMainCmd.StartServoSpeed;
         cmd.CData.Iarg1   = (int)axis;
         cmd.CData.Farg1   = value;
         SendBlocking(1000);
     }
 }
Example #5
0
 // Search home command //
 public void SearchHome(ETcServoAxis axis, double offset)
 {
     lock (cmdLock)
     {
         cmd.CData.Command = (int)ETcMainCmd.SearchHome;
         cmd.CData.Iarg1   = (int)axis;
         cmd.CData.Farg1   = offset;
         SendBlocking(30000);
     }
 }
Example #6
0
 // Set servo active command //
 public void SetServoActive(ETcServoAxis axis, bool active)
 {
     lock (cmdLock)
     {
         cmd.CData.Command = (int)ETcMainCmd.SetServoActive;
         cmd.CData.Iarg1   = (int)axis;
         cmd.CData.Iarg2   = (active == false) ? 0 : 1;
         SendBlocking(1000);
     }
 }
Example #7
0
        // Get servo state command //
        public ETcServoState GetServoState(ETcServoAxis axis)
        {
            lock (cmdLock)
            {
                cmd.CData.Command = (int)ETcMainCmd.GetServoState;
                cmd.CData.Iarg1   = (int)axis;
                SendBlocking(1000);
            }

            return((ETcServoState)cmd.RData.Iarg2);
        }
Example #8
0
        // Set servo position profile command //
        public void StartServoPositionProfile(ETcServoAxis axis, PointF[] point)
        {
            SetServoProfile(axis, point);

            lock (cmdLock)
            {
                cmd.CData.Command = (int)ETcMainCmd.StartServoPositionProfile;
                cmd.CData.Iarg1   = (int)axis;
                SendBlocking(1000);
            }
        }
Example #9
0
 // Set servo position command //
 public void StartServoPosition(ETcServoAxis axis, double value, double maxSpeed, double accel)
 {
     lock (cmdLock)
     {
         cmd.CData.Command = (int)ETcMainCmd.StartServoPosition;
         cmd.CData.Iarg1   = (int)axis;
         cmd.CData.Farg1   = value;
         cmd.CData.Farg2   = maxSpeed;
         cmd.CData.Farg3   = accel;
         SendBlocking(1000);
     }
 }
Example #10
0
        // Set servo running profile //
        public void SetServoProfile(ETcServoAxis axis, PointF[] point)
        {
            for (int i = 0; i < point.Length; i++)
            {
                string sPointX = string.Format(".gv.Axis[{0}].profile.point[{1}].X", (int)axis, i);
                string sPointY = string.Format(".gv.Axis[{0}].profile.point[{1}].Y", (int)axis, i);

                TcComm.WriteReal(sPointX, point[i].X, ETcRunTime.RT1);
                TcComm.WriteReal(sPointY, point[i].Y, ETcRunTime.RT1);
            }

            string sLength = string.Format(".gv.Axis[{0}].profile.length", (int)axis);

            TcComm.WriteInt(sLength, (short)point.Length, ETcRunTime.RT1);
        }
Example #11
0
        // Set PID parameter
        // axis : Servo axis number
        // mode  : Servo PID control mode 0-Torque 1-Speed 2-Position
        // kp    : Propotional factor(%)
        // ki    : Integral factor(msec)
        // kd    : Differencial factor(msec)
        // tv    : Velocity compensation
        // tf    : Friction
        // ti    : Rotor inertia
        // min   : Minimum output value
        // max   : Maximum output value
        public void SetParamServoPID(ETcServoAxis axis, ETcServoMode mode, bool closeLoop, double kp, double ki,
                                     double kd, double ka, double tv, double tf, double ti, double min, double max)
        {
            string sPid = string.Format(".gv.Axis[{0}].pidParam[{1}].", (int)axis, (int)mode);

            TcComm.WriteBool(sPid + "closeLoop", closeLoop, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Kp", (float)kp, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Ki", (float)ki, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Kd", (float)kd, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Ka", (float)ka, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Tv", (float)tv, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Tf", (float)tf, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "Ti", (float)ti, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "value.minValue", (float)min, ETcRunTime.RT1);
            TcComm.WriteReal(sPid + "value.maxValue", (float)max, ETcRunTime.RT1);
        }
Example #12
0
 public ETcServoState GetServoState(ETcServoAxis axis)
 {
     return((ETcServoState)GetFloatValue((ETcRealTags)((int)ETcRealTags.AX_10_InputState + (int)axis)));
 }