Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Round-up of Bug-Fixes and some Missing Utility Features #1169

Merged
merged 1 commit into from Apr 20, 2021

Conversation

markmaker
Copy link
Collaborator

@markmaker markmaker commented Apr 11, 2021

Description

This is a round-up of bug-fixes and conceptually missing utility features. These have popped up while working on #1164 (which will likely be re-submitted as a new one later).

Bug-fixes

  • Bug-fix for Recycling Feature: Core #1143 (null pointer exception when part is missing in feeder)
  • Parts table does not update on part property changes.
  • Inconsistent FIRMWARE detection in GcodeDriverSolutions.
  • Edit Pipeline does not wait for machine in ReferencePushPullFeederConfigurationWizard, resulting in the lighting actuator failing.
  • Test Alignment in ReferenceBottomVisionPartConfigurationWizard did not conserve rotation of selected nozzle.
  • Nozzle tip calibration failed the homing cycle if enabled on homing, creating a chicken egg situation during machine setup. Added an option to switch off. Improved error messages. This required UiUtils.messageBoxOnExceptionLater() for deferred GUI tasks (in this case deferred throws/error messages).
  • null check missing in AbstractHeadMountable.toHeadLocation(), refactored/extracted AbstractHeadMountable.applyConfiguration() for future use.
  • Pipeline stages that throw exceptions are logged for easier diagnostics. The underlying issue that some exceptions should fail the pipeline immediately is still open.
  • In the Pipeline Editor: custom Object type property sheet handlers need resetting when switching stages.

Missing conceptual/utility features

  • Missing NozzleTip.home() for Machine Setup tree topological homing.
  • Missing Length.compareTo()
  • Missing Location.getXyzLengthTo() i.e. length including Z coordinate.
  • Added Location.origin constant as the (0, 0, 0, 0) coordinate, for easy use in the form vector.getXyzLengthTo(Location.origin) to measure vector length.
  • Missing Location.multiply() similar to the other operations.
  • Missing Head.permutateNozzle() same as for cameras, Also fixed parameter name in permutateCamera()
  • Missing ImageUtils.clone() to deep copy a BufferedImage.

Justification

This is the first break-out of #1164 trying to implement this input by @vonnieda.

I found it acceptable to put these in one PR as these are almost entirely one class = one fix and small (counting class+Wizards as one).

Instructions for Use

The only visible change is the new option Fail Homing? on the nozzle tip calibration.

Fail Homing

Implementation Details

  1. The bug-fixes were tested in Feature/Nozzle Tip Changer XYZ Calibration, Part Height, Feeder, Placement contact probing, Auto-Focus #1164. After extraction just mvn test.
  2. Did follow the coding style.
  3. Changes in the org.openpnp.spi or org.openpnp.model packages: Head.permutateNozzle() and NozzleTip.home() and Length and Location additions as documented.
  4. Successful mvn test before submitting the Pull Request.

…eatures.

Bug-fixes:
* Bug-fix for openpnp#1143 (null pointer exception when part is missing in feeder)
* Parts table does not update on part property changes.
* Inconsistent FIRMWARE detection in GcodeDriverSolutions
* Edit Pipeline does not wait for machine in ReferencePushPullFeederConfigurationWizard, resulting in the lighting actuator failing.
* Test Alignment in ReferenceBottomVisionPartConfigurationWizard did not conserve rotation of selected nozzle.
* Nozzle tip calibration failed the homing cycle if enabled on homing, creating a chicken egg situation during machine setup. Added an option to switch off. Improved error messages. This required  UiUtils.messageBoxOnExceptionLater() for deferred GUI tasks (in this case deferred throws/error messages).
* null check missing in AbstractHeadMountable.toHeadLocation(), refactored/extracted AbstractHeadMountable.applyConfiguration() for future use.
* Pipeline stages that throw exceptions are logged for easier diagnostics. The underlying issue that some exceptions should fail the pipeline immediately is still open.
* In the Pipeline Editor: custom Object type property sheet handlers need resetting when switching stages.

Missing features/utilities:
* Machine Setup tree recursive/topological home() is missing from NozzleTip.
* compareTo() missing in Length
* getXyzLengthTo() i.e. length including Z missing in Location
* Added Location.origin constant as the (0, 0, 0, 0) coordinate, for easy use in the form vector.getXyzLengthTo(Location.origin) to measure vector length.
* multiply() missing in Location
* permutateNozzle() missing in Location, also fixed parameter name in permutateCamera()
* Added ImageUtils.clone() to deep copy a BufferedImage.
@vonnieda
Copy link
Member

Nice PR @markmaker - and thank you for taking the time to split it up. It makes it so much easier to review one or two before bed :)

@vonnieda vonnieda merged commit 9d5e666 into openpnp:develop Apr 20, 2021
@vonnieda
Copy link
Member

I'm going to revert this for now because merging it caused conflicts. I'll finish reviewing all of the PRs tomorrow and then merge them in the correct order to avoid conflicts.

vonnieda added a commit that referenced this pull request Apr 20, 2021
vonnieda added a commit that referenced this pull request Apr 20, 2021
vonnieda added a commit that referenced this pull request Apr 20, 2021
@my-3d-cnc-pnp
Copy link
Contributor

Hello.

After loading releases that contain PR#1169 the part test alignment button is behaving differently.
The first time the button is pressed it positions/rotates the part properly centered and squared.
If I press the button again it adds the original correction angle again and now the part is rotated and no longer squared
Every time the button is pressed it adds the correction angle again and the part rotates more and more.

I reverted the changes of the two lines of code in ReferenceBottomVisionPartConfigurationWizard(see below) and then it works as before.

From the comment in the description of bug fixes in PR#1169:
"* Test Alignment in ReferenceBottomVisionPartConfigurationWizard did not conserve rotation of selected nozzle."
It looks like it is now conserving the rotation properly but also conserves the angular correctional offset

Perhaps there is a problem with my setup of the shared C or something else in my configuration that did not show up before this PR
If a Debug Log or machine.xml file is needed let me know

   public class ReferenceBottomVisionPartConfigurationWizard extends AbstractConfigurationWizard {
      private final ReferenceBottomVision bottomVision;
   @@ -159,7 +156,7 @@ private void testAlignment() throws Exception {

    // perform the alignment
    PartAlignment.PartAlignmentOffset alignmentOffset =     VisionUtils.findPartAlignmentOffsets(bottomVision, part,

-----> Pre PR#1169 null, new Location(LengthUnit.Millimeters), nozzle);
-----> Post PR#1169 null, new Location(LengthUnit.Millimeters, 0, 0, 0, nozzle.getLocation().getRotation()), nozzle);
Location offsets = alignmentOffset.getLocation();

    if (!chckbxCenterAfterTest.isSelected()) {
    @@ -168,7 +165,7 @@ private void testAlignment() throws Exception {

    // position the part over camera center
    Location cameraLocation = bottomVision.getCameraLocationAtPartHeight(part, VisionUtils.getBottomVisionCamera(),

------> Pre PR#1169 nozzle, 0.);
------> Post PR#1169 nozzle, nozzle.getLocation().getRotation());

    if (alignmentOffset.getPreRotated()) {
        // See https://github.com/openpnp/openpnp/pull/590 for explanations of the magic

`

@markmaker
Copy link
Collaborator Author

markmaker commented May 26, 2021

Hi @my-3d-cnc-pnp,

That change was intentional to allow alignment testing at the chosen nominal nozzle angle. Otherwise, you could not actually test alignment at non-zero angles and especially not effectively test the pre-rotate option (i.e. what it does differently).

The idea is to set the wanted nominal angle with the Jog C buttons, then press Test Alignment. If you want 0°, just press the P button before Test Alignment. If you want to test a specific angle, set it using the Jog buttons.

Jog C

The ability to test Alignment (especially pre-rotate) at various angles is useful both for developers and for users, I was missing it many times in both situations.

Furthermore, when a part height is unknown, the auto-focus (see #1171) can now sense it in Alignment, and it is important that no unnecessary rotation takes place when doing so, therefore it was again useful for testing.

Do you think this is very confusing? I could instead add a "Test angle" field to the GUI.

Just to point out: the change was documented, see the Description of both the original PR #1164 ...

  • Test Alignment GUI action now uses the current nozzle rotation angle (to test pre-rotate + Auto-focus).

... and #1169 (this one):

  • Test Alignment in ReferenceBottomVisionPartConfigurationWizard did not conserve rotation of selected nozzle.

_Mark

@markmaker
Copy link
Collaborator Author

Improved it here:
#1203
_Mark

@markmaker
Copy link
Collaborator Author

@my-3d-cnc-pnp,
a new version was deployed. Please upgrade and test.
Much appreciated, thanks.
_Mark

@my-3d-cnc-pnp
Copy link
Contributor

Upgraded and tested. Now works as expected. Perfect!

The addition of the "Test Angle" field makes the new feature obvious and the "angle" variable in the code fixed the error accumulation that confused me.
What software do you use/recommend to make the video captures like the one in the description of the new PR#1203?
My explanation would have been much clearer if I had included one.

Thank you as always
Peter

@markmaker
Copy link
Collaborator Author

What software do you use/recommend to make the video captures like the one in the description of the new PR#1203?

I'm using a very old Camtasia version to record from screen. I'm sure there are better/free solutions available nowadays. It just creates a video of what happens on the screen.

Then I use a special ffmpeg command line to convert to .gif, so I get a small file that I can upload easily and that embeds as animation.

On Windows I put the following in convert_gif.cmd.

ffmpeg -i %1 -filter_complex "[0:v] split [a][b];[a] palettegen [p];[b][p] paletteuse"  %1.gif
pause

So I can drop files to convert on it. Obviously, ffmpeg must be in the path or in the same directory as the .cmd.

_Mark

@markmaker markmaker deleted the fix/various-bugfixes-from-work branch January 3, 2022 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants