Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line mode protocol overflows when sending data without any delays #287

Closed
talpadk opened this issue Jul 25, 2017 · 5 comments
Closed

line mode protocol overflows when sending data without any delays #287

talpadk opened this issue Jul 25, 2017 · 5 comments

Comments

@talpadk
Copy link

talpadk commented Jul 25, 2017

Hi

I have written a small python script to send g-code data to the g2core but are getting what seems to be overflow errors in the g2core:
{“er”:{“fb”:100.26,”st”:28,”msg”:”Failed to get planner buffer – mp_get_write_buffer()”}}
{“er”:{“fb”:100.26,”st”:36,”msg”:”Failed to get planner buffer – aline()”}}

I have previously asked for help on:
https://www.synthetos.com/topics/g2core-line-mode-protocol-question/
As a probable cause would be that I simply have misunderstood the protocol, but was suggested to log an issue here.
(Basically one is allowed to have up to 4 unacknowledged commands)

I'm seeing the "bug" on an Arduino Due running the latest edge branch (SHA: af26ad8)

The python script provoking the "bug" is available here:
https://github.com/talpadk/g2coregui
(SHA: d73f999ca678c198a34cbd5875be0df71663b5fc)

I have attached the g-code / nc file I'm attempting to send
test3.txt

When I send the file without any delay I get the output inserted at the bottom.
The format starts with a timestamp followed by the "buffer state" before the line is received or send
The "buffer state" 'is number_of_unacked_send / max_number_of_unacked_allowed'
followed by direction indication and then the data received or send.

If I introduce a 0.5 second delay in the code the file is send just fine, but that is probably g-code content specific and besides goes against the idea of keeping the g2core buffer semi full at all times.

I'm expecting that the g2core is supposed to stop sending me {"r" when it has filled all its planner buffers and suspend parsing of g-code data in the serial input buffers.
But it seems to keep on "requesting" more data until it fatally runs out of planner buffers.

Any help / suggestions would be appreciated.
Regards Visti Andresen

talpa@Hermes g2coregui [master] $ ./g2coreAutoSender.py
Copy the file to send to: 'autosend.nc' when done it will be deleted!!!
Ctrl+C to stop
10:09:38:934 0/4 <- {"r":{"fv":0.99,"fb":100.26,"fbs":"100.26","fbc":"settings_test.h","hp":3,"hv":0,"id":"0084-e739-18c6-294","msg":"SYSTEM READY"},"f":[1,0,1]}
New file detected
10:09:50:078 0/4 -> {"gc":"G1 X10 F1000"}
10:09:50:078 1/4 -> {"gc":"G1 X0"}
10:09:50:078 2/4 -> {"gc":"G1 X10"}
10:09:50:078 3/4 -> {"gc":"G1 X0"}
10:09:50:089 4/4 <- {"r":{},"f":[1,0,23]}
10:09:50:089 3/4 <- {"r":{},"f":[1,0,16]}
10:09:50:089 2/4 <- {"r":{},"f":[1,0,17]}
10:09:50:089 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:089 0/4 -> {"gc":"G1 X10"}
10:09:50:099 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:099 0/4 -> {"gc":"G1 X0"}
10:09:50:109 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:109 0/4 -> {"gc":"G1 X10"}
10:09:50:120 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:120 0/4 -> {"gc":"G1 X0"}
10:09:50:130 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:130 0/4 -> {"gc":"G1 X10"}
10:09:50:141 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:141 0/4 -> {"gc":"G1 X0"}
10:09:50:151 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:151 0/4 -> {"gc":"G1 X10"}
10:09:50:161 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:162 0/4 -> {"gc":"G1 X0"}
10:09:50:172 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:172 0/4 -> {"gc":"G1 X10"}
10:09:50:182 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:182 0/4 -> {"gc":"G1 X0"}
10:09:50:192 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:192 0/4 -> {"gc":"G1 X10"}
10:09:50:203 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:203 0/4 -> {"gc":"G1 X0"}
10:09:50:213 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:213 0/4 -> {"gc":"G1 X10"}
10:09:50:224 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:224 0/4 -> {"gc":"G1 X0"}
10:09:50:234 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:235 0/4 -> {"gc":"G1 X10"}
10:09:50:245 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:245 0/4 -> {"gc":"G1 X0"}
10:09:50:256 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:256 0/4 -> {"gc":"G1 X10"}
10:09:50:266 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:267 0/4 -> {"gc":"G1 X0"}
10:09:50:277 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:277 0/4 -> {"gc":"G1 X10"}
10:09:50:288 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:288 0/4 -> {"gc":"G1 X0"}
10:09:50:298 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:298 0/4 -> {"gc":"G1 X10"}
10:09:50:309 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:309 0/4 -> {"gc":"G1 X0"}
10:09:50:320 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:320 0/4 -> {"gc":"G1 X10"}
10:09:50:330 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:330 0/4 <- {"sr":{"line":0,"posx":0,"posy":0,"posz":0,"feed":0,"vel":0,"momo":0,"stat":5}}
10:09:50:331 0/4 -> {"gc":"G1 X0"}
10:09:50:341 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:341 0/4 -> {"gc":"G1 X10"}
10:09:50:351 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:352 0/4 -> {"gc":"G1 X0"}
10:09:50:362 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:362 0/4 -> {"gc":"G1 X10"}
10:09:50:373 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:373 0/4 -> {"gc":"G1 X0"}
10:09:50:383 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:383 0/4 -> {"gc":"G1 X10"}
10:09:50:394 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:394 0/4 -> {"gc":"G1 X0"}
10:09:50:404 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:404 0/4 -> {"gc":"G1 X10"}
10:09:50:415 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:415 0/4 -> {"gc":"G1 X0"}
10:09:50:425 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:426 0/4 -> {"gc":"G1 X10"}
10:09:50:436 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:436 0/4 -> {"gc":"G1 X0"}
10:09:50:447 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:447 0/4 -> {"gc":"G1 X10"}
10:09:50:457 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:458 0/4 -> {"gc":"G1 X0"}
10:09:50:468 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:468 0/4 -> {"gc":"G1 X10"}
10:09:50:479 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:479 0/4 -> {"gc":"G1 X0"}
10:09:50:489 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:490 0/4 -> {"gc":"G1 X10"}
10:09:50:500 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:500 0/4 -> {"gc":"G1 X0"}
10:09:50:511 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:511 0/4 -> {"gc":"G1 X10"}
10:09:50:521 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:521 0/4 -> {"gc":"G1 X0"}
10:09:50:532 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:532 0/4 -> {"gc":"G1 X10"}
10:09:50:542 1/4 <- {"r":{},"f":[1,0,17]}
10:09:50:542 0/4 -> {"gc":"G1 X0"}
10:09:50:553 1/4 <- {"r":{},"f":[1,0,16]}
10:09:50:553 0/4 -> {"gc":"G1 X10"}
10:09:50:563 1/4 <- {"er":{"fb":100.26,"st":28,"msg":"Failed to get planner buffer - mp_get_write_buffer()"}}
10:09:50:563 1/4 <- {"er":{"fb":100.26,"st":36,"msg":"Failed to get planner buffer - aline()"}}
10:09:50:563 1/4 <- {"r":{},"f":[1,36,17]}
10:09:50:564 0/4 -> {"gc":"G1 X0"}
10:09:50:574 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:574 0/4 -> {"gc":"G1 X10"}
10:09:50:584 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:584 0/4 <- {"sr":{"stat":13}}
10:09:50:584 0/4 -> {"gc":"G1 X0"}
10:09:50:595 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:595 0/4 -> {"gc":"G1 X10"}
10:09:50:605 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:605 0/4 -> {"gc":"G1 X0"}
10:09:50:616 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:616 0/4 -> {"gc":"G1 X10"}
10:09:50:626 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:626 0/4 -> {"gc":"G1 X0"}
10:09:50:637 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:637 0/4 -> {"gc":"G1 X10"}
10:09:50:647 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:648 0/4 -> {"gc":"G1 X0"}
10:09:50:658 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:658 0/4 -> {"gc":"G1 X10"}
10:09:50:669 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:669 0/4 -> {"gc":"G1 X0"}
10:09:50:679 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:679 0/4 -> {"gc":"G1 X10"}
10:09:50:690 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:690 0/4 -> {"gc":"G1 X0"}
10:09:50:700 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:700 0/4 -> {"gc":"G1 X10"}
10:09:50:711 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:711 0/4 -> {"gc":"G1 X0"}
10:09:50:721 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:722 0/4 -> {"gc":"G1 X10"}
10:09:50:732 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:732 0/4 -> {"gc":"G1 X0"}
10:09:50:743 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:743 0/4 -> {"gc":"G1 X10"}
10:09:50:753 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:754 0/4 -> {"gc":"G1 X0"}
10:09:50:764 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:764 0/4 -> {"gc":"G1 X10"}
10:09:50:775 1/4 <- {"r":{},"f":[1,206,17]}
10:09:50:775 0/4 -> {"gc":"G1 X0"}
10:09:50:786 1/4 <- {"r":{},"f":[1,206,16]}
10:09:50:786 0/4 -> {"gc":"G1 X10"}
10:09:50:796 1/4 <- {"r":{},"f":[1,206,17]}
Done sending

@talpadk
Copy link
Author

talpadk commented Jul 25, 2017

While reading https://github.com/synthetos/g2/wiki/g2core-Communications specifically:

If the motion buffer is full, however, there is no room for new moves to be stored, so g2core will stop reading and parsing data lines until room is made in the motion buffer. It will continue to read control lines in any case.

it hit me that the g2core might mistake {"gc": line as control line.

Indeed if I don't wrap the g-code in json the g2core works like expected without any delays and with multiple bursts enabled too.

P.S. also the first

{"r":{"fv":0.99,"fb":100.26,"fbs":"100.26","fbc":"settings_test.h","hp":3,"hv":0,"id":"0084-e739-18c6-294","msg":"SYSTEM READY"},"f":[1,0,1]}

Could also be seen as problematic as it is an {"r" response without any "cause"
(I'm already limiting my counter to prevent this, but it is not part of the specification)

@giseburt
Copy link
Member

giseburt commented Jul 25, 2017 via email

@talpadk
Copy link
Author

talpadk commented Jul 25, 2017

I'm considering updating the wiki pages with notices that one should not send g-code using json.
(If no one objects)

g2coregui isn't much to behold quite yet

@giseburt
Copy link
Member

giseburt commented Jul 25, 2017 via email

@talpadk
Copy link
Author

talpadk commented Aug 3, 2017

I'm closing this issue as the behaviour can be described as a design decision.

Also I'm done updating the wiki to prevent others from having to experiencing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants