-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature / Global Axes and Framework for Enhanced Motion Control (#1035)
* First implementation round. GCodeDriver Axis management is still redundantly in there. * Reworked Drivers to flat list. * Machine Setup Panel Tabs per class restoring and out of bounds bugfix. * Work in progress, backup commit. * Add * Axes and Transformations' Wizards implemented. Reorganized into own axis package. Wrestle with WindowBuilder. * First time tests run successful. GcodeDriver still partially running on its own (redundant) Axis mapping. * Testing and refining migration with examples. * Resolved #998 merging issues. * Cosmetics. * Created new AxesLocation for Controller side. Reworked all Transformations. * Made tests run with AxesLocation. * Testing: First steps towards "simulated imperfection". * Tested using NullDriver. * Added simulated Homing Error corrected by Visual Homing * Added simulated non-squareness corrected by Linear Axis Non-Squareness Transformation * Added simulated vibration to test Camera Settle * Added simulated camera noise to test Camera Settle * Added simulated nozzle runout to test Runout Compensation No Unit yet. * Restrict image transfer to the area of the source image, to fix some wrapping-around when going beyond the image margin. * Backup commit. * Factored OpenCvUtils.createFootprintTemplate() out for use outside of stages. * SimulationModeMachine can now check pick and place Locations by inspecting the ImageCamera view at the location. * Sub-pixel rendering etc. * Refined the NullMotionPlanner and various stuff. * Fix the camera view rotation jog to work with and respect mapped axes. * MotionPlanner first implementation. Before MappedAxes refactoring. * Reworked: no MappedAxes. Axis limits. Rotation wrap-around. * Added solver. * Better description and simpler formula. Getting the hang of this. * More cosmetics * Backup commit. * Backup commit. * Added motion solver test. Does not work (yet). * Backup commit * Backup commit before solver remove. * Removed tnc solver. Almost completed profile solver cases. * Backup commit * Changed profile solver to rudimentary secant method. * Solver seems to work now. * Backup commit * New region solver. * Tests augmented. * Before reworking path solver. * Backup before reworking path solving/half sided profiles. * Finish without trying to implement advanced motion planning. Cleanup and better comments. * Better comments. * Removed unnecessary (whitespace) changes etc. Better comments. * Self code review bugfixes. * Constant acceleration profiles. Optionally test an imperfect machine in the SampleJobTest. * Simplify Motion and MotionOption. Implement analytical constant acceleration profile solving for symmetric cases. Lots of cosmetics. * Testing on the machine with GcodeDriver: refinements and bugfixes. * Test bugfix.
- Loading branch information
Showing
93 changed files
with
12,876 additions
and
2,001 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
src/main/java/org/openpnp/gui/support/AxesComboBoxModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Copyright (C) 2020 <mark@makr.zone> | ||
* inspired and based on work | ||
* Copyright (C) 2011 Jason von Nieda <jason@vonnieda.org> | ||
* | ||
* This file is part of OpenPnP. | ||
* | ||
* OpenPnP is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
* General Public License as published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* OpenPnP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | ||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with OpenPnP. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* For more information about OpenPnP visit http://openpnp.org | ||
*/ | ||
|
||
package org.openpnp.gui.support; | ||
|
||
import java.beans.PropertyChangeEvent; | ||
import java.beans.PropertyChangeListener; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.Comparator; | ||
|
||
import javax.swing.DefaultComboBoxModel; | ||
|
||
import org.openpnp.model.Configuration; | ||
import org.openpnp.spi.Axis; | ||
import org.openpnp.spi.base.AbstractMachine; | ||
|
||
@SuppressWarnings({"serial", "rawtypes"}) | ||
public class AxesComboBoxModel extends DefaultComboBoxModel implements PropertyChangeListener { | ||
private Comparator<Axis> comparator = new Comparator<Axis>() { | ||
@Override | ||
public int compare(Axis o1, Axis o2) { | ||
return o1.getName().compareTo(o2.getName()); | ||
} | ||
}; | ||
final private boolean addEmpty; | ||
final private Class<? extends Axis> types; | ||
final private AbstractMachine machine; | ||
private Axis.Type axisType; | ||
|
||
public AxesComboBoxModel(AbstractMachine machine, Class<? extends Axis> types, Axis.Type axisType, boolean addEmpty) { | ||
this.machine = machine; | ||
this.addEmpty = addEmpty; | ||
this.types = types; | ||
this.axisType = axisType; | ||
if (machine != null) { // we're not in Window Builder Design Mode | ||
addAllElements(); | ||
machine.addPropertyChangeListener("axes", this); | ||
} | ||
} | ||
|
||
private void addAllElements() { | ||
if (machine != null) { // we're not in Window Builder Design Mode | ||
ArrayList<Axis> axes = null; | ||
axes = new ArrayList<>(machine.getAxes()); | ||
Collections.sort(axes, comparator); | ||
for (Axis axis : axes) { | ||
if (types.isInstance(axis)) { | ||
if (axisType == null || axisType == axis.getType()) { | ||
addElement(axis.getName()); | ||
} | ||
} | ||
} | ||
if (addEmpty) { | ||
addElement(new String()); | ||
} | ||
} | ||
} | ||
|
||
public Axis.Type getAxisType() { | ||
return axisType; | ||
} | ||
|
||
public void setAxisType(Axis.Type axisType) { | ||
this.axisType = axisType; | ||
removeAllElements(); | ||
addAllElements(); | ||
} | ||
|
||
@Override | ||
public void propertyChange(PropertyChangeEvent evt) { | ||
removeAllElements(); | ||
addAllElements(); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/org/openpnp/gui/support/DriversComboBoxModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (C) 2020 <mark@makr.zone> | ||
* inspired and based on work | ||
* Copyright (C) 2011 Jason von Nieda <jason@vonnieda.org> | ||
* | ||
* This file is part of OpenPnP. | ||
* | ||
* OpenPnP is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
* General Public License as published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* OpenPnP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | ||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with OpenPnP. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* For more information about OpenPnP visit http://openpnp.org | ||
*/ | ||
|
||
package org.openpnp.gui.support; | ||
|
||
import java.beans.PropertyChangeEvent; | ||
import java.beans.PropertyChangeListener; | ||
|
||
import javax.swing.DefaultComboBoxModel; | ||
|
||
import org.openpnp.spi.Driver; | ||
import org.openpnp.spi.base.AbstractMachine; | ||
|
||
@SuppressWarnings({"serial", "rawtypes"}) | ||
public class DriversComboBoxModel extends DefaultComboBoxModel implements PropertyChangeListener { | ||
final private AbstractMachine machine; | ||
final private boolean addEmpty; | ||
|
||
public DriversComboBoxModel(AbstractMachine machine, boolean addEmpty) { | ||
this.machine = machine; | ||
this.addEmpty = addEmpty; | ||
addAllElements(); | ||
if (machine != null) { // we're not in Window Builder Design Mode | ||
this.machine.addPropertyChangeListener("drivers", this); | ||
} | ||
} | ||
|
||
private void addAllElements() { | ||
if (machine == null) { | ||
return;// we're in Window Builder Design Mode | ||
} | ||
for (Driver driver : machine.getDrivers()) { | ||
addElement(driver.getName()); | ||
} | ||
if (addEmpty) { | ||
addElement(new String()); | ||
} | ||
} | ||
|
||
@Override | ||
public void propertyChange(PropertyChangeEvent evt) { | ||
removeAllElements(); | ||
addAllElements(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) 2019 <mark@makr.zone> | ||
* | ||
* This file is part of OpenPnP. | ||
* | ||
* OpenPnP is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
* General Public License as published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* OpenPnP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | ||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with OpenPnP. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* For more information about OpenPnP visit http://openpnp.org | ||
*/ | ||
|
||
package org.openpnp.gui.support; | ||
|
||
import java.util.List; | ||
|
||
import org.jdesktop.beansbinding.Converter; | ||
import org.openpnp.model.Named; | ||
|
||
public class NamedConverter<NamedType extends Named> extends Converter<NamedType, String> { | ||
final List<NamedType> pool; | ||
|
||
public NamedConverter(List<NamedType> pool) { | ||
super(); | ||
this.pool = pool; | ||
} | ||
|
||
@Override | ||
public String convertForward(NamedType named) { | ||
if (named == null) { | ||
return ""; | ||
} | ||
else { | ||
return named.getName(); | ||
} | ||
} | ||
|
||
@Override | ||
public NamedType convertReverse(String s) { | ||
for (NamedType named : pool) { | ||
if (named.getName().equals(s)) { | ||
return named; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
Oops, something went wrong.