Need Help! 3D probing to create point cloud.


Results 1 to 6 of 6

Thread: 3D probing to create point cloud.

  1. #1
    Registered
    Join Date
    Oct 2008
    Location
    USA
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default 3D probing to create point cloud.

    Hello,
    I have very little experience with C programming.
    I’m am looking for a C program to probe a 3D surface and create the output file in a comma-delimited file or another format to create a point cloud. File will be used to create a 3D machining program.
    I’m only using Kflop, Kanalog, Konnect, &KMotionCNC to run my machine which is a custom retrofit from a Yamaha X Y Z robot.

    Also, I have a G-Code program that I found online. It uses G38.3 and macro variables. is there a plan to add G38.x Straight probe to the EMC.var file?

    Similar Threads:


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

    Default Re: 3D probing to create point cloud.

    Hi eng101,

    Can you describe in detail how and what strategy you would wish to use to do the probing?

    Do you have your probe interfaced to KFLOP?

    We don't have plans to add G38.x but you should be able to do the equivalent with custom MCodes.

    See this Thread (you might ask if JoeKumanchik is willing to share his code):
    https://www.cnczone.com/forums/dynom...ml#post1999582

    Here is a basic ProbeDirection.c example:

    Code:
    #include "KMotionDef.h"
    
    // For basic KMotionCNC Probing configure KMotionCNC to call this C Program
    // with an MCode and 3 parameters P Q R passed in variables 50,51,52 to 
    // specify the X Y Z Probe directions speeds
    //
    // Modify this program for the input bit you are using for your probe.  As
    // written the program keeps moving until the bit goes high.  If the polarity
    // of your probe is opposit this then remove the NOT Symbol '!' applied to the
    // ReadBit result. 
    //
    // For Example:
    //
    // M100 = Exec/Wait/Sync  Thread 2 Var 50 <>\C programs\ProbeDirection.c
    //
    // Then to probe in the X direction at 100 counts/sec use GCode as:
    //
    // M100 P100 Q0 R0
    //
    // Then to probe in the Y direction at 50 counts/sec use GCode as:
    //
    // M100 P0 Q50 R0
    //
    // 
    
    main()
    {
    	Jog(0,*(float *)&persist.UserData[50]);	// move in the velocites specified
    	Jog(1,*(float *)&persist.UserData[51]);
    	Jog(2,*(float *)&persist.UserData[52]);
    
    //	printf("X Y Z Speeds = %f %f %f\n",
    //		*(float *)&persist.UserData[50],
    //		*(float *)&persist.UserData[51],
    //		*(float *)&persist.UserData[52]);
    
    	while (!ReadBit(46)) ;   		// wait for switch to go high
    
    	Jog(0,0); 						//Stop
    	Jog(1,0);
    	Jog(2,0);
    }
    Doing all the probing in KFLOP in C rather than in the PC in GCode would probably be somewhat faster if that is an issue.


    Here is a code fragment writing CSV data to a disk file taken from the CaptureXYZMotionToFile.c example.
    Code:
    	p=gather_buffer;
    
    	FILE *f=fopen("C:\\temp\\kflopdata.txt","wt");
    	for (i=0; i<N; i++)
    	{
    		// round times to neaarest servo tick
    		
    		p[0] = ((int)(p[0]/TIMEBASE + 0.5))*TIMEBASE;
    		fprintf(f,"%16.9f,%16.3f,%16.3f,%16.3f\n",p[0],p[1],p[2],p[3]);
    		p += 4;
    	}
    	fclose(f);
    Regards

    TK
    http://dynomotion.com


  3. #3
    Registered
    Join Date
    Oct 2008
    Location
    USA
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default Re: 3D probing to create point cloud.

    My strategy would be a XY grid and probe in Z. I'm currently using my tool setter as a probe for testing.
    I have read your post to JoeKumanchik and I have contacted him.
    I am learning, I have a little understanding about using three M codes, Open file, Probe and loop, then close file.
    I have a program that uses Subroutines in the form of O1 and Looping: do, while, endwhile as well as Conditional: if, else, endif.
    When I try to run it KmotionCNC gives me G code error; Unknown word starting with F. example o3 if [#1202 lt #1201]
    Does KmotionCNC support the execution of Logical expressions

    Thank you,



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

    Default Re: 3D probing to create point cloud.

    Hi eng101,

    KMotionCNC can do subroutine loops and conditionals, but not with 'if' and 'while' statements.

    You would need to re-write the program in a form of something like a subroutine to do a row and a subroutine to do a grid point. Then loop the subroutines the appropriate number of times.

    Here are some examples (from the SubroutineWithConditionals.ngc example):
    Code:
    G20
    #100 = 5
    
    (examples of logical operations)
    (result is 1 if condition is true)
    (result is 0 if condition is false)
    
    #101 = [#100 >  5]
    #102 = [#100 >= 5]
    #103 = [#100 <  5]
    #104 = [#100 <= 5]
    #105 = [#100 =  5]
    #106 = [#100 <> 5]
    
    (subroutine call can be looped a number of times)
    (the L or Q word may be used to specify the count)
    (if neither L or Q is specified a count of 1 is used)
    (if the count is 0 the subroutine will not be called at all)
    
    M98 P1 L3  (example using L to specify the loop count)
    M98 P1 Q3  (example using Q to specify the loop count)
    
    M98 P1 L#100  (example using a variable loop count)
    
    M98 P1 L[5 > 4]  (example using a conditional as a loop count)
    M2
    
    O1
    #200 = [#200+1]
    M99
    HTH
    Regards

    TK
    http://dynomotion.com


  5. #5
    Registered
    Join Date
    Oct 2008
    Location
    USA
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default Re: 3D probing to create point cloud.

    Hello Tom,

    This is my current Version of software.
    KFLOP 4.33 Build 18:05:42 Dec 1 2015

    I tried running the SubroutineWithConditionals the programs runs but when I tried to modify a statement

    [#100 > 5] GOTO 10 ( GCode Error: Unknown word where unary operation could be
    M98 P1
    N10

    Is this error do to the software Version?
    Also I am running on a laptop with Windows XP Professional service Pack 3.
    Please recommend latest version of software to run.

    Thank you,



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

    Default Re: 3D probing to create point cloud.

    Hi eng101,

    GOTO is not supported. Instead there is M98 which is a subroutine call. The P parameter indicates which subroutine to jump to (with a matching O word). The L parameter (loop count) can be used as the number of times to call the subroutine. A conditional expression for the L parameter when evaluated to be 1 (true) or 0 (false) can be used to call a subroutine one time or zero times (not at all).

    The latest Releases can be found here, but none support IF, WHILE, or GOTO:
    Dynomotion

    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

3D probing to create point cloud.

3D probing to create point cloud.