Nozzle Calibration Pipeline
If you receive the error message
Nozzle tip calibration: not enough results from vision. Check pipeline and threshold when homing your LumenPnP, you likely need to adjust your nozzle tip calibration pipeline. Follow the steps below for a guide on the iterative approach. See also our setup video.
Position Nozzle Over Bottom Camera
- Stages 0-4 pre-process the image from the camera to make the tip of the nozzle clearer. Their goal is to outline the tip of the nozzle on its own so that it's exact position can be calculated. Of these stages, #3,
Thresholdis the most useful to tune. (See below for details)
- The Results stage,
DetectCirclesHough, takes the highlighted nozzle tip and calculates it's exact location by fitting a perfect circle to the tip. It's important that this calculation be reliable and repeatable. It's also important not to have extra erroneous circles detected, which could throw off the nozzle tip calibration and lead to imprecise picking.
- Stages 5-7 are for debugging and showing you visually the output of the Results Stage. The most useful stage here is the #6
DrawCirclesstage. After adjusting a setting, review the
DrawCirclesstage and check if the fiducial has been correctly identified.
- If there is more than one circle detected, then we need to more clearly distinguish the real nozzle tip.
- If there is one circle, but it is not correctly drawn around the nozzle tip hole, then we need to more clearly distinguish the hole.
- If there are no circles, we need to loosen the filtering to make the nozzle tip easier to identify.
- If the image looks like the good one above, your pipeline is properly tuned. If you've still been getting failures when homing, you may need to slightly loosen the filtering.
You will need to take an iterative approach to tune your vision pipeline. Because your machine's cameras and lighting conditions are unique, there is unfortunately no one-size-fits-all solution here. Make small changes and track how they affect the identification of the tip of your nozzle.
Check the Debug Results
Unlike homing fiducial tuning, nozzle tip tuning needs to be able to identify the nozzle multiple times as it is rotated. This can make it slightly trickier to see the issues with your calibration pipeline. You may need to run a round of calibration and watch the results live to see which orientation of the toolhead gives the pipeline the most trouble. You can also increase the
Allowed Misdetects option if you're getting good picking results, but homing still fails occasionally.
Threshold stage is the most commonly edited stage. It turns the camera image into black and white, which starkly defines the tip of your nozzle. It is important that the inner hole of your nozzle is a clear white circle after this step. Raise or lower the
threshold parameter as necessary until the image is precise. Note that the
invert button is checked so that the nozzle tip hole is shown in white for the next steps.
- If the image is too dark, raise the
- If the image is too bright, lower the
DetectCirclesHough is the other commonly edited stage. You'll need to experiment with the following adjustments:
param2 adjusts how likely the algorithm will be to detect a circle.
- If there are no circles, lower the
- If there are too many circles, raise the
Depending on your nozzle tip, may also need to adjust the
- Raise the
maxDiametersetting if there are no circles detected at all after adjusting the other settings.
- Lower the
maxDiametersetting if very large circles are drawn around noise in the image.
BlurMedian can be useful if there are debris blocking the inner hole of your nozzle tip. That debris can cause the round silhouette of the hole to be interrupted and not be identified by the
DetectCirclesHough stage. Use
BlurMedian to remove artifacts in the photo, but don't blur so much that you significantly change the silhouette of the nozzle.
- Raise the
kernelSizeif the center of your nozzle tip doesn't make a perfect circle.
- Lower the
kernelSizeif the center of your nozzle tip is distorted from too much blur.