Example #1
0
        private void TestBoard2_click(object sender, EventArgs e)
        {
            KM_Controller KM2;

            KM2 = new KMotion_dotNet.KM_Controller(530);
            if (KM2.WriteLineReadLine("ReadBit47") == "0")
            {
                KM2.WriteLine("SetBit47");
            }
            else
            {
                KM2.WriteLine("ClearBit47");
            }
        }
Example #2
0
        /// <summary>
        /// Test Arcs, Lines and Traverse
        /// </summary>
        static void RunCoordinatedMotionExample()
        {
            _Controller.CoordMotion.Abort();
            _Controller.CoordMotion.ClearAbort();
            _Controller.WriteLine(String.Format("DefineCS = {0} {1} {2} {3} {4} {5}", 0, 1, 2, -1, -1, -1));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 0));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 1));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 2));
            _Controller.CoordMotion.MotionParams.BreakAngle     = 30;
            _Controller.CoordMotion.MotionParams.RadiusA        = 5;
            _Controller.CoordMotion.MotionParams.RadiusB        = 5;
            _Controller.CoordMotion.MotionParams.RadiusC        = 5;
            _Controller.CoordMotion.MotionParams.MaxAccelX      = 30000;
            _Controller.CoordMotion.MotionParams.MaxAccelY      = 3000;
            _Controller.CoordMotion.MotionParams.MaxAccelZ      = 3000;
            _Controller.CoordMotion.MotionParams.MaxAccelA      = 30;
            _Controller.CoordMotion.MotionParams.MaxAccelB      = 30;
            _Controller.CoordMotion.MotionParams.MaxAccelC      = 30;
            _Controller.CoordMotion.MotionParams.MaxVelX        = 3000;
            _Controller.CoordMotion.MotionParams.MaxVelY        = 30;
            _Controller.CoordMotion.MotionParams.MaxVelA        = 30;
            _Controller.CoordMotion.MotionParams.MaxVelB        = 30;
            _Controller.CoordMotion.MotionParams.MaxVelC        = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchX = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchY = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchZ = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchA = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchB = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchC = 30;
            _Controller.CoordMotion.MotionParams.DegreesA       = false;
            _Controller.CoordMotion.MotionParams.DegreesB       = false;
            _Controller.CoordMotion.MotionParams.DegreesC       = false;
            double speed = 15;

            // Sync Coordinated Motion Library with Current Position of Machine
            double x = 0, y = 0, z = 0, a = 0, b = 0, c = 0;

            _Controller.CoordMotion.ReadAndSyncCurPositions(ref x, ref y, ref z, ref a, ref b, ref c);


            _Controller.CoordMotion.StraightTraverse(6.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, false);
            int isCCW = 1;

            _Controller.CoordMotion.StraightFeed(speed, 5.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0, 0);

            _Controller.CoordMotion.ArcFeed(speed, 1, 0.0000, 5.000, 5.0000, 0.2500, isCCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
            _Controller.CoordMotion.ArcFeed(speed, 1, 0.0000, 0.0000, 0.0000, 0.2500, isCCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);

            _Controller.CoordMotion.Dwell(2, 0);
            _Controller.CoordMotion.FlushSegments();

//            _Controller.Feedhold();  //test feedhold
//            Thread.Sleep(2000);
//            _Controller.ResumeFeedhold();
//            _Controller.ClearFeedhold();
        }
Example #3
0
 /// <summary>
 /// Sets the value if the IOType is Digital output
 /// Otherwise will throw an exception
 /// </summary>
 /// <param name="value">new value for IO point</param>
 public void SetDigitalValue(bool value)
 {
     if (_IOType != IO_TYPE.DIGITAL_OUT)
     {
         throw new DMException(this, new Exception("Cannot set digital value on a non digital output point of IO"), "Problem setting IO");
     }
     else
     {
         if (value)
         {
             _Controller.WriteLine(String.Format("SetBit{0}", _ID));
         }
         else
         {
             _Controller.WriteLine(String.Format("ClearBit{0}", _ID));
         }
     }
 }
Example #4
0
        /// <summary>
        /// Test Arcs, Lines and Traverse
        /// </summary>
        static void RunCoordinatedMotionExample()
        {
            _Controller.CoordMotion.Abort();
            _Controller.CoordMotion.ClearAbort();
            _Controller.WriteLine(String.Format("DefineCS = {0} {1} {2} {3} {4} {5}", 0, 1, 2, -1, -1, -1));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 0));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 1));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 2));
            _Controller.CoordMotion.MotionParams.BreakAngle     = 30;
            _Controller.CoordMotion.MotionParams.RadiusA        = 5;
            _Controller.CoordMotion.MotionParams.RadiusB        = 5;
            _Controller.CoordMotion.MotionParams.RadiusC        = 5;
            _Controller.CoordMotion.MotionParams.MaxAccelX      = 30000;
            _Controller.CoordMotion.MotionParams.MaxAccelY      = 3000;
            _Controller.CoordMotion.MotionParams.MaxAccelZ      = 3000;
            _Controller.CoordMotion.MotionParams.MaxAccelA      = 30;
            _Controller.CoordMotion.MotionParams.MaxAccelB      = 30;
            _Controller.CoordMotion.MotionParams.MaxAccelC      = 30;
            _Controller.CoordMotion.MotionParams.MaxVelX        = 3000;
            _Controller.CoordMotion.MotionParams.MaxVelY        = 30;
            _Controller.CoordMotion.MotionParams.MaxVelA        = 30;
            _Controller.CoordMotion.MotionParams.MaxVelB        = 30;
            _Controller.CoordMotion.MotionParams.MaxVelC        = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchX = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchY = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchZ = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchA = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchB = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchC = 30;
            _Controller.CoordMotion.MotionParams.DegreesA       = false;
            _Controller.CoordMotion.MotionParams.DegreesB       = false;
            _Controller.CoordMotion.MotionParams.DegreesC       = false;
            double speed = 85;

            _Controller.CoordMotion.StraightTraverse(6.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, false);
            int isCCW = 1;

            _Controller.CoordMotion.StraightFeed(speed, 5.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0, 0);

            _Controller.CoordMotion.ArcFeed(speed, 1, 0.0000, 5.000, 5.0000, 0.2500, isCCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
            _Controller.CoordMotion.ArcFeed(speed, 1, 0.0000, 0.0000, 0.0000, 0.2500, isCCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);

            _Controller.CoordMotion.Dwell(2, 0);
            _Controller.CoordMotion.FlushSegments();
        }
Example #5
0
        /// <summary>
        /// Define, configure, and enable an axis group
        /// </summary>
        public void EnableGroup()
        {
            _Controller.CoordMotion.ClearAbort();
            if (AxisList.Count < 2)
            {
                throw new DMException(this,
                                      new Exception("More than one Axis Required!"),
                                      "Cannot create an axis group with less than two axis!");
            }
            else
            {
                var axismap = new List <int> {
                    -1, -1, -1, -1, -1, -1, -1, -1
                };
                _Controller.WriteLine(String.Format("DefineCS = {0} {1} {2} {3} {4} {5}",
                                                    axismap[0], axismap[1], axismap[2], axismap[3], axismap[4], axismap[5]));

                for (int i = 0; i < _AxisList.Count; i++)
                {
                    if (_AxisList[i].ID > -1)
                    {
                        switch (i)
                        {
                        case 0:
                            _Controller.CoordMotion.MotionParams.MaxAccelX      = _AxisList[i].Acceleration;
                            _Controller.CoordMotion.MotionParams.MaxVelX        = _AxisList[i].Velocity;
                            _Controller.CoordMotion.MotionParams.CountsPerInchX = _AxisList[i].CPU;
                            break;

                        case 1:
                            _Controller.CoordMotion.MotionParams.MaxAccelY      = _AxisList[i].Acceleration;
                            _Controller.CoordMotion.MotionParams.MaxVelY        = _AxisList[i].Velocity;
                            _Controller.CoordMotion.MotionParams.CountsPerInchY = _AxisList[i].CPU;
                            break;

                        case 2:
                            _Controller.CoordMotion.MotionParams.MaxAccelZ      = _AxisList[i].Acceleration;
                            _Controller.CoordMotion.MotionParams.MaxVelZ        = _AxisList[i].Velocity;
                            _Controller.CoordMotion.MotionParams.CountsPerInchZ = _AxisList[i].CPU;
                            break;

                        case 3:
                            _Controller.CoordMotion.MotionParams.MaxAccelA      = _AxisList[i].Acceleration;
                            _Controller.CoordMotion.MotionParams.MaxVelA        = _AxisList[i].Velocity;
                            _Controller.CoordMotion.MotionParams.CountsPerInchA = _AxisList[i].CPU;
                            break;

                        case 4:
                            _Controller.CoordMotion.MotionParams.MaxAccelB      = _AxisList[i].Acceleration;
                            _Controller.CoordMotion.MotionParams.MaxVelB        = _AxisList[i].Velocity;
                            _Controller.CoordMotion.MotionParams.CountsPerInchB = _AxisList[i].CPU;
                            break;

                        case 5:
                            _Controller.CoordMotion.MotionParams.MaxAccelC      = _AxisList[i].Acceleration;
                            _Controller.CoordMotion.MotionParams.MaxVelC        = _AxisList[i].Velocity;
                            _Controller.CoordMotion.MotionParams.CountsPerInchC = _AxisList[i].CPU;
                            break;

                        default:
                            break;
                        }
                    }
                }
                _Controller.CoordMotion.MotionParams.BreakAngle            = _BreakAngle;
                _Controller.CoordMotion.MotionParams.CollinearTolerance    = _CollinearTolerance;
                _Controller.CoordMotion.MotionParams.CornerTolerance       = _CornerTolerance;
                _Controller.CoordMotion.MotionParams.FacetAngle            = _FacetAngle;
                _Controller.CoordMotion.MotionParams.MaxLinearLength       = _MaxLength;
                _Controller.CoordMotion.MotionParams.TPLookahead           = _LookAhead;
                _Controller.CoordMotion.MotionParams.UseOnlyLinearSegments = _UseOnlyLinearSegments;
                _Controller.CoordMotion.MotionParams.ArcsToSegs            = _ArcsToSegs;
                _Controller.CoordMotion.MotionParams.DegreesA = _DegreesA;
                _Controller.CoordMotion.MotionParams.DegreesB = _DegreesB;
                _Controller.CoordMotion.MotionParams.DegreesC = _DegreesC;
            }
        }
Example #6
0
 /// <summary>
 /// Set or get IIR Z domain servo filter #0
 /// </summary>
 public void SetIIR0(double p1, double p2, double p3, double p4, double p5)
 {
     _Controller.WriteLine(String.Format("IIR{0} 0={1} {2} {3} {4} {5}",
                                         _ID, p1, p2, p3, p4, p5));
 }
Example #7
0
 /// <summary>
 /// Sets the Axis' current 0.0 point
 /// </summary>
 public void ZeroAxis()
 {
     _Controller.WriteLine(String.Format("Zero{0}", _ID));
 }
Example #8
0
 private void TestBoard2_click(object sender, EventArgs e)
 {
     KM_Controller KM2;
     KM2 = new KMotion_dotNet.KM_Controller(530);
     if (KM2.WriteLineReadLine("ReadBit47")=="0")
         KM2.WriteLine("SetBit47");
     else
         KM2.WriteLine("ClearBit47");
 }