--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/41a86c58-36fe-4f76-8164-50e62df9bc74n%40googlegroups.com.
Hi,
The G-code compression does only support the NIST
RS274NGC standard, section 3.3. As far as I've seen, there
are no "string" types defined there. 😁
I'm a bit reluctant to add string support outside the standard,
as it opens a can of works like how to escape special characters
including the quote character itself.
Personally, I find zdenko's first solution way better. The G31 K0 syntax is standards conformant and terse, as it should be.
Maybe I'll add a field for "Non-G-code characters" to the
GcodeDriver one day. When it sees one of these, it would skip
compression for that line altogether.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/2a933f74-2329-42cd-b45c-262b7ac0c498n%40googlegroups.com.
Hi,
It just occurred to me that the dot could be encoded with
backlash escaping (must be enabled on the OpenPnP driver). Then
the compression leaves it alone. This should work:
M409 K"sensors\u002EgpIn[0]\u002Evalue"
> The NIST standard unfortunately makes no provision for string parameters.
I do see the problem. As said, I might implement a way to avoid
compression altogether, when certain characters (like the
quote char) appear on a line, so it would be completely free in
syntax. Such non-standard lines should then be rare, of course.
Also note that compression is only applied when sending, not when
receiving (obviously), so the response can be anything, as long as
it is on one line.
> The NIST standard does not specify a compression
algorithm; so the algorithm you use in OpenPnP is your choice.
I humbly beg to differ 😎. NIST does specify that spaces
and tabs are allowed and to be ignored everywhere, including in
the middle of decimals (3.3).
Spaces and tabs are allowed anywhere on a line of code and do not change the meaning of the line, except inside comments. This makes some strange-looking input legal. The line “g0x +0. 12 34y 7” is equivalent to “g0 x+0.1234 y7”, for example.
It does specify exactly how decimals can and must be formatted, that the dot is optional, and even that trailing zeroes have no meaning (3.3.2.1).
... zero to many digits, followed, possibly, by (3) one decimal point, followed by (4) zero to many digits ...
A number written with initial or trailing zeros will have the same value when it is read as if the extra zeros were not there.
These are essentially the means of my simple "compression".
Removing comments is inasmuch defined in the standard (3.3.4), as
it says: "Comments do not cause a machining center to do
anything."
Removing comments is a separate option in OpenPnP, because they can legally be used to send messages.
> Might I suggest that you require the preceding character to be a digit too?
The standard allows for zero initial digits, e.g. .3, however, I should check for at least one digit left or right, as the standard says:
... provided that there is at least one digit somewhere in the number
I will do that. It would solve the above problem, but it will
still eat trailing zeroes, a dot after a digit, and any spaces,
that might still be significant inside such strings.
> Parsing the response from G31 K0
may appear to be a simple solution, but responses intended to be
human-readable are subject to change.
So G31 K0 S1 could force a machine-readable, stable output 😁
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/04d951c3-1274-4e9c-912b-cf2411fc1513n%40googlegroups.com.
> It just occurred to me that the dot could be encoded with backlash escaping (must be enabled on the OpenPnP driver). Then the compression leaves it alone. This should work:
> M409 K"sensors\u002EgpIn[0]\u002Evalue"
> Yes; but then if/when we add extra information to the G31 information, we'd need to add a new format S2 to provide machine-readable output that includes the new information.
As long as each piece of the info is labelled, you can add new
pieces. Similar to the M114 or M115 response.
In fact on Smoothie and others we use M105,
which simply reports all sensors, each labelled, usually with "label:" prefix.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/2914d7cf-e36f-4b50-84db-73283c3e4e97n%40googlegroups.com.
I do see the applications and the reasoning.
I guess the underlying issue is that AFAIK, neither NIST nor the
community attempted to standardize responses in a
"grammatical" way.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/66cfdad7-6940-4c58-af66-db0593061c58n%40googlegroups.com.
Hi,
The issue with G-code compression can now be addressed:

Details here:
https://github.com/openpnp/openpnp/pull/1515
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/88e16b92-5e4d-0bf2-bc5b-a76e9875609c%40makr.zone.
Hi Zdenko,
thanks for testing so quickly!
I think the ACTUATOR_READ_REGEX should look for "result": specifically.
Something like that (I'm no regex expert):
.*"result"[ \t]*:[ \t]*(?<Value>\d+).*If RepRapFirmware someday adds new properties to the JSON, like so
{"key":"sensors.gpIn[0].value","flags":"","result":3,"min":2,"max":5}
you're still fine.
Tested here:
_MarkTo view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/f7584e3f-70d1-4c61-90f7-e5029cb062f8n%40googlegroups.com.
2023-04-04 21:28:21.203 GcodeAsyncDriver DEBUG: serial://COM9 commandQueue.offer(M409 K"sensors.gpIn[4].value", 5000)...
2023-04-04 21:28:21.203 GcodeAsyncDriver$WriterThread TRACE: [serial://COM9] >> M409 K"sensors.gpIn[4].value"
2023-04-04 21:28:21.203 GcodeDriver$ReaderThread TRACE: [serial://COM9] << {"key":"sensors.gpIn[4].value","flags":"","result":null}
2023-04-04 21:28:21.203 GcodeDriver$ReaderThread TRACE: [serial://COM9] << ok
2023-04-04 21:28:26.212 AbstractMachine TRACE: Exception caught, executing pending motion: java.lang.Exception: Actuator "AVAC4" read error: No matching responses found.
Duet seems to respond with null
Seems to an issue on the Duet side.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/a9206e9f-c5c7-401e-b7a8-4a6f5a6ca539n%40googlegroups.com.