Need Help! Coordinated Motion


Results 1 to 16 of 16

Thread: Coordinated Motion

  1. #1
    Registered
    Join Date
    Apr 2015
    Posts
    9
    Downloads
    0
    Uploads
    0

    Arrow Coordinated Motion

    Hello guys!


    I'm trying to get to know to the coordinated motion. I figured out a circle path in xy plate, but I can not move the Z axis after the circle is done. I used several functions like StraightTraverse or StraightFeed non of them were helpful so far.
    I appreciate it if you could help me what function should I use to move the Z axis?

    Please check out the following is my code.



    Code:
    void CV1Dlg::OnBnClickedButton2()
    {
    	// TODO: Add your control notification handler code here
    
    
    
    
    	KM = new CKMotionDLL(0);  // create as board 0
    	CM = new CCoordMotion(KM);
    
    
    
    
    	char response[MAX_LINE];
    
    
    
    
    	MOTION_PARAMS *p=CM->GetMotionParams();
    
    
    	p->BreakAngle = 30;
    
    
    	p->MaxAccelX = 100; //100 for circle
    	p->MaxAccelY = 100;
    	p->MaxAccelZ = 100;
    
    
    	p->MaxVelX = 2000;  // 2000 for circle
    	p->MaxVelY = 2000;
    	p->MaxVelZ = 50000;
    
    
    	p->CountsPerInchX = 100;
    	p->CountsPerInchY = 100;
    	p->CountsPerInchZ = 100;
    	
    	//p->DegreesA = p->DegreesB = p->DegreesC = FALSE; 
    	p->ArcsToSegs = true;
    
    
    
    
    	CM->SetTPParams();  // Apply motion parameters to the Trajectory Planner
    
    
    	
    	CM->SetAbort();
    	CM->ClearAbort();
    
    
    	CM->SetStraightTraverseCallback(StraightTraverseCallback);
    	CM->SetStraightFeedCallback(StraightFeedCallback);
    	CM->SetArcFeedCallback(ArcFeedCallback);
    
    
    	
    	double Speed = 50; //inch/sec
    
    
    	int result = CM->ReadCurAbsPosition(&CM->current_x,&CM->current_y,&CM->current_z,
    										&CM->current_a,&CM->current_b,&CM->current_c,true);
    
    
    
    
    	
    
    
    	
    	
    
    
    	// set 2 bits
         if (KM->WriteLine( "Jog03=50"))		MyError();
    	 if (KM->WriteLine( "Jog04=450"))		MyError();
    
    
    
    //Draw a circle
    	CM->DoKMotionBufCmd("SetBitBuf0");
        CM->ArcFeed(Speed,CANON_PLANE_XY,0.0000, 0.5000, 0.0000, 150, DIR_CCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
    	CM->DoKMotionBufCmd("ClearBitBuf0");
    
    
    //Move z-axis
    	CM->StraightFeed(Speed, 0.0, 0.0, -10.0, 0.0, 0.0, 0.0, 0, 0);
    
    
    //Draw a circle
    	CM->DoKMotionBufCmd("SetBitBuf0");
            CM->ArcFeed(Speed,CANON_PLANE_XY,0.0000, 0.5000, 0.0000, 150, DIR_CCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
    	CM->DoKMotionBufCmd("ClearBitBuf0");
    
    
    	
    
    
    
    
    
    
    	  if (KM->WriteLine( "Jog03=0"))		MyError();
    
    
    
    
    	if (KM->WriteLine( "Jog04=0"))		MyError();
    
    
    
    }


    Thanks,

    Similar Threads:
    Last edited by rfv; 05-04-2015 at 07:31 PM.


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi rfv,

    You are mixing Independent Axis Jog commands with Coordinated Axis Motion. You can't simultaneously tell an axis to Jog and follow a Coordinated motion Path at the same time. Why did you add the Jogs? Try removing them.

    You are also missing a "Flush" command at the end. This is necessary to download the last portion of the coordinated motion path, terminate the path, and to start executing the motion if it hasn't already received enough motion to start.

    Why did you remove it from the example? Such as:

    CM->FlushSegments();


    HTH

    Regards
    TK

    Regards
    TK http://dynomotion.com


  3. #3
    Registered
    Join Date
    Apr 2015
    Posts
    9
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi Tom,

    I haven't used the Jog and coordinated motion for the same axis. The Jog is for my bits (axes 3 and 4), while I'm using coordinated motion command for XYZ (0,1,2). The reason I used the Jog is that I want bits perform simultaneously while XYZ Axes follow the coordinated motion path. Is there any coordinated motion command that I can replace it by jog with the same functionality?




    Please also let me elaborate more my previous question. In my setup I have a linear motor with the following specification for the Z axis:

    Shop Haydon Kerk & Pittman - Linear Actuators - 43H4C-2.33-815123

    I can not run it with coordinated motion commands such as StraightTraverse or StraightFeed. I have also tried several configuration for its parameters (MaxAccelZ,MaxAccelZ,CountsPerInchZ), but non of them helped me to run the motor. The motor itself works fine, I just need to know if I'm missing any command or configuration in my previously attached code? Do I need to consider any specific configuration in setting the motor parameters?

    Best,



  4. #4
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi rfv,

    Oh I didn't realize those were not part of the coordinated motion system. You didn't tell us how you defined the coordinate motion system. Maybe that is the problem. In your C Program how have you defined your axes using the DefineCoordSystem() call? To define a system of xyz as axes 0,1,2 it should be:

    DefineCoordSystem(0,1,2,-1);

    I don't understand your reference to "bits". Activating I/O bits is different from Jogging Axis or why you would do so when calculating the coordinated motion path.

    Have you now included the Flush command?

    Regards

    Regards
    TK http://dynomotion.com


  5. #5
    Registered
    Join Date
    Apr 2015
    Posts
    9
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Quote Originally Posted by TomKerekes View Post
    Hi rfv,

    Oh I didn't realize those were not part of the coordinated motion system. You didn't tell us how you defined the coordinate motion system. Maybe that is the problem. In your C Program how have you defined your axes using the DefineCoordSystem() call? To define a system of xyz as axes 0,1,2 it should be:

    DefineCoordSystem(0,1,2,-1);

    I don't understand your reference to "bits". Activating I/O bits is different from Jogging Axis or why you would do so when calculating the coordinated motion path.

    Have you now included the Flush command?

    Regards

    Thank you Tom for your help.
    I have another question about the functions in the coordinated motion.
    1. I need to know more about the parameters of CM->ArcFeed
    How can I configure if for a portion of a circle for example. Currently I am using
    CM->ArcFeed(Speed,CANON_PLANE_XY,0.0000, 0.5000, 0.0000, 2, DIR_CCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);

    and I am getting a full circle .

    2. How can I blend the functions for example a half circle followed by a straight line. Currently I am using StraightFeed function after ArcFeed but the acceleration and deceleration of the motors prevent to have a consistent toolpath.



  6. #6
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi rtv,

    #1 - the end point defines what part of the circle is made - just like GCode

    #2 - Does the transition from the Arc Feed to the Straight Feed form an angle greater than the "Break Angle" set in the Trajectory Planner?

    Regards

    Regards
    TK http://dynomotion.com


  7. #7
    Registered
    Join Date
    Apr 2015
    Posts
    9
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Thank you Tom,
    Yes, I have defined the break angle.
    In fact, I am a little bit confused. Please correct me if I am wrong
    I guess there are two ways to work with motion control.
    1. C program : I should initialize the axises and coordinate system in the C program of the KMotion, if yes, how can I input my motion program and toolpath?

    2. ( This is my preference) I would like to use CoordMotion.h in C++. I can initilize the motors and coordinate system using the example you have included. if this is true, how can I input my toolpath( motion program) if I use this option



  8. #8
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi rfv,

    Yes I would recommend using our CoordinatedMotion Libraries as you have been doing. I don't really understand your question. I thought you wanted to generate the tool path yourself and not use GCode. In that case you would make ArcFeed, StraightFeed, etc... calls as you have been doing to define the tool path.

    BTW you can initialize the axes, enable the axes, define the Coordinate System, and so forth from either Script Commands from the PC program or a C Program in KFLOP. It doesn't really matter. The SimpleCoordinatedMotion example is trying to be simple and not involve an external C Program that needs to be executed and so forth. But overall using a C Program is probably simpler and can provide other advantages. You can download and execute a C program in KFLOP from the PC C++ program with two simple calls.

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  9. #9
    Registered
    Join Date
    Apr 2015
    Posts
    9
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hello Tom,

    Since I had a little background on C++, I started to develop a PC C++ program and with a GUI to control my axes. I found SimpleCoordinatedMotion as a perfect starting point. In my current program I initialize, enable and define the axes with C Program using InitKStep6AxisSpindleAxis6. Later I use CoordinatedMotion Libraries and ArcFedd, StraightFeed, etc functions in my PC C++ application to generate toolpath rather than using the GCode. Everything works great till here.

    The only remained part is that I am not capable of running more than the first two axes (0 and 1) with coordinated motion commands. For example when I execute "CM->StraightFeed(Speed, 100, 100, 100, 100, 0.0, 0.0, 0, 0);" Z and A axes is not moving and the only motions I can get is X and Y movements. I basically used the SimpleCoordinatedMotion as the reference and as you previously mentioned I added CM->FlushSegments(); but it seems I'm still missing something. Please find my code is attached below. How can I get other axes to work then?

    Code:
    
    #include "stdafx.h"
    #include "CoordMotion.h"
    
    // Global Variables
    
    CKMotionDLL *KM;
    CCoordMotion *CM;
    
    int count=0;  // just count the callbacks
    
    void StraightTraverseCallback(double x, double y, double z, int sequence_number)
    {
    	count++;
    }
    	
    void StraightFeedCallback(double DesiredFeedRate_in_per_sec,
    							   double x, double y, double z, int sequence_number, int ID)
    
    {
    	count++;
    }
    
    void ArcFeedCallback(bool ZeroLenAsFullCircles, double DesiredFeedRate_in_per_sec, 
    			    CANON_PLANE plane,
    				double first_end, double second_end, 
    		        double first_axis, double second_axis, int rotation,
    				double axis_end_point,
    				double first_start, double second_start, double axis_start_point, int sequence_number, int ID)
    {
    	count++;
    }
    
    
    void CV1Dlg::OnBnClickedButton2()
    {
    	// TODO: Add your control notification handler code here
    
    
    	KM = new CKMotionDLL(0);  // create as board 0
    	CM = new CCoordMotion(KM);
    
    
    	char response[MAX_LINE];
    
    
    	MOTION_PARAMS *p=CM->GetMotionParams();
    
    	p->BreakAngle = 30;
    
    	p->MaxAccelX = 100;
    	p->MaxAccelY = 100;
    	p->MaxAccelZ = 100;
            p->MaxAccelA = 100;        
    
    	p->MaxVelX = 2000;
    	p->MaxVelY = 2000;
    	p->MaxVelZ = 2000;
            p->MaxVelA = 2000;
    
    	p->CountsPerInchX = 100;
    	p->CountsPerInchY = 100;
    	p->CountsPerInchZ = 100;
            p->CountsPerInchA = 100;
    	
    	//p->DegreesA = p->DegreesB = p->DegreesC = FALSE; 
    	p->ArcsToSegs = true;
    
    
    	CM->SetTPParams();  // Apply motion parameters to the Trajectory Planner
    
    	
    	CM->SetAbort();
    	CM->ClearAbort();
    
    	CM->SetStraightTraverseCallback(StraightTraverseCallback);
    	CM->SetStraightFeedCallback(StraightFeedCallback);
    	CM->SetArcFeedCallback(ArcFeedCallback);
    
    	
    	double Speed = 50; //inch/sec
    
    	int result = CM->ReadCurAbsPosition(&CM->current_x,&CM->current_y,&CM->current_z,
    										&CM->current_a,&CM->current_b,&CM->current_c,true);
    
    
    	CM->StraightTraverse(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);  // jump back to zero
    
    
             CM->StraightFeed(Speed, 100, 100, 100, 100, 0.0, 0.0, 0, 0); // Move X,Y,Z, and A 100 units, but the only thing I get is X and Y moving 100
    
    
              CM->FlushSegments();
    	   return 0;
    }
    Best,



  10. #10
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi rtv,

    How have you initialized your axes? Have you defined a 4 Axes Coordinate Ssyetem with something like:

    DefineCoordSystem(0,1,2,3);

    Regards

    Regards
    TK http://dynomotion.com


  11. #11
    Registered
    Join Date
    Apr 2015
    Posts
    9
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Thank you Tom!

    Seems working now! DefineCoordSystem(0,1,2,3); solved my problem for 3 axes.

    Would it be also possible to have 2 exclusive independent Coordinated Systems? Can I have X,Y,Z axis in one Coordinated System and A axes in another one? Actually I need to control these 2 coordinated systems independently at the same time.

    Best,
    Aref



  12. #12
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi Aref,

    We don't currently have the capability of multiple coordinated motion systems. But if you remove the A axis from the coordinated motion system you can move the A Axis independently while the XYZ Axis are simultaneously performing coordinated motion. Can you be more specific on what would command or trigger the A Axis to move?

    Regards

    Regards
    TK http://dynomotion.com


  13. #13
    Registered
    Join Date
    Mar 2013
    Location
    United States
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi Tom,
    We are working on building a waterjet machine. I believe you have interacted with my father, Shannon Davenport, on various issues in the past.
    I need to be able to control the Z and A axis while coordinated motion is happening. I have removed Z and A from coordinated motion while running, but cant find a way to control them. Per your thread here:

    "Can you be more specific on what would command or trigger the A Axis to move?" I would like to use keyboard buttons input as if it were in coordinated motion. (page up, page down, etc)

    Any suggestions?



  14. #14
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi Caleb,

    I can't think of an easy way to do that. The Jog buttons are tied to the coordinated motion axes.

    You could use external buttons to jog axes.

    Or you could create User Buttons to move Z or A. But they wouldn't work quite like momentary Jog Buttons. They could move relative amounts (like steps). Or you could have one button to start jogging and another to stop.

    Maybe you could explain specifically in more detail what you are trying to do?

    Regards

    Regards
    TK http://dynomotion.com


  15. #15
    Registered
    Join Date
    Mar 2013
    Location
    United States
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Thanks for the reply,
    The end result that we need to accomplish:
    Our machine is an XY gantry. The height of the head is Z. while cutting, sometimes the materials will warp so we need to be able to raise or lower Z on the fly during Gcode running.
    In searching the forums I found this post. Could I use this to enable to jog buttons for the Z? I tried it but didnt seem to work. Do I need a different file to make it work?
    "
    Jogging is not normally allowed while GCode is executing. How do you intend to move? Using the KMotionCNC Jog Buttons? External buttons or MPG? Probe Motion? You might consider displaying a Message in the GCode and then stopping with M0. After the tool change and positioning the tool tip to a surface you could then press cycle start to resume. Otherwise if you wish to allow KMotionCNC to Jog while running GCode there are new KFLOP to KMotionCNC commands in the later Test Versions to allow this (see in PC_DSP.h):

    #define PC_COMM_ENABLE_JOG_KEYS 37 // Allow User to Push Jog Buttons while JOB is running
    #define PC_COMM_DISABLE_JOG_KEYS 38 // Disable allowing User to Push Jog Buttons while Job is Running
    "



  16. #16
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Coordinated Motion

    Hi caleb,

    No I don't think that would work. The only time Jogging would work while GCode is running is when coordinated motion is paused for something like a tool change of tool probe. During Coordinated Motion all the Coordinated Motion Axes are being actively driven. If the Z axis is removed from the Coordinated Motion System then KMotionCNC won't let you Jog Z because no KFLOP axis is defined as Z. I can't think of an easy way to allow that without a number of source code changes.

    As I stated earlier external Z Jog Buttons could work.

    Normally for this type of situation some sort of probe or sensor is used to measure the Jet Height above the material. That way the Z height can automatically track the surface very accurately. Something like an LVDT (Linear Voltage to Distance Transducer) feeding back the height. Or even something like a spring loaded "foot" with a microswitch.

    Regards

    Regards
    TK http://dynomotion.com


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Coordinated Motion

Coordinated Motion