Home Z Script

228 views
Skip to first unread message

Nélio Oliveira

unread,
Feb 3, 2021, 10:12:33 AM2/3/21
to OpenPnP
Hi,

I'm having some issues with the Z axis slightly move off center after some time and that makes the nozzles not lowering enough to pick up parts.

I would like to home the Z axis every time I start a job.
Is there a way to do it with scripts?

Duncan Ellison

unread,
Feb 3, 2021, 10:38:41 AM2/3/21
to OpenPnP
You need to hook the event Job.Starting  i.e. write a script that homes the head, call it Job.Starting.js and put it in the Events directory.

Not sure how you fire a homing command, but I'm sure it's possible.

Jason von Nieda

unread,
Feb 3, 2021, 10:43:25 AM2/3/21
to ope...@googlegroups.com
machine.defaultHead.home()

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 view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/6a3ec8f0-ce26-4bd6-9ef1-59bc4a4df550n%40googlegroups.com.

Nélio Oliveira

unread,
Feb 3, 2021, 10:54:04 AM2/3/21
to ope...@googlegroups.com
That homes the camera and nozzles but not Z axis. 
I would like just the Z axis.


Cumprimentos | Best regards,

Nélio Oliveira

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/Eu0H_DsVJVY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/CA%2BQw0jwXWDMNUMo1pBRLvdZrC0QxU9%2BZOd2NrBYfqfK87NUi2g%40mail.gmail.com.

Nélio Oliveira

unread,
Feb 3, 2021, 11:11:59 AM2/3/21
to OpenPnP
Is it also possible to send GCODE from scripts?

ma...@makr.zone

unread,
Feb 3, 2021, 11:20:04 AM2/3/21
to ope...@googlegroups.com

Hi Nélio

I assume you have normal homing at the Z max or at the balance point of two nozzles, right?

And now you want to calibrate the nozzle tip against a surface down on the table, right?

I'm working on such a thing. It will be executed per Nozzle after homing or per Nozzle Tip after each change (configurable).

Note the Touch Location that is configurable per nozzle tip (for fast nearby probing):

It will be ideal when you have a nozzle with contact probing sensor (like the Liteplacer) but I will also try to support normal nozzles and use "sniffle" probing using the vacuum sensor. Not sure how well this will work (and how fast).

Contact probing nozzles with sensor will also support automatic part height probing. So you will not have to enter part heights manually anymore.  ;-)

This will still take some testing/finishing time before released. Other things have intervened...

Just wanted to say it, so if you have the time to wait you don't have to reinvent the wheel. :-)

_Mark

Nélio Oliveira

unread,
Feb 3, 2021, 11:29:28 AM2/3/21
to ope...@googlegroups.com
Hi Mark,

That looks awesome but that's not exactly what I need.
I just need to recalibrate the position of the nozzles (home Z) before every job because sometimes the step motor loses some steps, probably due to manual change of the nozzle.
I have a CHMT36VA by the way.

Cumprimentos | Best regards
Nélio Oliveira


ma...@makr.zone

unread,
Feb 3, 2021, 12:04:22 PM2/3/21
to ope...@googlegroups.com

Using the testing version you can create an actuator an then actuate it on homing using the machine state:

Actuator Machine States

And then add custom Gcode to home Z to the ACTUATE_BOOLEAN_COMMAND {True}

Make sure to switch ON Machine Coordination After Actuation, so OpenPnP knows the new Z.

_Mark

Jason von Nieda

unread,
Feb 3, 2021, 12:14:58 PM2/3/21
to ope...@googlegroups.com
Hi Nélio, if I am understanding correctly, you want to home just Z when a job starts, and nothing else.

I may be mistaken - Mark can correct me - but I think you will want to use the Job.Starting script for this, as Duncan said. To keep things clean, here is how I would do it:

1. Create a new Actuator on the Head and set the name to HOME_Z.
2. In your GcodeDriver settings set the ACTUATE_BOOLEAN_COMMAND for that actuator to {True:G28 Z}.
3. In your Job.Starting script do something like machine.defaultHead.getActuatorByName("HOME_Z").actuate(true)

This will send the G28 Z command on Job start. As Mark mentioned, you might need to do something to make sure OpenPnP knows Z is at 0, after this. I'm still learning the new motion system, so I don't have advice on that. Maybe Mark can comment.

Thanks,
Jason



ma...@makr.zone

unread,
Feb 3, 2021, 12:21:42 PM2/3/21
to ope...@googlegroups.com

Yes of course. Job.Starting script is the right trigger.

Nélio Oliveira

unread,
Feb 3, 2021, 12:47:27 PM2/3/21
to ope...@googlegroups.com
Thanks Jason! This was exactly what I wanted!

By the way. I'm also having some issues with the new way the camera switcher behaves.
It's awesome that it has the new feature of switching automatically to the active camera but I don't understand why it needs to keep constantly alternating between cameras. This doesn't cause any issue in the job, probably because I never use the top camera there.
But it's quite annoying when manually moving the machine to calibrate feeders and /or PCB.


Cumprimentos | Best regards
Nélio Oliveira

Jason von Nieda

unread,
Feb 3, 2021, 1:11:36 PM2/3/21
to ope...@googlegroups.com
Hi Nélio,

I'm in the process of converting my CHMT over to the new motion system as well, and I think I got the kinks worked out with the SwitcherCamera. I will send you my configuration for comparison this evening.

Thanks,
Jason


ma...@makr.zone

unread,
Feb 3, 2021, 1:16:09 PM2/3/21
to ope...@googlegroups.com

Hi Nelio

> but I don't understand why it needs to keep constantly alternating between cameras.

Can you elaborate a bit?

I have changed the Switcher camera but I wasn't able to test it using a real switcher. So I'm very interested.

See the discussion from here:

https://github.com/openpnp/openpnp/pull/1095#issuecomment-756964553

_Mark

Jason von Nieda

unread,
Feb 4, 2021, 2:26:48 AM2/4/21
to ope...@googlegroups.com
My machine.xml for the CHMT is attached. It seems to work well for the two stock cameras using the switcher.

Smoothie config is attached as well, just in case that helps.




machine.xml
config.default

Nélio Oliveira

unread,
Feb 4, 2021, 11:35:58 AM2/4/21
to OpenPnP
You can see it switching in the attached video.
2021-02-04 16-31-19.mp4

ma...@makr.zone

unread,
Feb 4, 2021, 12:19:48 PM2/4/21
to ope...@googlegroups.com

Ahhh... ok if you display all the cameras including the capture card, that's expected with default settings.

If you watch this intro video (by Jason) you see that formerly the source image was shown in both Switcher cameras, when the capture camera was switched over:

https://www.youtube.com/watch?v=gFXqbMJM2wM

What I wanted to do is no longer show the wrong source image on a SwitcherCamera. So what I did is suspend preview (i.e. freeze the last image) on the camera that is currently switched away. But this meant that the camera would never display an image until it was actively switched over. So I wanted to support some (slow) continuous preview on both. That's why the capture card  is now constantly switching.

I must admit, I mostly tested this in single camera view, with the new Auto-View option that always automatically switches to the right camera. Plus I had no real switcher camera to test, so this was obviously not apparent.

You can set the Preview FPS on the SwitcherCameras and the source capture camera to 0fps, if you don't like it.

We probably need to optimize this further: there should probably be an option to remove any camera (in this case the capture camera) form the Camera Pane.

_Mark

Jason von Nieda

unread,
Feb 4, 2021, 12:30:31 PM2/4/21
to ope...@googlegroups.com
On Thu, Feb 4, 2021 at 11:19 AM ma...@makr.zone <ma...@makr.zone> wrote:

 

We probably need to optimize this further: there should probably be an option to remove any camera (in this case the capture camera) form the Camera Pane.


Agreed - was just thinking about this a few nights ago as I've been configuring my CHMT. I think maybe just a checkbox on the camera "Include in multi camera views?" or something like that?

Although I think that even if you do that, and remove the capture device from the multi-camera view, you will still get the switching effect if you have both the bottom and top camera showing.

Thanks,
Jason

ma...@makr.zone

unread,
Feb 4, 2021, 12:42:15 PM2/4/21
to ope...@googlegroups.com

The switching is driven by the SwitcherCameras. If at least one of them has Preview FPS = 0, the continuous switching should stop.

There is room for improvement: we could add a switch saying "Dont't switch for preview", so one camera would freeze the image, while the other would still have continuous preview.

Plus we could wire the new Auto-View to switch as well, so in single Camera Auto-View, it would automatically switch over when user actions target a camera (or a camera subject).

In combination, it would really almost obscure the switching altogether. :-)

_Mark

Jason von Nieda

unread,
Feb 4, 2021, 12:51:28 PM2/4/21
to ope...@googlegroups.com
On Thu, Feb 4, 2021 at 11:42 AM ma...@makr.zone <ma...@makr.zone> wrote:

The switching is driven by the SwitcherCameras. If at least one of them has Preview FPS = 0, the continuous switching should stop.

Yep, it does. That's where I landed with my config.

There is room for improvement: we could add a switch saying "Dont't switch for preview", so one camera would freeze the image, while the other would still have continuous preview.

Plus we could wire the new Auto-View to switch as well, so in single Camera Auto-View, it would automatically switch over when user actions target a camera (or a camera subject).

In combination, it would really almost obscure the switching altogether. :-)


I think these would be good changes, but what I was getting at with my comment is I'd also like a way to hide the capture card from the multi-camera views, since by definition it will always be a duplicate of one of the two SwitcherCameras.

Jason

Reply all
Reply to author
Forward
0 new messages