Hi,
I appreciate the effort!
Just be aware that writing a useful test here is very
difficult. When I say useful, I mean towards an integration
test, that test a facility in its entirety and interaction,
rather than based on mocked-up isolated single function unit
tests. The latter I frankly find 95% useless, because they test
the assumptions of the developer against the assumptions of the
(same) developer, and nothing more. Worse, some developer then let
themselves go in typical "risk compensation" and start using
trial&error against the test, rather than thinking their
design through, and being forced to decompose and simplify it,
when they can't. I'm not saying you are such a developer 😇, but
the next guy introducing a regression, might be. It's just my 35
year professional experience talking.
For a useful test, you practically need to simulate the physicality of the feeder for it to be conclusive. That means simulating a moving tape in the ImageCamera, i.e., it only being moved by an actuator, just when in the right position. Wow! 😎
For inspiration: I've already added many such "physical" simulations, including imperfections like vibrations, offsets, run-out, homing errors, focal blur, lens distortion, etc. and vision based pick and place location confirmation, that can be activated, see the SimulationModeMachine.
https://github.com/openpnp/openpnp/pulls?q=is%3Apr+SimulationModeMachine+is%3Aclosed
The SampleJobTest is the ultimate integration test that way. You
could actually integrate yours there. Note, this is not my
invention, it goes back to Jason the founder of OpenPnP. I just
added many aspectual tests on top, and found those the most
conclusive.
Back to your test and question:
I looked at the source and if configured right, the feeder should position here:
and or here (for OCR/QR):
I guess you are mocking up the feeder, without really setting it up. i.e. the sprocket hole locations 1 & 2 are still zero.
Note, for the said useful tests, the machine and the feeders are
usually setup interactively, in the SimulationModeMachine (see the
machine.xml mentioned above, and accompanying other .xml files in
the folder). This gives you the most realistic setup and also btw.
implicitly tests the XML store/restore of the config, including
upgrade handlers, to not regress. Integration is king!
Btw., I hope you read the other answer about the problems of a Tape Spec. 😬
https://github.com/openpnp/openpnp/issues/1635#issuecomment-2143916355
_Mark
--
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/ffc44f4c-2591-42d2-824a-d9b439e4ba73n%40googlegroups.com.
Re testing: Nice theories, as always. I'll follow your practical efforts. 😎
> in just going this the code coverage went from 0% to 85%.
> Can test many edge cases
Yes, in theory that's correct. But judging from my experience
with employees over the years, I have yet to see a developer that
spontaneously writes edge cases into their real-world tests, or is
routine critical thinker enough to even find the relevant ones.
It's called "confirmation
bias", the stubborn human reluctance to try and find disconfirming
evidence. Maybe when I can afford hiring a second developer
to learn the same tech, study the same problem, understand the
same design, etc. and then to implement such tests... and when I
can offer them a bounty for tests that break the implementor's
code, yes then, maybe, it will start to happen. Maybe big tech
companies can afford that. Everybody else should remain realistic.
For more complex real-world cases, writing such conclusive tests
is very difficult if not impossible. In the end, I prefer my
developers using their rare and expensive brain time on the solutions.
Decompose them until you really, really understand them and can stand
behind them with professional pride. Best test criteria
there is.
Having said that, I'm not against testing per se. Just against
believing it to the silver bullet. And against test-driven
development, and subsequent overconfident "implementation by trial
& error". It is the same fallacy as teaching
to the test. If we can agree on that, then this will work.
You can allay some of these fears by also including tests with simulated (random) imperfection and expected failure. 😉
To the problem at hand:
Note the ReferencePushPullFeeder is completely anchored and
oriented by the two sprocket holes. Coordinates and orientation
(east, west, north, south or any angle of rotation around Z) are
determined by them. This affects cloning and transforming all
coordinates and motion way-points to other feeders, the relative
definition and orientation of the OCR/QR region, obviously the
calibration, and likely other stuff I don't even remember.
With the 2mm pitch, the feeder will toggle between two states
of where the sprocket holes are. In fact, to be as versatile as
the feeder was before, any multiple given by the sprocket
hole pitch divided by the part pitch should be supported. We might
one day see 1mm pitch tapes, and the current
ReferencePushPullFeeder can already do that, so you would have four
states. The state will have to be persisted in the
feeder.xml, and also be manually settable, when you mount an
offline feeder or reload the tape. I don't know whether you can
just use the present feed count. How a user would be able to see
in which state a feeder is, physically, is another question.
This statefulness must be compensated for the said anchoring.
Everything mentioned above, must work the same way, i.e. as if
the sprocket holes were still in their neutral/initial position.
So you will have to include feeder cloning, OCR/QR detection etc.
into your tests, if you want to claim the test is conclusive. A
very steep road to the real 85% 😅.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/dd25a4b6-b3e9-4fd3-8727-5a63c505888bn%40googlegroups.com.
Also started 1984. Own company from 1993. Also scary. 😂
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/85111b58-1a9c-4e0a-b2b5-532aeeb76727n%40googlegroups.com.
But now, having it all setup, the way I want it, I would not change since I use both sprocket hole vision, Y correction/adjustment on drag feed, as well as OCR (QR) on all feeders. But then again, I don't really have much problems with the 4mm feed on 0402 making the components jump.
Hm, I also started working in 1984. But of course I did a lot of hardware "development" before then, to my mother's despair. (e.g. ripping up carpets to place capacitive sensors under them, to detect humans getting close to my room. I'm sure what I thought was nice cabling by the age of 10 was not up to rest of family's standard :) )
A special chmt feeder, sounds like something I would have loved coming into OpenPnP, the setup as is, with the reference push pull feeder is rather time consuming, doing all 48 feeders, and lots of thing can go wrong.But now, having it all setup, the way I want it, I would not change since I use both sprocket hole vision, Y correction/adjustment on drag feed, as well as OCR (QR) on all feeders. But then again, I don't really have much problems with the 4mm feed on 0402 making the components jump.yes, the sprocket hole and offset detection definitely useful.Where and how are you placing the OCR labels on the feeders? A photo would be very interesting, QR codes probably a good approach here. Can you share some details of how you generate your QR code labels and how you get OpenPnP to read them?
Greetings,
Is there a STL file available to download for the OCR label holders?
--
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/742f1507-09d9-4a97-8cb0-a146990ac5dfn%40googlegroups.com.