Coordinated Motion class representing the CoordMotion.cpp object from the C++ Dynotion Code Use to directly control multiple axis motion Notably:: Straight Traverse Straight Feed Arc Feed
Inheritance: IDisposable
Beispiel #1
0
        public void initdevice()
        {
            Debug.WriteLine("Init Device");

            _Controller = new KMotion_dotNet.KM_Controller();


            _XAxis = new KMotion_dotNet.KM_Axis(_Controller, 0, "x");
            _YAxis = new KMotion_dotNet.KM_Axis(_Controller, 1, "y");
            _ZAxis = new KMotion_dotNet.KM_Axis(_Controller, 2, "z");
            _AAxis = new KMotion_dotNet.KM_Axis(_Controller, 3, "a");
            _BAxis = new KMotion_dotNet.KM_Axis(_Controller, 4, "b");
            _CAxis = new KMotion_dotNet.KM_Axis(_Controller, 5, "c");
            _Motion = new KMotion_dotNet.KM_CoordMotion(_Controller);

            AddHandlers();

            initdevicesettings();
        }
Beispiel #2
0
        /// <summary>
        /// Primary constructor for the KM_Interpreter object
        /// </summary>
        public KM_Interpreter(KM_CoordMotion coordmotion)
        {
            try
            {
                KM_dotnet_Interop_GCodeInterpreter_New(coordmotion.InstanceHandle, ref _InstanceHandle);

                Set_G_COMPLETE_CALLBACK();
                Set_G_STATUS_CALLBACK();
                Set_G_USER_CALLBACK();
                Set_G_USER_MCODE_CALLBACK();
            }
            catch (DllNotFoundException e)
            {
                throw new DMException(this, e, String.Format("Dll Not Found Exception thrown :  Caller - [{0}] :: Member - [{1}]",
                    this.ToString(), "Ctor"));
            }
            catch (EntryPointNotFoundException e)
            {
                throw new DMException(this, e, String.Format("Entry Point Not Found Exception thrown :  Caller - [{0}] :: Member - [{1}]",
                   this.ToString(), "Ctor"));
            }
            catch (Exception e)
            {
                throw new DMException(this, e, String.Format("General Exception thrown :  Caller - [{0}] :: Member - [{1}]",
                  this.ToString(), "Ctor"));
            }
        }
        public void initdevicesettings()
        {
           
            MyApplication = ((App)Application.Current);
           

            string codeBase = Assembly.GetExecutingAssembly().CodeBase;
            UriBuilder uri = new UriBuilder(codeBase);
            string path = Uri.UnescapeDataString(uri.Path);
            path = Path.GetDirectoryName(path);
            path = Path.GetDirectoryName(path);
            path = Path.GetDirectoryName(path);
            
            String TheCFile = "C:\\KMotion432\\KMotion\\Release\\InitSolderingRobot.c";
            String result = _Controller.ExecuteProgram(1, TheCFile, false);
            if (result != "") MessageBox.Show(result);
            // setup and map kflop axis to variables
            _Solder1Move = new KMotion_dotNet.KM_Axis(_Controller, 0, "x");
            _Solder2Move = new KMotion_dotNet.KM_Axis(_Controller, 1, "y");
            _Solder1Feed = new KMotion_dotNet.KM_Axis(_Controller, 2, "z");
            _Solder2Feed = new KMotion_dotNet.KM_Axis(_Controller, 3, "a");
            _CaddyDrive = new KMotion_dotNet.KM_Axis(_Controller, 4, "b");
            _CAxis = new KMotion_dotNet.KM_Axis(_Controller, 5, "c");

            _Motion = new KMotion_dotNet.KM_CoordMotion(_Controller);


            Debug.WriteLine(_Controller.GetCommandValue<string>("Version", false));

            _Solder1Move.Enable();
            _Solder2Move.Enable();
            _Solder1Feed.Enable();
            _Solder2Feed.Enable();
            _CaddyDrive.Enable();
          
            _Controller.WriteLine("SetBitDirection38=0");
            caddyEnabled = true;
            // init IO ports with default values

            _Solder1Move.CPU = settings.SolderHead1.HeadCPM;
            _Solder1Move.Velocity = settings.SolderHead1.HeadVelocity;
            _Solder1Move.Acceleration = settings.SolderHead1.HeadAcceleration;
            _Solder1Move.TuningParams.Jerk = settings.SolderHead1.HeadJerk;


            _Solder2Move.CPU = settings.SolderHead2.HeadCPM;
            _Solder2Move.Velocity = settings.SolderHead2.HeadVelocity;
            _Solder2Move.Acceleration = settings.SolderHead2.HeadAcceleration;
            _Solder2Move.TuningParams.Jerk = settings.SolderHead2.HeadJerk;

            _Solder1Feed.CPU = settings.SolderHead1.FeedCPM;
            _Solder1Feed.Velocity = settings.SolderHead1.FeedVelocity;
            _Solder1Feed.Acceleration = settings.SolderHead1.FeedAcceleration;
            _Solder1Feed.TuningParams.Jerk = settings.SolderHead1.FeedJerk;

            _Solder2Feed.CPU = settings.SolderHead2.FeedCPM;
            _Solder2Feed.Velocity = settings.SolderHead2.FeedVelocity;
            _Solder2Feed.Acceleration = settings.SolderHead2.FeedAcceleration;
            _Solder2Feed.TuningParams.Jerk = settings.SolderHead2.FeedJerk;

            _CaddyDrive.CPU = cpmCaddy;
            _CaddyDrive.Velocity = 2e4;
            _CaddyDrive.Acceleration = 2e4;
            _CaddyDrive.TuningParams.Jerk = 3e5;
            _CaddyDrive.TuningParams.OutputGain = -1;

            // setup homing params
            _Solder1Move.HomingParams.SourceType = HOMING_ROUTINE_SOURCE_TYPE.AUTO;
            _Solder1Move.HomingParams.DefaultThread = 5;
            _Solder1Move.HomingParams.HomeFastVel = 600;
            _Solder1Move.HomingParams.HomeSlowVel = 200;
            _Solder1Move.HomingParams.HomeLimitBit = 39;
            _Solder1Move.HomingParams.HomeLimitState = true;
            _Solder1Move.HomingParams.RepeatHomeAtSlowerRate = true;
            _Solder1Move.HomingParams.SequencePriority = 1;
            _Solder1Move.HomingParams.HomeNegative = true;
            _Solder1Move.HomingParams.StatusBit = 39;
            _Solder1Move.HomingParams.SetToZero = true;


            _Solder2Move.HomingParams.SourceType = HOMING_ROUTINE_SOURCE_TYPE.AUTO;
            _Solder2Move.HomingParams.DefaultThread = 3;
            _Solder2Move.HomingParams.HomeFastVel = 600;
            _Solder2Move.HomingParams.HomeSlowVel = 200;
            _Solder2Move.HomingParams.HomeLimitBit = 40;
            _Solder2Move.HomingParams.HomeLimitState = true;
            _Solder2Move.HomingParams.RepeatHomeAtSlowerRate = true;
            _Solder2Move.HomingParams.SequencePriority = 2;
            _Solder2Move.HomingParams.HomeNegative = true;
            _Solder2Move.HomingParams.StatusBit = 40;
            _Solder2Move.HomingParams.SetToZero = true;


            _CaddyDrive.HomingParams.SourceType = HOMING_ROUTINE_SOURCE_TYPE.AUTO;
            _CaddyDrive.HomingParams.DefaultThread = 4;
            _CaddyDrive.HomingParams.HomeFastVel = 2000;
            _CaddyDrive.HomingParams.HomeSlowVel = 100;
            _CaddyDrive.HomingParams.HomeLimitBit = 43;
            _CaddyDrive.HomingParams.HomeLimitState = true;
            _CaddyDrive.HomingParams.RepeatHomeAtSlowerRate = true;
            _CaddyDrive.HomingParams.SequencePriority = 4;
            _CaddyDrive.HomingParams.HomeNegative = true;
            _CaddyDrive.HomingParams.StatusBit = 43;
            _CaddyDrive.HomingParams.SetToZero = true;

        }