Basic XY Screw Mapping - Geo Table

Moderators: TomKerekes, dynomotion

Post Reply
MadTooler
Posts: 21
Joined: Thu Nov 08, 2018 11:57 pm

Basic XY Screw Mapping - Geo Table

Post by MadTooler » Sat Mar 21, 2020 12:49 am

I am planning to fixture a glass linear scale to my 3 axis gantry router to map my rolled ball screws in X and Y. The goal is to shoot for +/-0.001" positional accuracy (not under load), but realistically would be super happy with +/- 0.002 or even 0.003. My Z is already pretty good via slight encoder count adjustment after a process with a dial indicator.

My machine has brushed DC servos via SnapAmp with max rapids of 240ipm on all axes. 28,000 encoder counts/inch X, 30,000 Y, and 20,000 Z. It is sometimes run at the full speed for full 3D surface machining.

Looking at the Geo Table documentation in the manual, wiki, and anything I could find here and on cnczone, I am a bit short of fully understanding the ideal grid size, best approach in table format, if there is already an example code for screw mapping, and if/when/where the "m_MotionParams.MaxLinearLength" value should be tweaked.

1) Grid size. I have 49" travel in both X and Y. I noted max geo table size is 4,000 x 4,000. I was considering 0.1" grid size since I have standard precision rolled screws and not that long of travel. Maybe 1" grid would be OK, but I would error on tighter if there is not a processor or speed issue. Is there a recommended size for this application or any downside to 0.1?"

2) Table format. If I am only measuring and correcting the screw travel without trying to fix skew, square, straight, or other issues at this time, would I still need a table with columns and rows of the entire table? For example, if I was using a 1"x1" grid for my 49" x 49" travel, would I have to fill in all 50 x 50 entries for 2,500 total coordinates, or is there a shortcut 2 column x 50 or something else like that?

3) Example code. I expect to be reading a Heidenhain linear glass scale with TTL output. The scale will be temporarily fixed to the table with the reader mounted to the spindle. This would allow one axis to be measured, then remounted for the other axis. My ideal plan will be to write a C program to step through the grid sizes and write the linear measured values to a file. For now, I expect this would generate two files that I would then run through excel to format into a single table. Maybe I would create a separate C program to do the consolidation, but I would have to learn how to read/write within C first. Is this all something that has been done in the examples or features I have overlooked or were you considering adding it?

4) "m_MotionParams.MaxLinearLength" adjustment. Per the various forum threads I have read on nonlinear kinematics and for fast full 3D surfacing, I believe it may be necessary to adjust this parameter for the geo table to work as desired. I think it should be changed from the default infinite value to match my grid size. Assuming that is correct, is there any access to this parameter from my custom C programs called and run from KmotionCNC, or will I have to go to "Kinematics.cpp" in the "GCodeInterpreter" directory, make that change, then recompile the entire project in VS2015?

Thanks and stay healthy.

User avatar
TomKerekes
Posts: 851
Joined: Mon Dec 04, 2017 1:49 am

Re: Basic XY Screw Mapping - Geo Table

Post by TomKerekes » Sat Mar 21, 2020 5:53 pm

Hi MadTooler,

I think you should collect the correction data then decide based on the magnitude of the correction and the shape. If it is a smooth shape like a parabola over 49 inches with only a few thousands of an inch in magnitude then a table with only several points would be adequate.

1) Grid size. I have 49" travel in both X and Y. I noted max geo table size is 4,000 x 4,000. I was considering 0.1" grid size since I have standard precision rolled screws and not that long of travel. Maybe 1" grid would be OK, but I would error on tighter if there is not a processor or speed issue. Is there a recommended size for this application or any downside to 0.1?"
The downside is memory usage. Each table entry is 4 doubles (32 bytes). PCs have lots of memory these days.

2) Table format. If I am only measuring and correcting the screw travel without trying to fix skew, square, straight, or other issues at this time, would I still need a table with columns and rows of the entire table? For example, if I was using a 1"x1" grid for my 49" x 49" travel, would I have to fill in all 50 x 50 entries for 2,500 total coordinates, or is there a shortcut 2 column x 50 or something else like that?
There is currently no shortcut.

3) Example code. I expect to be reading a Heidenhain linear glass scale with TTL output. The scale will be temporarily fixed to the table with the reader mounted to the spindle. This would allow one axis to be measured, then remounted for the other axis. My ideal plan will be to write a C program to step through the grid sizes and write the linear measured values to a file. For now, I expect this would generate two files that I would then run through excel to format into a single table. Maybe I would create a separate C program to do the consolidation, but I would have to learn how to read/write within C first. Is this all something that has been done in the examples or features I have overlooked or were you considering adding it?
See the example DiskWriteRead.c

Code: Select all

#include "KMotionDef.h"

main()
{
	FILE *f;
	char s[256];
	double a=123.456,b=999.999,c=0.001;
	double x=0,y=0,z=0;
	int result;
	
	// write 3 comma separated values to a disk file
	f=fopen("c:\\Temp\\KFlopData.txt","wt");
	fprintf(f,"%f,%f,%f\n",a,b,c);
	fclose(f);
	
	// read them back in
	f=fopen("c:\\Temp\\KFlopData.txt","rt");
	if (!f)
	{
		printf("Unable to open file\n");
		return;
	}
	
	// read a line and convert 3 doubles
	result=fscanf(f,"%lf,%lf,%lf",&x,&y,&z);
	fclose(f);
	
	printf("# values converted = %d, x=%f, y=%f, z=%f\n",result,x,y,z);
}

4) "m_MotionParams.MaxLinearLength" adjustment. Per the various forum threads I have read on nonlinear kinematics and for fast full 3D surfacing, I believe it may be necessary to adjust this parameter for the geo table to work as desired. I think it should be changed from the default infinite value to match my grid size
It doesn't necessarily have to match your grid size, but yes it makes sense to have them both smaller than some amount to limit "cord errors" caused by approximating a curve with linear segments.


is there any access to this parameter from my custom C programs called and run from KmotionCNC
no

or will I have to go to "Kinematics.cpp" in the "GCodeInterpreter" directory, make that change, then recompile the entire project in VS2015?
yes

However the linear length is also limited by the feed rate x 1/2 the Lookahead time. So for example if the feed rate is 120ipm and lookahead time is 2 seconds then the segments will be limited to: 120/60 x 1/2 x 2 = 2 inches.

Thanks and stay healthy.
You too
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply