Run GRBL on G code driver

1,433 views
Skip to first unread message

mojalovaa1

unread,
Oct 26, 2016, 3:36:07 PM10/26/16
to OpenPnP
Hi folks

I wont ask  if some one have  set G code driver that work on GRBL  controller board (arduino mega 2560 or similar )  , and ask if can share machine.xml files  for see how is set  home  and other command  and all so actuators command ??

Jason von Nieda

unread,
Oct 27, 2016, 9:14:46 PM10/27/16
to ope...@googlegroups.com
Hi Moja,

Here is a driver section that should help get you started. You will need to modify this to work on your system, but it has the basic commands in place and should provide a good starting point.

A few things you'll need to update:
* Nozzle IDs on the Z axis.
* Actuator ID.

You can configure all your Gcode from the UI. See https://github.com/openpnp/openpnp/blob/develop/CHANGES.md#2016-08-27 for information on that. Once you have the basics working, you can add all your actuators and then use the UI to set the Gcode that gets sent for each one. I have included one example actuator to get you started.

Let me know if you need any help getting along. I would suggest that you first document all the Gcodes that you need to send to your controller to do each function, then it should be easy to find where to plug them in for the GcodeDriver.

Jason


On Wed, Oct 26, 2016 at 2:36 PM mojalovaa1 <moja...@gmail.com> wrote:
Hi folks

I wont ask  if some one have  set G code driver that work on GRBL  controller board (arduino mega 2560 or similar )  , and ask if can share machine.xml files  for see how is set  home  and other command  and all so actuators command ??

--
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 post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/a9df3f31-17f4-4f4b-848b-838eab442863%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
driver.xml

mojalovaa1

unread,
Nov 3, 2016, 8:30:48 PM11/3/16
to OpenPnP
Hi Jason

This  setup for G code drive  not work  on my machine .

I m copy part from machine.xml on official version where is  setting for  driver and port .

  <driver class="org.openpnp.machine.reference.driver.GcodeDriver" port-name="/dev/ttyACM0" baud="9600" units="Millimeters" max-feed-rate="1000" connect-wait-time-milliseconds="0">
         <home-location units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>
         <sub-drivers class="java.util.ArrayList"/>
      </driver>

Jason von Nieda

unread,
Nov 3, 2016, 8:52:20 PM11/3/16
to OpenPnP
Moja,

What part doesn't work? Does OpenPnP show an error?

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Nov 3, 2016, 8:59:55 PM11/3/16
to OpenPnP
I will send tomorrow  all info .

Only ON driver , command line not work , send error  from some line .

Tomorrow I will make image with error  and send machine files.

mojalovaa1

unread,
Nov 4, 2016, 6:12:08 AM11/4/16
to OpenPnP

Hi Jason

This is my machine files  , fist problem is be old version openpnp , now I m download   new version  and run  with yours change but  say that driver not response  , then I m look on  GRBL driver command that is Cri.s make and  all so add that command but again say that not response only command is difference .


This is part from my GRBL driver on old version machine :

//@overried
private void dwell() throws Exception {
                sendCommand("G4P0");
}
public void home(ReferenceHead head) throws Exception {
// G10 L20 P1 X0 Y0 Z0 
                sendCommand("G0Z0");
//sendCommand("G28"); //Go to Pre-Defined Position
dwell();
                sendCommand("\030");
if(homing)
                sendCommand("$H",timeoutHoming);
                sendCommand("G21");
                sendCommand("G54");
                sendCommand("G0X0Y0Z0");
                sendCommand("G0X0Y0Z0C0");
                sendCommand("G0X0Y0Z0C0B0");
fired=false; 
x = y = z= c = z0=z1 = c0=c1=0;
fired=true;
homed=true;
dwell();
sendCommand(userHoming);
dwell();
}

Have you suggestion what fake me ?
machine.xml

Jason von Nieda

unread,
Nov 4, 2016, 10:04:13 AM11/4/16
to OpenPnP
Moja,

Have you set the port and baud rate correctly for your machine?

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Nov 4, 2016, 10:51:32 AM11/4/16
to OpenPnP
Yes , port is ttyACM0 and baud is 9600

Jason von Nieda

unread,
Nov 4, 2016, 10:57:54 AM11/4/16
to OpenPnP
Okay, good. Can you please try this: https://github.com/openpnp/openpnp/wiki/GcodeDriver#troubleshooting

With Trace logging on and looking at the log file we should be able to see what is being sent and received to the controller. 

Jason

On Fri, Nov 4, 2016 at 9:51 AM mojalovaa1 <moja...@gmail.com> wrote:
Yes , port is ttyACM0 and baud is 9600

--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Nov 4, 2016, 12:33:43 PM11/4/16
to OpenPnP
This is  debug from my old version   openpnp for connection :

14:22:46,672 DEBUG     ReferenceMachine setEnabled(true)
14:22:46,700 DEBUG           GrblDriver sendCommand( , 3000)
14:22:46,700 DEBUG           GrblDriver >>
14:22:47,604 DEBUG           GrblDriver << $VERSION = 0.97
14:22:47,605 DEBUG           GrblDriver sendCommand( , -1)
14:22:47,606 DEBUG           GrblDriver >>
14:22:47,630 DEBUG           GrblDriver << $VERSION = 0.97
14:22:47,633 DEBUG           GrblDriver sendCommand( , -1)
14:22:47,633 DEBUG           GrblDriver >>
14:22:47,637 DEBUG           GrblDriver << ok
14:22:47,638 DEBUG           GrblDriver sendCommand( , -1)
14:22:47,638 DEBUG           GrblDriver >>
14:22:47,658 DEBUG           GrblDriver << $VERSION = 0.97
14:22:47,659 DEBUG           GrblDriver sendCommand(G54, -1)
14:22:47,659 DEBUG           GrblDriver >> G54
14:22:47,662 DEBUG           GrblDriver << ok
14:22:47,663 DEBUG           GrblDriver sendCommand( , -1)
14:22:47,664 DEBUG           GrblDriver >>
14:22:47,678 DEBUG           GrblDriver << $VERSION = 0.97
14:22:47,679 DEBUG           GrblDriver sendCommand( , -1)
14:22:47,679 DEBUG           GrblDriver >>
14:22:47,682 DEBUG           GrblDriver << ok
14:22:47,683 DEBUG           GrblDriver sendCommand( , -1)
14:22:47,683 DEBUG           GrblDriver >>
14:22:47,686 DEBUG           GrblDriver << ok
14:22:47,687 DEBUG           GrblDriver sendCommand(G54, -1)
14:22:47,687 DEBUG           GrblDriver >> G54
14:22:47,708 DEBUG           GrblDriver << $VERSION = 0.97
14:22:47,708 DEBUG           GrblDriver sendCommand(G0X0Y0Z0, -1)
14:22:47,708 DEBUG           GrblDriver >> G0X0Y0Z0
14:22:47,714 DEBUG           GrblDriver << ok
14:22:47,715 DEBUG           GrblDriver sendCommand(G4P0, -1)
14:22:47,715 DEBUG           GrblDriver >> G4P0
14:22:47,732 DEBUG           GrblDriver << $VERSION = 0.97
14:22:47,740 DEBUG           GrblDriver << ok
14:22:47,756 DEBUG           GrblDriver << $VERSION = 0.97
14:22:47,760 DEBUG           GrblDriver << ok
14:22:47,765 DEBUG           GrblDriver << ok
14:22:47,768 DEBUG           GrblDriver << ok
14:22:47,773 DEBUG           GrblDriver << ok


And this is Jason  from yous official version and  with yours machine version for run GRBL on G code driver : 

2016-11-04 14:25:53 [AWT-EventQueue-0] org.openpnp.Main DEBUG: OpenPnP 0.0.1-alpha-SNAPSHOT build 87f64c Started.
2016-11-04 14:26:03 [Thread-10] org.openpnp.machine.reference.ReferenceMachine DEBUG: setEnabled(true)
2016-11-04 14:26:04 [Thread-11] org.openpnp.machine.reference.driver.GcodeDriver TRACE: [/dev/ttyACM0] << $VERSION = 0.97
2016-11-04 14:26:04 [Thread-10] org.openpnp.machine.reference.driver.GcodeDriver DEBUG: sendCommand(null, 250)...
2016-11-04 14:26:04 [Thread-10] org.openpnp.machine.reference.driver.GcodeDriver DEBUG: sendCommand(null, 250) => [$VERSION = 0.97]
2016-11-04 14:26:04 [Thread-10] org.openpnp.machine.reference.driver.GcodeDriver DEBUG: sendCommand(null, 250)...
2016-11-04 14:26:04 [Thread-10] org.openpnp.machine.reference.driver.GcodeDriver DEBUG: sendCommand(null, 250) => []
2016-11-04 14:26:04 [Thread-10] org.openpnp.machine.reference.driver.GcodeDriver DEBUG: sendCommand(G54, 5000)...
2016-11-04 14:26:04 [Thread-10] org.openpnp.machine.reference.driver.GcodeDriver TRACE: [/dev/ttyACM0] >> G54
2016-11-04 14:26:04 [Thread-11] org.openpnp.machine.reference.driver.GcodeDriver TRACE: [/dev/ttyACM0] << ok
2016-11-04 14:26:09 [Thread-10] org.openpnp.gui.support.MessageBoxes DEBUG: Enable Failure: Timeout waiting for response to G54




OpenPnP.log
machine.xml

Jason von Nieda

unread,
Nov 4, 2016, 1:50:39 PM11/4/16
to ope...@googlegroups.com
Moja,

You have a lot of extra spaces and newlines in your commands. Try this one I fixed up for you: (Attached)

Jason


--
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 post to this group, send email to ope...@googlegroups.com.
machine.xml

mojalovaa1

unread,
Nov 4, 2016, 2:22:59 PM11/4/16
to OpenPnP
No , Jason not wok  same error .

mojalovaa1

unread,
Nov 4, 2016, 3:12:29 PM11/4/16
to OpenPnP
When  click to ON  in openpnp then  hear tuuummmppppp and then  nothing more  , if that is  help full for understand problems .

You are sure that I can use G code driver for run GRBL controller ?

mojalovaa1

unread,
Nov 4, 2016, 3:32:26 PM11/4/16
to OpenPnP
I m forget say that with yours GRBL driver make connection , and can move it left  , right , front , buck , up , down .


Jason von Nieda

unread,
Nov 4, 2016, 4:03:59 PM11/4/16
to OpenPnP
Hi Moja,

Based on the log it seems like this should work. Try one more thing: Change your COMMAND_CONFIRM_REGEX from "^ok.*" to "ok.*", just remove the ^. You can do this in the UI under Machine Setup -> Driver -> GcodeDriver -> Gcode and select COMMAND_CONFIRM_REGEX from the dropdown. Make sure to restart OpenPnP after you set it and then try again. Send me the log if it doesn't work.

Thanks,
Jason


On Fri, Nov 4, 2016 at 2:32 PM mojalovaa1 <moja...@gmail.com> wrote:
I m forget say that with yours GRBL driver make connection , and can move it left  , right , front , buck , up , down .


--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Nov 4, 2016, 4:22:25 PM11/4/16
to OpenPnP
After  remove ^ can make homing  but after homing can not move  left , right , up , down  , need all so something set or ?

Jason von Nieda

unread,
Nov 4, 2016, 4:23:36 PM11/4/16
to OpenPnP
Log?

Jason


On Fri, Nov 4, 2016 at 3:22 PM mojalovaa1 <moja...@gmail.com> wrote:
After  remove ^ can make homing  but after homing can not move  left , right , up , down  , need all so something set or ?

--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Nov 4, 2016, 4:33:05 PM11/4/16
to OpenPnP
This is log and machine all so .
OpenPnP.log
machine.xml

Jason von Nieda

unread,
Nov 4, 2016, 4:37:59 PM11/4/16
to OpenPnP
Moja,

If you look at the log file you can see that your controller responded  "error: Unsupported command" when you sent "G0X0Y0Z0C0B0". Since you run a custom Grbl you will need to determine the correct Gcode that you need to send. It looks like your Grbl did not like the C0 or B0, perhaps.

Also, in your machine.xml you still have a lot of newlines in your commands. You should clean these up as they may cause problems. Your CONNECT_COMMAND and MOVE_TO_COMMAND both have extraneous newlines.

I suggest that you make a list of all the Gcodes that your machine needs, test them in Pronterface or a serial terminal and then add them one by one to OpenPnP. If something goes wrong, look at the logs and see what the error is. This should help you determine how to fix it.

Jason


On Fri, Nov 4, 2016 at 3:33 PM mojalovaa1 <moja...@gmail.com> wrote:
This is log and machine all so .

--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Nov 4, 2016, 5:35:53 PM11/4/16
to OpenPnP
Jason , I  think that is not problems on G code command , but on machine files  add command it is .

I m remove B0 and that is ok  now but still can not  move  axis manual  , I m add log again .


OpenPnP.log

Matt Brocklehurst

unread,
Nov 4, 2016, 6:11:53 PM11/4/16
to ope...@googlegroups.com

Hi Moja

If you look at the bottom of the log it tells you what's wrong - your c axis isn't getting replaced to a number

Matt

Sent from my iPhone

On Nov 4, 2016, at 9:35 PM, mojalovaa1 <moja...@gmail.com> wrote:

Jason , I  think that is not problems on G code command , but on machine files  add command it is .

I m remove B0 and that is ok  now but still can not  move  axis manual  , I m add log again .


--
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 post to this group, send email to ope...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
<OpenPnP.log>

mojalovaa1

unread,
Nov 4, 2016, 7:33:20 PM11/4/16
to OpenPnP
I not see reason why you Jason not add my GRBL driver on official version , that is tested driver on 2 machine and on 2 version GRBL controller , one with 4 axis and second with 6 axis , all so have actuator  setting for set light , vacuum , air and similar ?

You are test GRBL on that G code driver ?
I m test it my version on Bob GRBL version with 4 axis and on one my version that Cri.s is help make  it for me .


mojalovaa1

unread,
Nov 4, 2016, 8:25:01 PM11/4/16
to OpenPnP
Ok , I m run now GRBL driver  for test fiducial  error  and this is  how need be ,   G1 {X:X%.4f} {Y:Y%.4f} {Z:Z%.4f} {Rotation:C%.4f} F{FeedRate:%.0f}    , problem is define Rotation on C axis  , befor is be C:C but need be Rotation  : 

  <driver class="org.openpnp.machine.reference.driver.GcodeDriver" port-name="/dev/ttyACM0" baud="9600" flow-control="Off" data-bits="Eight" stop-bits="One" parity="None" set-dtr="false" set-rts="false" units="Millimeters" max-feed-rate="30000" timeout-milliseconds="5000" connect-wait-time-milliseconds="1000">
         <command head-mountable-id="5b8a8cbd-d6c1-4324-af8b-eba5f0444622" type="ACTUATE_BOOLEAN_COMMAND">
            <text><![CDATA[
                   {True:M8}{False:M9}   
             ]]></text>
         </command>
         <command type="CONNECT_COMMAND">
            <text><![CDATA[
            G54  
        ]]></text>
         </command>
         <command type="MOVE_TO_COMMAND">
            <text><![CDATA[
        G1 {X:X%.4f} {Y:Y%.4f} {Z:Z%.4f} {Rotation:C%.4f} F{FeedRate:%.0f}   
         ]]></text>
            <text><![CDATA[
       G4P0  
           ]]></text>
         </command>
         <command type="HOME_COMMAND">
            <text><![CDATA[
           $H  
             ]]></text>
            <text><![CDATA[
         G21   
               ]]></text>
            <text><![CDATA[
           G54  
                ]]></text>
            <text><![CDATA[
           G0X0Y0Z0    
                 ]]></text>
            <text><![CDATA[
           G0X0Y0Z0C0   
                  ]]></text>
            <text><![CDATA[
          G0X0Y0Z0C0   
                   ]]></text>
         </command>
         <command type="COMMAND_CONFIRM_REGEX">
            <text><![CDATA[ok.*]]></text>
         </command>
         <sub-drivers class="java.util.ArrayList"/>
         <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>69edd567-df6c-495a-9b30-2fcbf5c9742f</string>
                  <string>169edd567-df6c-495a-9b30-2fcbf5c9742f</string>
               </head-mountable-ids>
               <transform class="org.openpnp.machine.reference.driver.GcodeDriver$CamTransform" cam-radius="0.0" cam-wheel-radius="0.0" cam-wheel-gap="0.0">
                  <negated-head-mountable-id>169edd567-df6c-495a-9b30-2fcbf5c9742f</negated-head-mountable-id>
               </transform>
            </axis>
            <axis name="rotation" type="Rotation" home-coordinate="0.0">
               <head-mountable-ids class="java.util.HashSet">
                  <string>*</string>
               </head-mountable-ids>
            </axis>
         </axes>
      </driver>

mojalovaa1

unread,
Feb 27, 2017, 4:20:03 PM2/27/17
to OpenPnP
Hi folks

After allot time  I m start with cross with my pnp machine with GRBL  driver to G code driver .

Before I m make with Jason help that can make homing , but now see that after homing I can use X and Y axis but Z axis not work , Jason can you explain me  what is difference on GRBL command and G code command ?


Jason von Nieda

unread,
Feb 27, 2017, 4:23:28 PM2/27/17
to OpenPnP
Hi Moja,

* Please post the commands you are using to home and move. If you are already using GcodeDriver with OpenPnP then you can just send machine.xml.
* Are you using stock Grbl, or has it been customized? If it's customized, we'll need to know what the changes are to know how they might affect OpenPnP.

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Feb 27, 2017, 5:00:31 PM2/27/17
to OpenPnP
Hi Jason

First I will add machine file who use GRBL driver (that work on my machine ) , machine(cris).xml  , and second is  with G-code driver . 
Move command need be same like x and y axis if I m remember correct , I can  run old version pnp and  make log files for see .


machine(cris).xml
machine.xml
OpenPnP.log
Message has been deleted

mojalovaa1

unread,
Feb 27, 2017, 5:06:14 PM2/27/17
to OpenPnP
This is logo from old version openpnp
OpenPnP.log

mojalovaa1

unread,
Feb 27, 2017, 5:37:41 PM2/27/17
to OpenPnP
This is  command for actuators , Cris please if I m write something wrong correct me :

<actuator class="org.openpnp.machine.reference.ReferenceActuator" id="6b8a8cbd-d6c1-4324-af7b-eba5f0444624" name="PS1" index="20000709">
<head-offsets units="Millimeters" x="35.85" y="22.11" z="0.0" rotation="9.99E-4"/>
<safe-z value="0.0" units="Millimeters"/>
</actuator>
<actuator class="org.openpnp.machine.reference.ReferenceActuator" id="5b8a8cbd-d6c1-4324-af5b-eba5f0444624" name="V1" index="809">
<head-offsets units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>
<safe-z value="0.0" units="Millimeters"/>
</actuator>
<actuator class="org.openpnp.machine.reference.ReferenceActuator" id="5b8a8cbd-d6c1-4324-af3b-eba5f0444624" name="L1" index="305">
<head-offsets units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>
<safe-z value="0.0" units="Millimeters"/>
</actuator>
<actuator class="org.openpnp.machine.reference.ReferenceActuator" id="5b8a8cbd-d6c1-4324-af1b-eba5f0444624" name="P1" index="2000">
<head-offsets units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>
<safe-z value="0.0" units="Millimeters"/>
</actuator>
<actuator class="org.openpnp.machine.reference.ReferenceActuator" id="5b8a8cbd-d6c1-4324-a21b-eba5f0444624" name="L120" index="12000">
<head-offsets units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>
<safe-z value="0.0" units="Millimeters"/>
</actuator>
<actuator class="org.openpnp.machine.reference.ReferenceActuator" id="5b8a8cbd-d6c1-4324-af1b-eba5f0454624" name="L140" index="14060">
<head-offsets units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>
<safe-z value="0.0" units="Millimeters"/>
</actuator>

P1 = puller  ( puller use PWM command for step pin on stepper for pull tape  , S2000 is ON PWM )
S = solenoid (Solenoid actuator M7 (index 07 )is on and M9 (index 09) is OFF )
V1 = Vacuum 1 (Vacuum solenoid  M8 (index 08 or 8 ) is ON and M9 (index 09) is OFF
L120 = Light PWM 20% intensity ON , total OFF (PWM output port for camera light , 1 is light one or 2 (second ) , 20 is % on light , command is S1200 for 20% and S1000 for 0% (Cris that is correct ? ) )
L140 = Light PWM 40% intensity On , 60% intensity in OFF , same is like with L120 

That is part for actuator.




Jason von Nieda

unread,
Feb 27, 2017, 7:31:06 PM2/27/17
to OpenPnP
Thanks Moja, I will look through these and see if I can give you some help. In the meantime, tell me, what problems are you having?

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

Jason von Nieda

unread,
Feb 27, 2017, 7:48:05 PM2/27/17
to OpenPnP
Moja,

Looking at your machine.xml, it is configured for a CamTransform, which is typically used with a dual nozzle system, but in your videos I see only one nozzle. Are you using 1 or 2?

Jason

Cri S

unread,
Feb 28, 2017, 12:35:00 AM2/28/17
to OpenPnP
On actuators index has special meaning.
Example: index="20000709"
This sends down for on:
M07
M20
For off
M09

Further there are mappings for lightning intensity including switching on/off different lamps and mapping for different heads.
All this can be made with gcode driver.
The reason I was not able to use gcode driver was inability to send reset command, missing handling of alarm state, , unable to parse grbl response correctly .

Cri S

unread,
Feb 28, 2017, 12:42:53 AM2/28/17
to OpenPnP
This machine.XML don't use camwheel mapping,
on customized driver the mapping get activated if different value as 0 for camwheel is set.

mojalovaa1

unread,
Feb 28, 2017, 3:07:14 AM2/28/17
to OpenPnP
Hi Jason

On this machine where I make test new openpnp I have one head on machine  , but all so on my friend machine have 2 head and on this moment I design new machine  all so with 2 head.
First machine with one head use belt for move Z axis , my friend machine use  same principle like yours machine with 2 head , and my new machine will be  have 2 head  but will be used belt for move that head .

Jason von Nieda

unread,
Feb 28, 2017, 10:18:44 AM2/28/17
to OpenPnP
Okay, so, to start you need to remove the CamTransform from the machine.xml. To go further, I will need to know what you've tried and what you are having trouble with.

I highly recommend reading the Setup guide at https://github.com/openpnp/openpnp/wiki/Setup-and-Calibration. This will guide you through a full machine configuration.

I am more than happy to help you with specific questions and problems, but I can't write a complete config for you. You will need to work on that and experiment to get things working. You are the person that knows your machine best.

You will most likely need to change how you use actuators a bit. The index system you are using currently requires very specific functionality from your driver, and that code is not present in the GcodeDriver. But everything you are wanting to do is possible, with some small changes to how you do it. For instance, instead of using one actuator that processes indexes differently, you can use multiple actuators that just handle a single output each. 

The result is that your configuration will be somewhat longer, but it will be easier to understand and it will be standard. This means that people here can help you make changes when you need to without writing complex driver code.

This is covered in the Setup guide, but for you specifically I recommend:

1. Make a list of all the devices on your machine that you need to control: Nozzles, X/Y, Cameras, Feeders, Lighting, etc. 
2. Make a list of the Gcode required to control each one and notes about anything special that is required. For instance, if you need to run the puller for 100ms after a feed, note that down.
3. Go through the Setup guide and start filling in the details. When you get stuck, ask specific questions and give us the lists you made in step 1 and 2. This will make it easy for us to help and you should be able to get up and running very quickly.

One final note: Cri S mentioned "The reason I was not able to use gcode driver was inability to send reset command, missing handling of alarm state, , unable to parse grbl response correctly." We'll need to figure these out as you go along. Initial thoughts are:

1. Reset command: Why is this needed? What does it do? What needs to be sent?
2. Alarm state: We may be able to handle this with https://github.com/openpnp/openpnp/wiki/GcodeDriver#command_error_regex. Will need more details on what is expected.
3. Grbl Response: Not sure what this refers to. Explain what it does and what the format is and I'll see if we can figure it out.

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Feb 28, 2017, 10:58:48 AM2/28/17
to OpenPnP
I m remove but same can not move Z axis , other wok (X , Y , C ).

 <driver class="org.openpnp.machine.reference.driver.GcodeDriver" port-name="/dev/ttyACM0" baud="9600" flow-control="Off" data-bits="Eight" stop-bits="One" parity="None" set-dtr="false" set-rts="false" units="Millimeters" max-feed-rate="1000" backlash-offset-x="-1.0" backlash-offset-y="-1.0" non-squareness-factor="0.0" backlash-feed-rate-factor="0.1" timeout-milliseconds="5000" connect-wait-time-milliseconds="1000">
         <homing-fiducial-location units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/>

mojalovaa1

unread,
Feb 28, 2017, 11:02:37 AM2/28/17
to OpenPnP
I m found problems :

need be:

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


Cri S

unread,
Feb 28, 2017, 12:37:52 PM2/28/17
to ope...@googlegroups.com
1. Reset command: Why is this needed? What does it do? What needs to be sent?

This commands reset the controller to know and safe state. Further if
controller is powered on before program start, it's the safe mode to
check for controller and it is the only mode to exit as example from
homing or other states, like waiting for F-INP signal (M-CODE 21-28)
The command is 0x18 . I have tried just before and after [data]
introduction, at that time
it don't worked.

2. Alarm state: We may be able to handle this with
https://github.com/openpnp/openpnp/wiki/GcodeDriver#command_error_regex.
Will need more details on what is expected.

At that time i think the parsing was simplier and it was not allowed
to have multiple regex as
i remember but i'm not sure about that, the next point should work too
with the multiple regex parsing that now at currently looking over the
source is implemented.

3. Grbl Response: Not sure what this refers to. Explain what it does
and what the format is and I'll see if we can figure it out.

Annother problem is homing, the controller starts into alarm state.
After homing, it executed gcode from EEProm in order to make sanity
check on homing
and for creating well defined environment, system units, modify
coordinate system, .... .
This lines executing from EEprom generates OK responses, that bring
out of sync openpnp.
Further openpnp sends lines too fast after homing, on arduino Mega it
works, on arduino uno
that could be too large for the buffers. It could be removed from grbl
and moved to openpnp in order to get working, the annoing issue with
that is that maintaince tools then have different coordinate systems
and that is then a bigger problem not related to openpnp.

Jason von Nieda

unread,
Feb 28, 2017, 9:43:09 PM2/28/17
to ope...@googlegroups.com
Thanks Cri, this is helpful. A few questions inline:

On Tue, Feb 28, 2017 at 11:37 AM Cri S <phon...@gmail.com> wrote:
1. Reset command: Why is this needed? What does it do? What needs to be sent?

This commands reset the controller to know and safe state. Further if
controller is powered on before program start, it's the safe mode to
check for controller and it is the only mode to exit as example from
homing or other states, like waiting for F-INP signal (M-CODE 21-28)
The command is 0x18 . I have tried just before and after [data]
introduction, at that time
it don't worked.

I did some quick tests and it looks like we can't do this right now. I inserted the character manually but then the XML parser blows up while trying to read it. So, if this is a requirement of your controller, it's not going to work with GcodeDriver right now. Could you change it to a different printable character? Maybe a special sequence like !!! or something?
 

2. Alarm state: We may be able to handle this with
https://github.com/openpnp/openpnp/wiki/GcodeDriver#command_error_regex.
Will need more details on what is expected.

At that time i think the parsing was simplier and it was not allowed
to have multiple regex as
i remember but i'm not sure about that, the next point should work too
with the multiple regex parsing that now at currently looking over the
source is implemented.

Yes, the error function was added after the initial release, so this might work for you now.
 

3. Grbl Response: Not sure what this refers to. Explain what it does
and what the format is and I'll see if we can figure it out.

Annother problem is homing, the controller starts into alarm state.
After homing, it executed gcode from EEProm in order to make sanity
check on homing
and for creating well defined environment, system units, modify
coordinate system, .... .
This lines executing from EEprom generates OK responses, that bring
out of sync openpnp.

I think this will be handled now by the connection code. OpenPnP will consume any number of responses during the connection process and eventually sync up. 
 
Further openpnp sends lines too fast after homing, on arduino Mega it
works, on arduino uno

Can you explain this more? OpenPnP only sends commands after a response is received. If you tested an old version, this might have failed, but for some months now it always waits for the COMMAND_RESPONSE before sending the next command even when there are multiple lines in a command.

Jason
 
that could be too large for the buffers. It could be removed from grbl
and moved to openpnp in order to get working, the annoing issue with
that is that maintaince tools then have different coordinate systems
and that is then a bigger problem not related to openpnp.

--
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 post to this group, send email to ope...@googlegroups.com.

Cri S

unread,
Mar 1, 2017, 3:57:26 AM3/1/17
to OpenPnP
Character can be changed on special compiled version. It is a single character.

The too fast is that.
Serial buffer is 63 chars on uno, mega have double that space.
Controller receive up to 6 OK before the first char is removed from the fifo. This during homing. If the user sequence after $h is bigger, serial buffer overflow happens.
As two character are added to the line, average line length is only 8 chars on worst chase.
Maybe the problem is avoided if after homing there is separate user defined init and that between this two things there is a definable delay or fixed delay of 200ms.

Cri S

unread,
Mar 1, 2017, 3:57:27 AM3/1/17
to OpenPnP

Cri S

unread,
Mar 1, 2017, 4:32:47 AM3/1/17
to ope...@googlegroups.com
Jason, another consideration.
There are some users, I suppose in the order of 70+
that run openpnp on grbl with stepcraft machines.
That machine advertise to change toolhead fast.
There need to have the default reset character as other programs use that. Those machines haves just strip feeder or tray feeder, single head, tool changer and two endoscope cameras, vacuum pump , led control. One relay changeover from top to bottom. Vacuum control maybe in future as upgrade. Running from 30V and some run dispenser, using python code for that.

--
You received this message because you are subscribed to a topic in the Google Groups "OpenPnP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openpnp/h7LA-vQrzGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openpnp+u...@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.

Cri S

unread,
Mar 1, 2017, 7:56:56 AM3/1/17
to OpenPnP

Just as reference, this is the stripped down GrblDriver that there use.
In reality on homing after sucessful homing, it reads out the steps_per_mm from controller and convert it to mm_per_step.
Later it uses that info for round up/down the position on moveTo(x,y,z,c,speed) and later call moveTo_(x,y,z,c,speed), the moveTo in this file without hm.
As it's too specific to grbl i have omitted here for clearity.
Fired is just something special when this driver is used on 3Axis Grbl, in order to not trigger false exception because of controller don't know C axis.
The minimal configuration is manual smd vacuum pump driven by relay, piece of foam and paper tape over the release hole, no camera, no 4th axis.
The next level is alignment pocket and align-strip/tray feeder where on postFeed the component get aligned inside pocket.
Here homing buffer overflow is no problem because of less then 63 chars, and user homing is separated.

Regards
Cri.s

GrblDriver.java

Jason von Nieda

unread,
Mar 1, 2017, 9:58:08 AM3/1/17
to ope...@googlegroups.com
Hi Cri,

Sorry, I still don't understand. Can you explain it line by line?

A while back I made a change to GcodeDriver so that lines are only sent after confirmation. In other words, if you have a CONNECT_COMMAND like:
G21
G90
G54

Then the transactions will look like:
> G21 [wait]
< ok
> G90 [wait]
< ok
> G54 [wait]
< ok

They are not all sent at once like:
> G21
> G90
> G54
< ok
< ok
< ok

This change was made a couple months back. Before the change it would send them all at once.


Jason



--
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 post to this group, send email to ope...@googlegroups.com.

Jason von Nieda

unread,
Mar 1, 2017, 10:02:02 AM3/1/17
to ope...@googlegroups.com
I think we can probably find a way to put special characters in the configuration. Ticket created: https://github.com/openpnp/openpnp/issues/454

Jason


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 post to this group, send email to ope...@googlegroups.com.

Cri S

unread,
Mar 1, 2017, 11:02:22 AM3/1/17
to OpenPnP
Grbl controller can store up to 5 lines of Gcode into EEprom that are executed after homing.
One commonly usage if limit switches are installed is to drive the head 0.05mm before tripping the limit switches signal
to the user tripping error if the homing is wrong and need be repeated.
Other usage are clearing of coordinate offsets, move to park position, settings defaults.
Grbl after $H could send 1 + 5 OK , in sum 6, indipendently of what is send by serial line.
That lines are output on serial line too as i remember.
Until this lines are not completed every character send on serial line get buffered into the serial input FIFO,
and OpenPnP sends down the next 6 Lines of Gcode where in reality $H is not really finished.
It is not openpnp misbehavior, and not grbl bug, maybe grbl oddity.
The problem arise if the next 6 lines including the closing "\r\n" are bigger as 63 chars in order to be compatible with arduino uno,
arduino mega don't have this problems because the FIFO is sufficient large.

Jason von Nieda

unread,
Mar 1, 2017, 11:20:14 AM3/1/17
to OpenPnP
Okay, I think I understand now. So what happens is:

> $H
< ok (from $H)
> next command 1
< ok (from EEPROM command)
> next command 2
< ok (from EEPROM command)
> next command 3
< ok (from EEPROM command)
> next command 4
< ok (from EEPROM command)
> next command 5
< ok (from EEPROM command)
> next command 6
< ok (from next command 1)
< ok (from next command 2)
< ok (from next command 3)
< ok (from next command 4)
< ok (from next command 5)
< ok (from next command 6)

To me it seems like an error that Grbl would send "ok" back to the controller for a command that the controller did not send, i.e. the EEPROM command. I feel like these should be run internally and then one final "ok" sent after everything is finished.

I can't think of a way to fix this in OpenPnP without adding a special case for this, and I don't want to do that. I'm open to suggestions though.

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

Cri S

unread,
Mar 1, 2017, 2:03:06 PM3/1/17
to OpenPnP
Yes, and the problem is the buffer size too.
If forcing to use dedicated grbl version it is possible to compile it with improvered buffer size and with two reset commands
and changing ok to done for commands on eeprom as example.
arduino mega has the limit of average 24 chars per line.
Grbl driver is below, gcode driver, i don't know.
Workaround is not using this EEprom init lines on arduino uno.
On Arduino mega, the Prefetch lines speeds up the cph .
Prerequesites is to do the timing on Gcode and not on Thread.sleep,
or at least the timing for placing.

mojalovaa1

unread,
Mar 11, 2017, 4:03:14 PM3/11/17
to OpenPnP
Hi Jason

I wont add command for pick and place for solenoid , or how you are define that command .

Can you say me how set command then nozzle go to pick position that ON solenoid for vacuum ?
In  my GRBL command is M8 for ON and M9 for OFF solenoid .

Jason von Nieda

unread,
Mar 11, 2017, 4:20:25 PM3/11/17
to OpenPnP
https://github.com/openpnp/openpnp/wiki/GcodeDriver%3A-Command-Reference#pick_command


https://github.com/openpnp/openpnp/wiki/GcodeDriver%3A-Command-Reference#place_command

Just enter the command in the GUI for each one.

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Mar 11, 2017, 4:41:36 PM3/11/17
to OpenPnP
2017-03-11 22:39:29 ReferenceNozzle DEBUG: N1.pick()
2017-03-11 22:39:29 GcodeDriver DEBUG: sendCommand({True:M8}{False:M9}, 5000)...
2017-03-11 22:39:29 GcodeDriver TRACE: [/dev/ttyACM0] >> {True:M8}{False:M9}
2017-03-11 22:39:29 GcodeDriver TRACE: [/dev/ttyACM0] << error: Expected command letter
2017-03-11 22:39:34 MessageBoxes DEBUG: Error: java.lang.Exception: Timeout waiting for response to {True:M8}{False:M9}


I m try but have this error , look that  machine wait command from vacuum sens but on my machine not have it .

mojalovaa1

unread,
Mar 11, 2017, 5:22:05 PM3/11/17
to OpenPnP
Jason what I m miss on this setup ?

   <command head-mountable-id="N1" type="PICK_COMMAND">
            <text><![CDATA[{True:M8} ]]></text>
         </command>

Jason von Nieda

unread,
Mar 12, 2017, 4:18:03 PM3/12/17
to OpenPnP
Moja,

PICK_COMMAND does not take a boolean. You should just use "M8" instead of "{True:M8}".

And for PLACE_COMMAND use "M9".

Jason


--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Mar 12, 2017, 5:32:45 PM3/12/17
to OpenPnP
Hi Jason

I m try  but same problems all time  look:

2017-03-12 22:28:19 ReferenceNozzle DEBUG: N1.moveTo((96.500000, 150.000000, 0.000000, 180.000000 mm), 1.0)
2017-03-12 22:28:19 ReferenceNozzle DEBUG: N1.pick()
2017-03-12 22:28:19 GcodeDriver DEBUG: sendCommand({M8}, 5000)...
2017-03-12 22:28:19 GcodeDriver TRACE: [/dev/ttyACM0] >> {M8}
2017-03-12 22:28:19 GcodeDriver TRACE: [/dev/ttyACM0] << error: Expected command letter
2017-03-12 22:28:24 MessageBoxes DEBUG: Error: java.lang.Exception: Timeout waiting for response to {M8}

mojalovaa1

unread,
Mar 12, 2017, 5:36:05 PM3/12/17
to OpenPnP
This is machine file 
machine.xml

Jason von Nieda

unread,
Mar 12, 2017, 5:36:37 PM3/12/17
to OpenPnP
Moja,

Use M8, not {M8}.

Jason



--
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 post to this group, send email to ope...@googlegroups.com.

mojalovaa1

unread,
Mar 12, 2017, 5:40:51 PM3/12/17
to OpenPnP
Thanks Jason

That is problems , now work correct .


Jason von Nieda

unread,
Mar 12, 2017, 5:50:33 PM3/12/17
to OpenPnP
Glad to hear it!

On Sun, Mar 12, 2017 at 4:40 PM mojalovaa1 <moja...@gmail.com> wrote:
Thanks Jason

That is problems , now work correct .


--
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 post to this group, send email to ope...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages