-
Notifications
You must be signed in to change notification settings - Fork 296
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
Comments
While reading https://github.com/synthetos/g2/wiki/g2core-Communications specifically:
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
Could also be seen as problematic as it is an {"r" response without any "cause" |
You are correct. The {"gc":...} JSON is not intended to be used externally
except in rare conditions. JSON is seen as "control" before the contents
are parsed.
Due to how we separate control from data in the incoming buffer it would
require duplicating part of the JSON parser (and the related performance
impact) to identify different types of JSON, so for now we simply consider
it all control.
There are essentially three times something gets executed:
1) immediately - if it starts with any of {!%~ and a couple of control
characters (^D, for example)
2) when the gcode is being parsed - this is all gcode not in the next
group. For JSON to run here you wrap it in a M100.1 active comment, like
this: M100.1 ({zfr:200})
3) M100 active comments is queued and executed when the motion before it is
done, synchronized with motion, M101 active comments are waits and will
pause motion after it until the true/false value in the comment matches the
actual value.
I gotta check out g2coregui. It sounds cool. Note that we have identified a
bug in some versions of Pyserial that causes it to return a partial line
and then hold on to the rest of the line an indeterminate amount of time.
…On Tue, Jul 25, 2017 at 4:12 AM Visti Andresen ***@***.***> wrote:
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)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#287 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXj0aw6GQLFBu4zk1ENIdEX5bntAFcqks5sRbFugaJpZM4OiO0Y>
.
|
I'm considering updating the wiki pages with notices that one should not send g-code using json. g2coregui isn't much to behold quite yet |
No objections here. Much appreciated.
…On Tue, Jul 25, 2017 at 12:02 PM Visti Andresen ***@***.***> wrote:
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
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#287 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXj0VuRpq35_g5piLY39wpgliBRVirzks5sRh-_gaJpZM4OiO0Y>
.
|
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. |
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
The text was updated successfully, but these errors were encountered: