Skip to content

Commit

Permalink
Removed unnecessary (whitespace) changes etc. Better comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
markmaker committed Aug 6, 2020
1 parent ee29ca7 commit cd6b55f
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/openpnp/gui/components/CameraView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ private void moveToClick(MouseEvent e) {
// Add the offsets to the Camera's nozzle calibrated position.
Location location = camera.getLocation(nozzle).add(offsets);
// Only change X/Y.
location = nozzle.getLocation().derive(location, true, true, false, false);
location = nozzle.getLocation().derive(location, true, true, false, false);
MovableUtils.moveToLocationAtSafeZ(nozzle, location);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* This Driver interface is intended to talk to one controller with Axes and Actuators attached.
*
* In OpenPnP, the Head does not move on it's own. It is moved by the moving of attached objects:
* Nozzles, Cameras, Actuators, so-called HeadMountables. The HeadMountables specify with which axes
* Nozzles, Cameras, Actuators, so-called HeadMountables. The HeadMountables specify by which axes
* they are moved. The axes are in turn assigned to the Driver. When you move a HeadMountable the
* MotionPlanner will determine which axes are involved and call the drivers accordingly.
*
Expand Down Expand Up @@ -159,7 +159,7 @@ public default void createDefaults() throws Exception {}

/**
* Migrates the driver for the new global axes implementation. Is marked a deprecated as it can be removed
* along with the old GcodeDriver Axes implementation, if migration of users is expected to be complete.
* along with the old GcodeDriver Axes implementation, once migration of users is expected to be complete.
*
* @param machine
* @throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void home() throws Exception {
if (getVisualHomingMethod() != VisualHomingMethod.None) {
/*
* The head default camera should now be (if everything has homed correctly) directly
* above the homing pin in the machine bed, use the head camera scan for this and make sure
* above the homing fiducial on the machine bed, use the head camera scan for this and make sure
* this is exactly central - otherwise we move the camera until it is, and then reset all
* the axis back to the fiducial location as this is calibrated home.
*/
Expand All @@ -76,7 +76,7 @@ public void home() throws Exception {
axesHomingLocation = hm.toRaw(hm.toHeadLocation(getHomingFiducialLocation()));
}
else {
// Use bare X, Y homing coordinates.
// Use bare X, Y homing coordinates (legacy mode).
axesHomingLocation = new AxesLocation(machine,
(axis) -> (axis.getHomeCoordinate()));
}
Expand Down Expand Up @@ -145,7 +145,7 @@ public void moveTo(HeadMountable hm, Location location, double speed, MoveToOpti
if (!mappedAxes.isEmpty()) {
AxesLocation axesLocation = hm.toRaw(location);
machine.getMotionPlanner().moveTo(hm, axesLocation, speed, options);
// For now just do it immediately. TODO: implement smart wait for completion.
// For now just do it immediately. TODO: wait only where necessary, e.g. in vision and (perhaps) vacuum sensing.
machine.getMotionPlanner().waitForCompletion(hm, CompletionType.WaitForStillstand);
machine.fireMachineHeadActivity(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import org.openpnp.machine.reference.wizards.ReferenceNozzleCameraOffsetWizard;
import org.openpnp.machine.reference.wizards.ReferenceNozzleCompatibleNozzleTipsWizard;
import org.openpnp.machine.reference.wizards.ReferenceNozzleConfigurationWizard;
import org.openpnp.machine.reference.wizards.ReferenceNozzleVacuumWizard;
import org.openpnp.machine.reference.wizards.ReferenceNozzleToolChangerWizard;
import org.openpnp.machine.reference.wizards.ReferenceNozzleVacuumWizard;
import org.openpnp.model.Configuration;
import org.openpnp.model.Length;
import org.openpnp.model.LengthUnit;
Expand All @@ -30,11 +30,9 @@
import org.openpnp.spi.Nozzle;
import org.openpnp.spi.NozzleTip;
import org.openpnp.spi.PropertySheetHolder;
import org.openpnp.spi.Movable.MoveToOption;
import org.openpnp.spi.base.AbstractNozzle;
import org.openpnp.util.MovableUtils;
import org.openpnp.util.SimpleGraph;
import org.openpnp.util.Utils2D;
import org.pmw.tinylog.Logger;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ public Location getCalibratedOffset(ReferenceNozzle nozzle, double angle) {
}

return this.getRunoutCompensation(nozzle).getOffset(angle);

}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ImageCamera extends ReferenceCamera implements Runnable {
private PropertyChangeSupport pcs = new PropertyChangeSupport(this);

@Attribute(required = false)
private int fps = 24;
private int fps = 30;

@Element
private String sourceUri = "classpath://samples/pnp-test/pnp-test.png";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class SimulatedUpCamera extends ReferenceCamera implements Runnable {

protected int height = 1280;

protected int fps = 24;
protected int fps = 30;

private Thread thread;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@
import org.openpnp.gui.support.PropertySheetWizardAdapter;
import org.openpnp.gui.support.Wizard;
import org.openpnp.machine.reference.ReferenceDriver;
import org.openpnp.machine.reference.ReferenceMachine;
import org.openpnp.machine.reference.driver.SerialPortCommunications.DataBits;
import org.openpnp.machine.reference.driver.SerialPortCommunications.FlowControl;
import org.openpnp.machine.reference.driver.SerialPortCommunications.Parity;
import org.openpnp.machine.reference.driver.SerialPortCommunications.StopBits;
import org.openpnp.machine.reference.driver.wizards.AbstractReferenceDriverConfigurationWizard;
import org.openpnp.model.Length;
import org.openpnp.model.LengthUnit;
import org.openpnp.spi.base.AbstractDriver;
import org.openpnp.spi.base.AbstractMachine;
import org.pmw.tinylog.Logger;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

public class GcodeDriverSettings extends AbstractConfigurationWizard {
private final GcodeDriver driver;
private JCheckBox backslashEscapedCharacters;

public GcodeDriverSettings(GcodeDriver driver) {
this.driver = driver;
Expand Down Expand Up @@ -288,9 +287,9 @@ public void actionPerformed(ActionEvent arg0) {
private JTextField commandTimeoutTf;
private JTextField connectWaitTimeTf;
private JComboBox unitsCb;
private JCheckBox backslashEscapedChar;
private JCheckBox supportingPreMove;
private JCheckBox letterVariables;
private JCheckBox backslashEscapedCharacters;

static class HeadMountableItem {
private HeadMountable hm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ public Location getLocation(Placement locatable) {
expectedLocations.add(fiducial.getLocation().invert(boardSide==Side.Bottom, false, false, false));
measuredLocations.add(measuredLocation);

Logger.debug("Found {} nominal {} at {}", fiducial.getId(),
Utils2D.calculateBoardPlacementLocation(boardLocation, fiducial.getLocation()), measuredLocation);
Logger.debug("Found {} at {}", fiducial.getId(), measuredLocation);
}

// Calculate the transform.
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/openpnp/model/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ public static Serializer createSerializer() {
return serializer;
}


public static String createId(String prefix) {
// NanosecondTime guarantees unique Ids, even if created in rapid succession such as in migration code.
return prefix + NanosecondTime.get().toString(16);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/openpnp/spi/HeadMountable.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.openpnp.spi;

import org.openpnp.model.AxesLocation;
import org.openpnp.model.Identifiable;
import org.openpnp.model.LengthUnit;
import org.openpnp.model.Location;
import org.openpnp.model.Named;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/openpnp/spi/MotionPlanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* <li>Accept a sequence of raw moveTo() commands.</li>
* <li>Coordinate motion across multiple drivers.</li>
* <li>For advanced MotionPlanners, perform optimization on the sequence. </li>
* <li>As soon as the motion is commited ie. when waiting for completion, command the drivers to plan and execute the plan.</li>
* <li>As soon as the motion is commited i.e. when waiting for completion, command the drivers to plan and execute the plan.</li>
* <li>Provide access to the planned motion over time for simulation, visualization etc. </li>
* </ul>
* <p>
Expand Down
22 changes: 5 additions & 17 deletions src/main/java/org/openpnp/spi/base/AbstractHead.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,8 @@ public AbstractHead() {
@SuppressWarnings("unused")
@Commit
private void commit() {
for (Nozzle nozzle : nozzles) {
nozzle.setHead(this);
}
for (Camera camera : cameras) {
camera.setHead(this);
}
for (Actuator actuator : actuators) {
actuator.setHead(this);
for (HeadMountable hm : getHeadMountables()) {
hm.setHead(this);
}
}

Expand Down Expand Up @@ -202,15 +196,9 @@ public void removeNozzle(Nozzle nozzle) {
@Override
public List<HeadMountable> getHeadMountables() {
List<HeadMountable> list = new ArrayList<>();
for (Nozzle nozzle : nozzles) {
list.add(nozzle);
}
for (Camera camera : cameras) {
list.add(camera);
}
for (Actuator actuator : actuators) {
list.add(actuator);
}
list.addAll(nozzles);
list.addAll(cameras);
list.addAll(actuators);
return list;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public Result process(CvPipeline pipeline) throws Exception {
Imgproc.HoughCircles(mat, output, Imgproc.CV_HOUGH_GRADIENT, dp,
minDistance,
param1, param2,
minDiameter / 2-2,
maxDiameter / 2+2);
minDiameter / 2,
maxDiameter / 2);
List<Result.Circle> circles = new ArrayList<>();
for (int i = 0; i < output.cols(); i++) {
double[] circle = output.get(0, i);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/BasicJobTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void testSimpleJob() throws Exception {

Configuration.initialize(workingDirectory);
Configuration.get().load();
// Save back migrated.
Configuration.get().save();

Machine machine = Configuration.get().getMachine();
Expand Down
1 change: 1 addition & 0 deletions src/test/java/ReferenceBottomVisionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static void testError(Location error) throws Exception {

Configuration.initialize(workingDirectory);
Configuration.get().load();
// Save migrated.
Configuration.get().save();

Machine machine = Configuration.get().getMachine();
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/SampleJobTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testSampleJob() throws Exception {
ReferenceMachine machine = (ReferenceMachine) Configuration.get().getMachine();

NullDriver driver = (NullDriver) machine.getDefaultDriver();
// Make it super-fast for the test.
// Make it super-fast for the test (now with axes).
driver.setFeedRateMmPerMinute(0);
for (Axis axis : machine.getAxes()) {
if (axis instanceof ReferenceControllerAxis) {
Expand All @@ -56,7 +56,7 @@ public void testSampleJob() throws Exception {
AbstractCamera camera = (AbstractCamera)machine.getDefaultHead().getDefaultCamera();
camera.setSettleMethod(AbstractCamera.SettleMethod.FixedTime);
camera.setSettleTimeMs(0);

// File videoFile = new File("target");
// videoFile = new File(videoFile, "SampleJobTest.mp4");
// MpegEncodingCameraListener encoder = new MpegEncodingCameraListener(videoFile);
Expand Down

0 comments on commit cd6b55f

Please sign in to comment.