POSITION_REPORT_REGEX with subdriver

343 views
Skip to first unread message

randomname

unread,
Oct 25, 2019, 3:11:12 PM10/25/19
to OpenPnP
Hello friends!

Could it be that the subdriver is not allowed to update openpnp via POSITION_REPORT_REGEX?

This is my goal: I have an absolute potentiometer on my Z-stepper. It´s position is read out via pwm by the subdriver (Arduino promicro). When the machine connects, the subdriver should tell openpnp where the Z position is, Z should move to an "zero" position and then the maindriver should home normally without Z.

I´m sending M114 to the subdriver and it returns the actual Z position. - since it is an arduino, i can tell it to send whatever i want to, so i tried to emulate what others send.

I tried to test it with my Marlin / ReArm maindriver in openpnp and it works.. but only the subdriver knows the real Z-position.

What i´ve noticed is, that if my POSITION_REPORT_REGEX is matching, i´ll get an "ok" in the trace debug. And if it´s not matching, it will print out the received serial data and not just only "ok".
This is the same for the main and subdriver.. but if i not specify the c1 and c2 for the regex in the maindriver, i´ll get a warning that it´s missing - on the subdriver i only get "ok".

Notice i´m printing the "ok" after the POSITION_REPORT_REGEX string. This is the same on the Marlin/ReArm.

Can somebody confirm that updating the regex via subdriver is working? I could find other ways to implement it outside of openpnp, but this would be more complicated.

Thanks!
Steffen

Mike Menci

unread,
Oct 29, 2019, 5:10:15 PM10/29/19
to OpenPnP
You have two nozzles  or one ? on Z ?   Open PnP 2.0 or 1.0 ?
Mike

Steffen Esser

unread,
Oct 30, 2019, 4:52:48 PM10/30/19
to ope...@googlegroups.com
Hi Mike!
I do have two nozzles on one Z-Stepper. Open PnP 1.0 on Win7. Maybe i should try it Open PnP 2.0 first.. or do you have an idea?

At the moment i´m thinking about serial or i2c communication between the two drivers.. but it would be wonderful if i could send it via Open PnP.

I have 30mm travel for the Z and the sensor gives me about 0.08mm accuracy via PWM on that, this should be enough to ditch a limit-switch and - most important - i can lift the nozzles to safe Z before homing. If it´s working, i can program the sensor via i2c and probably get an even better accuracy with slower readings.. 

Thanks!
Steffen 



--
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/d1716e43-a831-4e22-abd8-b4d020293b3c%40googlegroups.com.

Mike Menci

unread,
Oct 31, 2019, 2:38:46 AM10/31/19
to OpenPnP
You need V2 than. It will work with one limit middle of Z homing !
Mike

Steffen Esser

unread,
Oct 31, 2019, 7:29:14 AM10/31/19
to ope...@googlegroups.com
Ok, I’ll try the V2 first. Thanks!


Am Donnerstag, 31. Oktober 2019 schrieb Mike Menci <mike....@gmail.com>:
You need V2 than. It will work with one limit middle of Z homing !
Mike

--
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.

Steffen Esser

unread,
Oct 31, 2019, 5:00:22 PM10/31/19
to ope...@googlegroups.com
I tried V2 and managed to get to what i´ve been in V1.. but the Problem is still the same.

I switched the subdriver and maindriver com-ports to verify it´s working when the Position_Report_Regex is coming from the maindriver (that works fine), but it still gets ignored when coming from the subdriver.
The interesting thing is, that it´s throwing errors when the regex is not matching.. so it´s accepting it as valid input, but doesn´t change the coordinates.

Maybe i should look at some scripts and find a way to read the value from the subdriver, accept it as openpnp´s Z-location and send the Z-position to the maindriver via G92.
This could be more easy than reading pwm as an absolute encoder inside marlin 2.

Can you tell me more about the middle Z homing? Is it working within the gcodedriver from openpnp, or the z-probe part? Is there an example for the z-probe part? I´ve tried to make an z-probe actuator and it could read from the subdriver via the actuator button, like it does with the vacuum sensors, but i don´t know how to process the data to the actual Z-position, or in general, process it further.

Thanks!

This is the axies part in the machine.xml:

-<axes class="java.util.ArrayList">

-<axis name="x" type="X" home-coordinate="0.0">
-<head-mountable-ids class="java.util.HashSet">
<string>*</string>
</head-mountable-ids>
</axis>

-<axis name="y" type="Y" home-coordinate="0.0">
-<head-mountable-ids class="java.util.HashSet">
<string>*</string>
</head-mountable-ids>
</axis>

-<axis name="z" type="Z" home-coordinate="0.0">
-<head-mountable-ids class="java.util.HashSet">
<string>N1</string>
<string>N2</string>
</head-mountable-ids>

-<transform class="org.openpnp.machine.reference.driver.GcodeDriver$NegatingTransform">
<negated-head-mountable-id>N2</negated-head-mountable-id>
</transform>
</axis>

-<axis name="c1" type="Rotation" home-coordinate="0.0">
-<head-mountable-ids class="java.util.HashSet">
<string>N1</string>
</head-mountable-ids>
-<pre-move-command>
<![CDATA[ T0S1 G92E{Coordinate:%.4f} ]]>
</pre-move-command>
</axis>

-<axis name="c2" type="Rotation" home-coordinate="0.0">
-<head-mountable-ids class="java.util.HashSet">
<string>N2</string>
</head-mountable-ids>
-<pre-move-command>
<![CDATA[ T1S1 G92E{Coordinate:%.4f} ]]>
</pre-move-command>
</axis>

</axes>

and this my regex:

<![CDATA[X:(?<x>-?\d+\.\d+) Y:(?<y>-?\d+\.\d+) Z:(?<z>-?\d+\.\d+) C1:(?<c1>-?\d+\.\d+) C2:(?<c2>-?\d+\.\d+) .*]]>

Mike Menci

unread,
Oct 31, 2019, 6:23:22 PM10/31/19
to OpenPnP
Here a short video ; https://youtu.be/clSgZcXOxtI
Search in this forum for Shared Z homing under Open PnP 2 - Mark made a script and Github page for use...
(I’m out on mobile phone - can’t find it right now..)
Mike

Steffen Esser

unread,
Oct 31, 2019, 7:02:01 PM10/31/19
to ope...@googlegroups.com
I think this is the github link you mean:  https://github.com/Smoothieware/Smoothieware/pull/1423#pullrequestreview-279335054

right? This is pretty smart, but unfortunately only for smoothie.. i´m using Marlin. And since i always know where Z is, it´s only a solution if everything else is failing.
But i´m not giving up..
I think i´ll change marlins homing routine to read the Z-value via i2c from the subdriver and set it´s Z position by itself.
Or maybe the Z-probe thing is a way of forcing it to accept the position.. but i´m not really getting how it´s supposed to work inside open pnp.
The position regex update via subdriver would still be the best way to deal with it,

Anyway, thanks for the reply!
Steffen


--
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.

Jason von Nieda

unread,
Oct 31, 2019, 7:20:51 PM10/31/19
to ope...@googlegroups.com
Hi Steffen, I think the issue is probably that you have the axis defined on the wrong driver. What you are describing should work fine. Please post your machine.xml and a log showing the problem.

Jason


--
Sent from my BeOS enabled toaster

Steffen Esser

unread,
Oct 31, 2019, 7:48:24 PM10/31/19
to ope...@googlegroups.com
Hi Jason,


this is the log with the machine.xml it´s seeing it as ok but nothing happens:

2019-11-01 00:36:26.508 Main DEBUG: Bienvenue, Bienvenido, Willkommen, Hello, Namaskar, Welkom, Bonjour to OpenPnP version 2019-10-31_02-00-49.0279d65.
2019-11-01 00:36:58.577 ReferenceMachine DEBUG: setEnabled(true)
2019-11-01 00:37:02.208 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 00:37:02.461 GcodeDriver DEBUG: sendCommand(serial://COM23 null, 250) => []
2019-11-01 00:37:02.462 GcodeDriver DEBUG: sendCommand(G21 ; Set millimeters mode, 5000)...
2019-11-01 00:37:02.465 GcodeDriver DEBUG: sendCommand(serial://COM23 G21 ; Set millimeters mode, 5000) => [echo:Unknown command: "G21 ", ok]
2019-11-01 00:37:02.466 GcodeDriver DEBUG: sendCommand(G90 ; Set absolute positioning mode, 5000)...
2019-11-01 00:37:02.467 GcodeDriver DEBUG: sendCommand(serial://COM23 G90 ; Set absolute positioning mode, 5000) => [ok]
2019-11-01 00:37:02.468 GcodeDriver DEBUG: sendCommand(M82 ; Set absolute mode for extruder, 5000)...
2019-11-01 00:37:02.469 GcodeDriver DEBUG: sendCommand(serial://COM23 M82 ; Set absolute mode for extruder, 5000) => [ok]
2019-11-01 00:37:06.108 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 00:37:06.360 GcodeDriver DEBUG: sendCommand(serial://COM22 null, 250) => []
2019-11-01 00:37:22.030 GcodeDriver DEBUG: sendCommand(M114, 5000)...
2019-11-01 00:37:22.037 GcodeDriver DEBUG: sendCommand(serial://COM22 M114, 5000) => [ok]
2019-11-01 00:37:56.372 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 00:37:56.384 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 00:38:00.256 MainFrame INFO: Shutting down...
2019-11-01 00:38:00.538 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 00:38:00.540 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 00:38:01.483 MainFrame INFO: Shutdown complete, exiting.

this is what comes in when i remove my regex in the subdriver (just for reference, to see what goes in):

2019-11-01 00:38:59.896 Main DEBUG: Bienvenue, Bienvenido, Willkommen, Hello, Namaskar, Welkom, Bonjour to OpenPnP version 2019-10-31_02-00-49.0279d65.
2019-11-01 00:39:25.174 ReferenceMachine DEBUG: setEnabled(true)
2019-11-01 00:39:28.788 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 00:39:29.057 GcodeDriver DEBUG: sendCommand(serial://COM23 null, 250) => []
2019-11-01 00:39:29.058 GcodeDriver DEBUG: sendCommand(G21 ; Set millimeters mode, 5000)...
2019-11-01 00:39:29.063 GcodeDriver DEBUG: sendCommand(serial://COM23 G21 ; Set millimeters mode, 5000) => [echo:Unknown command: "G21 ", ok]
2019-11-01 00:39:29.064 GcodeDriver DEBUG: sendCommand(G90 ; Set absolute positioning mode, 5000)...
2019-11-01 00:39:29.097 GcodeDriver DEBUG: sendCommand(serial://COM23 G90 ; Set absolute positioning mode, 5000) => [ok]
2019-11-01 00:39:29.098 GcodeDriver DEBUG: sendCommand(M82 ; Set absolute mode for extruder, 5000)...
2019-11-01 00:39:29.101 GcodeDriver DEBUG: sendCommand(serial://COM23 M82 ; Set absolute mode for extruder, 5000) => [ok]
2019-11-01 00:39:32.724 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 00:39:32.976 GcodeDriver DEBUG: sendCommand(serial://COM22 null, 250) => []
2019-11-01 00:39:38.095 GcodeDriver DEBUG: sendCommand(M114, 5000)...
2019-11-01 00:39:38.100 GcodeDriver DEBUG: sendCommand(serial://COM22 M114, 5000) => [X:30.00 Y:30.00 Z:13.39 C1:30.00 C2:30.00 END, ok]
2019-11-01 00:39:56.748 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 00:39:56.778 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 00:40:56.222 ReferenceMachine DEBUG: setEnabled(true)
2019-11-01 00:40:59.155 MainFrame INFO: Shutting down...
2019-11-01 00:40:59.436 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 00:40:59.440 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 00:41:00.859 MainFrame INFO: Shutdown complete, exiting.

Com23 is the main driver, 22 the sub driver..

Thanks!
 

machine.xml

Jason von Nieda

unread,
Nov 1, 2019, 11:10:31 AM11/1/19
to ope...@googlegroups.com
Hi Steffen,

It looks like you do not have TRACE logging turned on. I apologize - I should have mentioned that. Could you set logging to TRACE and perform the same test as you've done above and send the log? See https://github.com/openpnp/openpnp/wiki/FAQ#how-do-i-turn-on-debug-logging

Thanks,
Jason


Steffen Esser

unread,
Nov 1, 2019, 11:42:19 AM11/1/19
to ope...@googlegroups.com
Ha, now i feel a bit dumb, that i´ve overlooked the dropdown window to enable TRACE.. now the log makes more sense:)

Here again with the regex in the subdriver:

-11-01 16:31:12.494 Main DEBUG: Bienvenue, Bienvenido, Willkommen, Hello, Namaskar, Welkom, Bonjour to OpenPnP version 2019-10-31_02-00-49.0279d65.
2019-11-01 16:31:24.694 ReferenceMachine DEBUG: setEnabled(true)
2019-11-01 16:31:28.337 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 16:31:28.589 GcodeDriver DEBUG: sendCommand(serial://COM23 null, 250) => []
2019-11-01 16:31:28.590 GcodeDriver DEBUG: sendCommand(G21 ; Set millimeters mode, 5000)...
2019-11-01 16:31:28.591 GcodeDriver TRACE: [serial://COM23] >> G21 ; Set millimeters mode
2019-11-01 16:31:28.593 GcodeDriver TRACE: [serial://COM23] << echo:Unknown command: "G21 "
2019-11-01 16:31:28.599 GcodeDriver TRACE: [serial://COM23] << ok
2019-11-01 16:31:28.601 GcodeDriver DEBUG: sendCommand(serial://COM23 G21 ; Set millimeters mode, 5000) => [echo:Unknown command: "G21 ", ok]
2019-11-01 16:31:28.603 GcodeDriver DEBUG: sendCommand(G90 ; Set absolute positioning mode, 5000)...
2019-11-01 16:31:28.604 GcodeDriver TRACE: [serial://COM23] >> G90 ; Set absolute positioning mode
2019-11-01 16:31:28.607 GcodeDriver TRACE: [serial://COM23] << ok
2019-11-01 16:31:28.614 GcodeDriver DEBUG: sendCommand(serial://COM23 G90 ; Set absolute positioning mode, 5000) => [ok]
2019-11-01 16:31:28.615 GcodeDriver DEBUG: sendCommand(M82 ; Set absolute mode for extruder, 5000)...
2019-11-01 16:31:28.616 GcodeDriver TRACE: [serial://COM23] >> M82 ; Set absolute mode for extruder
2019-11-01 16:31:28.617 GcodeDriver TRACE: [serial://COM23] << ok
2019-11-01 16:31:28.632 GcodeDriver DEBUG: sendCommand(serial://COM23 M82 ; Set absolute mode for extruder, 5000) => [ok]
2019-11-01 16:31:32.286 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 16:31:32.542 GcodeDriver DEBUG: sendCommand(serial://COM22 null, 250) => []
2019-11-01 16:31:58.214 GcodeDriver DEBUG: sendCommand(M114, 5000)...
2019-11-01 16:31:58.215 GcodeDriver TRACE: [serial://COM22] >> M114
2019-11-01 16:31:58.221 GcodeDriver TRACE: [serial://COM22] << X:30.00 Y:30.00 Z:13.47 C1:30.00 C2:30.00 END
2019-11-01 16:31:58.222 GcodeDriver TRACE: Position report: X:30.00 Y:30.00 Z:13.47 C1:30.00 C2:30.00 END
2019-11-01 16:31:58.225 GcodeDriver TRACE: [serial://COM22] << ok
2019-11-01 16:31:58.228 GcodeDriver DEBUG: sendCommand(serial://COM22 M114, 5000) => [ok]
2019-11-01 16:32:15.785 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 16:32:15.801 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 16:32:20.182 MainFrame INFO: Shutting down...
2019-11-01 16:32:20.490 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 16:32:20.492 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 16:32:21.529 MainFrame INFO: Shutdown complete, exiting.


Here without:

2019-11-01 16:32:36.835 Main DEBUG: Bienvenue, Bienvenido, Willkommen, Hello, Namaskar, Welkom, Bonjour to OpenPnP version 2019-10-31_02-00-49.0279d65.
2019-11-01 16:32:36.835 Scripting TRACE: Scripting.on Startup
2019-11-01 16:33:01.908 ReferenceMachine DEBUG: setEnabled(true)
2019-11-01 16:33:05.538 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 16:33:05.790 GcodeDriver DEBUG: sendCommand(serial://COM23 null, 250) => []
2019-11-01 16:33:05.791 GcodeDriver DEBUG: sendCommand(G21 ; Set millimeters mode, 5000)...
2019-11-01 16:33:05.791 GcodeDriver TRACE: [serial://COM23] >> G21 ; Set millimeters mode
2019-11-01 16:33:05.793 GcodeDriver TRACE: [serial://COM23] << echo:Unknown command: "G21 "
2019-11-01 16:33:05.793 GcodeDriver TRACE: [serial://COM23] << ok
2019-11-01 16:33:05.794 GcodeDriver DEBUG: sendCommand(serial://COM23 G21 ; Set millimeters mode, 5000) => [echo:Unknown command: "G21 ", ok]
2019-11-01 16:33:05.796 GcodeDriver DEBUG: sendCommand(G90 ; Set absolute positioning mode, 5000)...
2019-11-01 16:33:05.796 GcodeDriver TRACE: [serial://COM23] >> G90 ; Set absolute positioning mode
2019-11-01 16:33:05.797 GcodeDriver TRACE: [serial://COM23] << ok
2019-11-01 16:33:05.799 GcodeDriver DEBUG: sendCommand(serial://COM23 G90 ; Set absolute positioning mode, 5000) => [ok]
2019-11-01 16:33:05.801 GcodeDriver DEBUG: sendCommand(M82 ; Set absolute mode for extruder, 5000)...
2019-11-01 16:33:05.802 GcodeDriver TRACE: [serial://COM23] >> M82 ; Set absolute mode for extruder
2019-11-01 16:33:05.804 GcodeDriver TRACE: [serial://COM23] << ok
2019-11-01 16:33:05.807 GcodeDriver DEBUG: sendCommand(serial://COM23 M82 ; Set absolute mode for extruder, 5000) => [ok]
2019-11-01 16:33:09.424 GcodeDriver DEBUG: sendCommand(null, 250)...
2019-11-01 16:33:09.676 GcodeDriver DEBUG: sendCommand(serial://COM22 null, 250) => []
2019-11-01 16:33:18.489 GcodeDriver DEBUG: sendCommand(M114, 5000)...
2019-11-01 16:33:18.489 GcodeDriver TRACE: [serial://COM22] >> M114
2019-11-01 16:33:18.492 GcodeDriver TRACE: [serial://COM22] << X:30.00 Y:30.00 Z:13.39 C1:30.00 C2:30.00 END
2019-11-01 16:33:18.493 GcodeDriver TRACE: [serial://COM22] << ok
2019-11-01 16:33:18.494 GcodeDriver DEBUG: sendCommand(serial://COM22 M114, 5000) => [X:30.00 Y:30.00 Z:13.39 C1:30.00 C2:30.00 END, ok]
2019-11-01 16:33:37.188 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 16:33:37.200 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 16:33:49.374 MainFrame INFO: Shutting down...
2019-11-01 16:33:49.640 ReferenceMachine DEBUG: setEnabled(false)
2019-11-01 16:33:49.641 ReferenceMachine DEBUG: setHomed(false)
2019-11-01 16:33:50.597 MainFrame INFO: Shutdown complete, exiting.


Thanks!
Steffen

Jason von Nieda

unread,
Nov 1, 2019, 12:12:47 PM11/1/19
to ope...@googlegroups.com
Okay, perhaps I see the issue. Do I understand correctly that your Z axis movement commands are on driver 1 (COM23) and the Z encoder is on driver 2 (COM22)? If that is the case, then no, that will not work. The problem is that the axis is defined on driver 1 but the position report comes in on driver 2. Since driver 2 doesn't have a Z axis, it ignores the position report value for Z.

Jason




Steffen Esser

unread,
Nov 1, 2019, 12:28:47 PM11/1/19
to ope...@googlegroups.com
Yes, exactly this is what i hoped will work.  I thought i may could use open pnp to transmit the Z-value from one subdriver to the maindriver.
I understand that this is not a normal use case and probably it is normally there for communicating with subdriver-motors without confusing the other drivers, so individual axis for the different drivers sounds logical. I just hoped it wouldn´t care from where it´s beeing updated when the axis are defined anywhere.

Thanks for clarifying this topic - and in first place, thanks for your awesome work with this project!
I´ll report back if i find a solution..
Steffen

Reply all
Reply to author
Forward
0 new messages