Hi Jan,
It seems as if the wrong end of the Safe Z Zone was used here:
2022-01-20 15:41:39.895 Scripting TRACE:
Scripting.on Nozzle.BeforePlace
2022-01-20 15:41:39.896 GcodeAsyncDriver DEBUG: serial://COM5
commandQueue.offer(M204 S2204.01 G1 Z-6.5624
F16988.33 ; move to target, 10000)...
2022-01-20 15:41:39.896 GcodeDriver TRACE: [serial://COM5]
confirmed M114
2022-01-20 15:41:39.896 GcodeAsyncDriver DEBUG: serial://COM5
commandQueue.offer(M204 S1261.19 G1 Z6.5295 B-90.0000
F4451.25 ; move to target, 10000)...
I did make a small change in the Safe Z handling, but I've looked
at that change again, an again, and I can't find a mistake.
Could you please send the machine.xml?
_Mark
Turns out this is an old bug.
OpenPnP must move all the Head-Mountables of a head to safe Z
before a move in X, Y, C can be done.
This will be done in the order the Head-Mountables are defined in
Machine Setup, i.e. N1 comes before N2.
If N1 is not in the Safe Z Zone yet, it will trigger a move to
Safe Z of N1. The problem: it does this regardless on which side
of the Safe Z Zone it currently is, i.e. it will always move to
the lower Safe Z Zone limit.
Optimizing this means only moving to the nearer limit of
the Safe Z Zone, so if N2 is currently down, and N1 up in the air,
N1 should only move down to the higher limit of the Safe Z Zone.
Will fix it.
_Mark
No worries, it will do the right thing.
Jan,
A new testing version will be deployed in ~10 minutes that fixes it.
https://github.com/openpnp/openpnp/pull/1362
https://openpnp.org/test-downloads/
To explain, I simulated the Nozzle offset calibration
pick&place step, where it rotates the confetti by 180°, done
with your machine.xml.
Most importantly, consider your Safe Z Zone:

BEFORE: Because of the bug, N1 would stubbornly move to
its own Safe Z, which is Z-16.6, then N2 would rotate 180°
and go to the N2 Safe Z which is Z+16.6, then down to place the
confetti.

AFTER: N1 realizes it is above the Safe Z Zone,
but not inside it, so it will move to the upper limit of the Safe
Z Zone, which is Z+16.6, then N2 would rotate 180° and go to the
N2 Safe Z which is Z+16.6, i.e. no change, then down to place the
confetti.
Look at the Planned time, to see how much faster it is.

_m
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/db9abc6c-0551-9f79-80db-932fc47cbc74%40makr.zone.
a) Having seen your machine.xml, I assume you really have a
cam-shared-axis two-nozzle machine, right? So one nozzle being too
high (outside the safe Z zone), means that the other nozzle is too
low, i.e. not at safe Z. It could bump into something on the way
to the nozzle changing location.
b) that is true, but how damn hard is it to nudge the confetti
back onto the primary fiducial, before the next try? 😛
https://youtu.be/md68n_J7uto?t=461
c) The previously configured state is stored on the Issue that you accept (internally a Java object). Pressing Find Issues & Solutions again will create all new Issue objects, throwing away the stored previous state. So pressing Find Issues & Solutions before re-opening the solution, will do what you want.
_Mark
When I wrote:
> So pressing Find Issues & Solutions before re-opening the solution, will do what you want.
You need to enable the Include Solved? checkbox on the
Issues & Solutions tab, to be able to re-open the
solution.
> I tried to understand how good the camera to nozzle
calibration is and therefore repeated it a few times.
Please repeat your findings 😎
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/059ccb66-630f-30e5-843a-09d9343bfa35%40makr.zone.
> Yes, I do have a CAM head with shared axis. I followed
your advice and enabled dynamic Save-Z. I also followed your
advice and configured Save-Z as low as possible. This results in
a relative large range, where Z is > Safe-Z of N1 and >
Save-Z of N2.
Very good.
> I then configured the manual nozzle tip change position
such, that it at the balance point to avoid any force onto the
motor axis while changing the nozzle tip. At that position both
nozzles are in there upmost position and well above their
Save-Z. I'd say that there is not need for any movement in Z to
get onto the save side.
Well it depends where the nozzles are before the move. This is how it should work:
I have tested this and other scenarios yesterday, using your
machine configuration, and using both nozzles, so I'm a bit
surprised if this does not work. I even made a screen-shot:
And I now tested the case where the Z is already in the Safe Z
Zone and goes to Z=0, i.e., the balance point. It seems to work.

If this does not work on your side, please send the log.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/b0f6ce8c-ee82-168e-04b2-41226d72e431%40makr.zone.
Very nice report, thanks, Jan!
b) Is it possible that the test object diameter is more
than half across your camera view? If yes, then it is likely too
large. Is your camera view so narrow?
c) I see that it can be misleading. The problem:
Firstly, you need to set the feature diameter and you can only do
that, if the camera is already positioned over the object/primary
fiducial.
Secondly, the calibration process must be at the primary fiducial location, that's why it moves there as the first step. Now instead of moving there and visually reacquiring the test object, I could simply compare the coordinates and complain if too far apart. Good point.
Btw., the reason I want users to do it on the primary fiducial spot, is the known and good Z of that location. The offset must be measured at default Z, i.e. at PCB height, as the nozzle Z axis and the camera viewing axis (also in Z) might be slightly slanted/non-parallel to each other, so we need to do it at the Z that is representative.
> The text says "jog [...] over the test object" so I would
expect that I can place the test object anywhere.
No, that is not what it means, the text also says (earlier) "Place the calibration test object onto the calibration primary fiducial". 😁
I'm open to changes in the text, if you have a better
formulation.
d) Auto adjust only needs to be used once, we must fix b) instead.
e) No. All this calibration stuff is also a fitness test,
and intended to be validated in the right order. It is a good
thing if it fails if there is an underlying problem! Fix that
underlying problem first, in your case add lights. Chances are,
that when you want to add light later, you nudge the camera or
something, or even need to change its mount, and all your
calibration work is for nought. We want to calibrate stuff exactly
as it will be used later, in production. And believe me, you don't
want multi-capture/averaged vision later, it would slow down the
machine a ton.
f) I don't have enough information. I can only tell you
that the calibration is internally done with pick and place
commands. It creates a temporary Part and a Package with the
Blow-off value left at default, i.e. zero so there should be no
blow-off. To be honest, I never thought about the blow-off stuff.
g) Yes, if it is a problem for a light confetti, you may
need to manufacture a heavier test object, or glue it onto a
larger/heavier carrier, like a small piece of metal, or maybe your
1206. The calibration simply needs to see a circular contour
from the top, and it needs to be able to pick and place it, that's
all.
_Mark
> when I press park-Z
Ahhh, now I understand.
> My expectation is, that parking Z means, that the nozzle
goes into a safe place.
AFAIK, "Park" means "go to a defined Position". But "Park" has
become somewhat undefined, since we have a Safe Z Zone. A
tool would be left at whatever "lopsided" position it currently
had, as long as it was in the Safe Z Zone. So I wanted it to
become defined and useful again, specifically for
the selected tool. So this is now defined as the minimum
Safe Z for that tool.
I use this feature to define the optimal entry (and exit)
way-point of the ReferencePushPullFeeder, so no extra Z move
is added after the move at Safe Z, and the entry point is as low
as possible, for shortest time to insertion:
https://youtu.be/5QcJ2ziIJ14?t=167
And in action:
https://youtu.be/5QcJ2ziIJ14?t=254
This could also be useful for nozzle tip changer way-points etc.
Alternatively, we could also just add open up Z (and Rotation)
coordinates of the Park Location on the Head. So everybody
can define their P buttons as they like:

_Mark
> If you say fitness test, do you have any metric for that?
If it fails, it is certainly not fit enough. Remember, you were
asking for multi-exposure etc. to overcome bad lighting.
> This ansatz is only true if the test object is infinitesimal thin. For real test object with finite thickness you will always have an error that is proportional to this thickness / focal distance, always positive and systematic. For my setup (slightly bend or heavier thicker test object and rather short focal distance (~55mm)) this is certainly true. The Z error then translates a) into a larger diameter and b) seems to have a larger offset.
b) Yes and no. When the part is firmly on the nozzle, it forms
one rigid body. The rotation axis goes through the test object, at
whatever tilt the nozzle rotation axis has, and comes out at the
test object underside. So if the pick and place form a good
contact with the underside, this is cancelled out. Even if the
test object is picked up with a slight tilt, i.e. lifting one side
earlier than the other, and creating a little "hinge" offset, that
tilt and hinge offset is the same for the pick and the place. Even
if the nozzle tip front is not planar, that effect is cancelled
out because the pick & place is done at several angles.
If if there is still a slight offset, you must be realistic. You
Z axis might not be 100% orthogonal, but it will be within a few
degrees. Whether your object is 0.01mm or 0.1mm or even 1mm tall
will not matter, the error is about 1.8% per degree, i.e.
"nothing". And btw. the same error happens in placement (part +
solder paste height), so it might even be beneficial in the end
;-).
_Mark
> However, taking multiple measurments could provide a good
indication for the variance of the methods involved. The
assumption for all the vision operations is - to my
understanding - that the results are consistent and bettern then
the purpose they are used for. So I would suggest to verify this
as part of the I&S help when setting up a maschine. If
lighting/setup/configuration is an issue, this should be flaged
before taking the results for other calculations/calculations
without proper error propagation.
Yeah, but that would be a completely different Issues & Solutions step, one that looks at the camera dynamic range/noise/etc. and some settings according to some yet-to-define criteria (not easy). I have something in mind, in connection with White Balance:
https://github.com/openpnp/openpnp/wiki/Camera-White-Balance
But we were talking about the fiducial detection. In my
experience the circular symmetry stage just always worked, when
the diameter was set right. The positional result also never
wavered beyond expected dithering down at resolution, i.e. there
is no point in repeating the process. There is no tell-tale
indicator as to the quality of the detection. Even the symmetry
indicator that I compute in the stage, is all over the place and
seems to be influenced by completely unrelated things, such as the
texture of the paper, the colors and contrasts, etc. but not
posing any problems for the algorithm, or telling you the quality
and reliability of the detection.
If you find such an indicator, please tell me.
_Mark