Save current coords to file - On 2 Page - DDCSV2.1 - Standalone CNC Motion Controller - Digital Dream Technology support
12
Return to List Add thread
Author: cnc-kursk

Save current coords to file

[Copy Link]

2

Threads

25

Posts

408

Credits

Intermediate Member

Rank: 3Rank: 3

Credits
408
Posted at 2019-3-15 09:49:58 | All floors
Last edited by 71taa In 2019-3-15 10:24 Editor

It's only my opinion, maybe the topic starter has more specific requirements.
1. The scanning G-code is being formed by users. It's up to them to define the scanning strategy, speeds, etc - in a standard G-code way
2. In the place users like to capture the coordinates, they place the call to the 'scanning macro', which works similar to probing macro (moves down, senses the probe, stops, falls back off). The coordinates of the touch point should be captured. In case if coordinates are being stored in some internal variable - we even could use standard probing macros for this stage.
In order to not overengineer things here we could assume that scanning macro always works only with Z coordinate. It's fine for majority of CNC schemes and typical appliances like levelling over uneven surfaces. Also (as we already have 3 modes of probing, and one of them is a 'custom' one)
we can use probing functionality itself, yet you have a better view of the controller capabilities and limitations.
3. Then coordinates should be stored sequentially into the file. If we have them in some variable - it could be separate call to "coordinate saving" macro. In case if we have integrated 'scanning macro' - as a part of its call
4. The format of coordinate storage in the file isn't that important, it's good to have all 4 coordinates (maybe someone needs only 3) and some delimiter between them. E.g.:
102.131;14.145;16.14;35.5
112.131;14.145;16.14;35.5
5. Why the format isn't that important comparing to the data itself? Because different external software have their own requirements and it's impossible to meet them all. So it's more efficient to post-process generated data with simplest software converter then define a lot of configuring options to the controller.
6. It's near all, except the file handling. Again we need to be minimalistic here, as a complex file handling could bring a lot of setting options, and instead of flexibility users can face difficulties.
6.1 Here we need the file definition itself (name and location). At the very minimum it could be hardcoded (in the controller) location and name on the external drive and won't be configurable by users. At maximum it could be a parameter of the macro if the controller script processing capabilities allows that. And anyting in between (like configurable location via controller settings, etc).
6.2 Probably it's good to have another macro "start/init scanning" that clears the file in the (defined) location as a preparation for a new cycle. It could be placed by users in their scanning code to form self-contaned scanning code. It will increase usabilitiy of the solution, less errors with uncontrollable growth of the file
6.3 And the last, but not least - the limitations of this solution. In case if we have some hardware limitations (size of the file, number of stored coordinates, etc) - either include them in the description and/or check limits internally, stopping capturing the coordinates as the limit is reached.


For me personally single macro for incremental writing of current coodinates on call is enough (without probing subsequence, etc). As I've tried to use HID emulating controller for simple automation and it's rather convenient (though not that reliable, as I have no feedback from the controller of course). So it will be an external control of manual DDCSV movements in step mode via "keyboard" commands (it could be done via MPG port as well), external touch probe hit detection, call to the "store coordinates" macro via extkey macro call followed by the external switching of the key2, etc. But that's clearly not a standard use



Reply Support Opposition

Use props Report

8

Threads

333

Posts

1040

Credits

Super Moderator

Rank: 8Rank: 8

Credits
1040
Posted at 2019-3-15 17:09:18 | All floors
Hi,71taa!
Thank you for your proposal. After I have integrated the opinions of Mr. cnc-kursk, I will confirm the solution and ask for your suggestions.
Reply Support Opposition

Use props Report

3

Threads

24

Posts

184

Credits

Registered member

Rank: 2

Credits
184
Posted at 2019-3-17 05:49:00 | All floors
Last edited by stivemaster In 2019-3-17 05:53 Editor

This is of course very useful. Let's say you want to scan an area of 100mm by X and 100 by Y over 5mm in order to have an unevenness to compensate it. Then the controller should stretch the sample 100 times and record the value of the variable showing the height at the touch (although Z passes this point due to the stop ramp). This value should be in XYZA format separated by a comma.
Reply Support Opposition

Use props Report

8

Threads

333

Posts

1040

Credits

Super Moderator

Rank: 8Rank: 8

Credits
1040
Posted at 2019-5-3 20:34:02 | All floors
In the attachment, I added two macro functions:
1.RecordCoords[], which can append 4 floating point numbers to the specified file on the USB flash drive. The first parameter is the file serial number, and the next 4 parameters are the recorded data.
E.g:
RecordCoords[3,10.2,5.3,0,0]
"10.2000, 5.3000, 0.0000, 0.0000" will be added to the "ProbeMap3.txt" file of the USB flash drive.
2.ClearCoords[], used to clear the contents of the coordinate file.
E.g:
ClearCoords[2]
The contents of the "ProbeMap2.txt" file of the USB flash drive will be erased.

I think that using these two macro functions, as well as the macro variables associated with the coordinate system, should be able to implement the function of plane probe.



DDCSV Coordinate System Description:

The coordinate systems in DDCSV system include machine coordinate system, G53 coordinate system and G54-G59 coordinate system.

The machine coordinate system is established by home operation or zero under MACH. Read # 864- # 867 (X, Y, Z, A) to get the position in the machine coordinate system.

G53 is based on the machine coordinate system. # 800- # 803 (X, Y, Z, A) describes the distance from the origin of the G53 coordinate system to the origin of the machine coordinate system. Adjusting these parameters can reconstruct the G53 coordinate system. Read # 868- # 871 (X, Y, Z, A) to get the position in G53.

The G54-G59 coordinate system is based on the G53 coordinate system. # 804- # 807 (G54 X, Y, Z, A), # 808- # 811 (G55 X, Y, Z, A), # 812- # 815 (G56 X, Y, Z, A), # 816- # 819 (G57 X, Y, Z, A), # 820- # 823 (G58 X, Y, Z, A) , # 824- # 827 (G59 X, Y, Z, A) respectively describe the distance from the origin of G54-G59 coordinate system to the origin of G53 coordinate system, and you can adjust these parameters to reconstruct the G54-G59;

Read #840-#843(G54 X、Y、Z、A)、#844-#847(G55 X、Y、Z、A)、#848-#851(G56 X、Y、Z、A)、#852-#855(G57 X、Y、Z、A)、#856-#859(G58 X、Y、Z、A)、#860-#863(G59 X、Y、Z、A) to get the position in G54-G59.

#516 describes the system currently working coordinate system, 0 corresponds to the G53 coordinate system, 1-6 corresponds to the G54-G59 coordinate system, 7 corresponds to the machine coordinate system.

Reading #699-#702 can get the coordinates in the current workpiece coordinate system.

test.zip

294 Bytes, Down times: 85

install.zip

586.4 KB, Down times: 101

Reply Support Opposition

Use props Report

8

Threads

333

Posts

1040

Credits

Super Moderator

Rank: 8Rank: 8

Credits
1040
Posted at 2019-5-4 08:49:49 | All floors
this is script for scanning surface by touch probe.You can modify the parameters in this file (#2038-#2047) to customize it. You can also add these parameters to the parameter file (such as eng) so that you can modify it on the parameter page.

scanning_surface.nc content:
O0001(Probe subroutine)
G90G0Z#2044
M101
G91G01Z-#2045F#2046
M102
G04P0
RecordCoords[#2047,#699,#700,#701,#702]
G90G0Z#2043
M99

O0000
#2038=5;Steps every
#2039=0;X-axis start at
#2040=0;Y-axis start at
#2041=100;X-axis end at
#2042=50;Y-axis end at
#2043=3;Clearance height
#2044=0.5;Start probing
#2045=1;Max probe distance
#2046=50robe feedrate
#2047=1;Record file serial number

ClearCoords[#2047]

G0Z#2043
G0X#2039Y#2040

IF [#2041-#2039]>=0 GOTO1
#1=-#2038
GOTO2
N1 #1=#2038
N2 IF [#2042-#2040]>=0 GOTO3
#2=-#2038
GOTO4
N3 #2=#2038
N4 #3=[#2041-#2039]/#1
#4=[#2042-#2040]/#2
#6=0

N5 #6=#6+1
#5=0
N6 #5=#5+1
M98P0001
IF #5>#3 GOTO7
G91G0X#1
GOTO6
N7 IF #6>#4 GOTO8
#1=-#1
G91G0Y#2
GOTO5
N8 G90G0X#2039Y#2040
M99



scanning_surface.zip

580 Bytes, Down times: 188

Reply Support 2 Opposition 0

Use props Report

2

Threads

25

Posts

408

Credits

Intermediate Member

Rank: 3Rank: 3

Credits
408
Posted at 2019-5-6 17:05:53 | All floors
Thanks, Ytliu - you are the best!
I'll test those routines on nearest holidays
Reply Support Opposition

Use props Report

8

Threads

333

Posts

1040

Credits

Super Moderator

Rank: 8Rank: 8

Credits
1040
Posted at 2019-5-6 18:38:33 | All floors
thank you. If the DDCS processing speed is sufficient, I am going to try to increase the auto level function on the DDCSV.
Reply Support Opposition

Use props Report

You need to log in before you can reply Login | Register now

This forum Credits Rules

Shenzhen Digital Dream Numerical Technology Co., Ltd. support
Adress:507,A Building,Leibo Industry Zone,No. 22 Jinxiu East Road,Kengzi Street,Pingshan district,Shenzhen City,P.R. of China
Phone:13244704799
E-mail:info@ddcnc.com

TEL

0755-87654321

Wchat

Website designed by DigitalDream Technology Support
Quick Reply Back to top Back to list