Skip to content

Commit

Permalink
Simplify Motion and MotionOption.
Browse files Browse the repository at this point in the history
Implement analytical constant acceleration profile solving for symmetric cases.
Lots of cosmetics.
  • Loading branch information
markmaker committed Aug 9, 2020
1 parent 38aae5d commit 1f52b1c
Show file tree
Hide file tree
Showing 29 changed files with 296 additions and 279 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/openpnp/machine/marek/MarekNozzle.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.openpnp.model.Length;
import org.openpnp.model.LengthUnit;
import org.openpnp.model.Location;
import org.openpnp.model.Motion.MotionOption;
import org.openpnp.spi.Actuator;
import org.openpnp.spi.Movable.MoveToOption;
import org.pmw.tinylog.Logger;
import org.simpleframework.xml.Element;

Expand All @@ -23,7 +23,7 @@ public MarekNozzle(String id) {
}

@Override
public void moveTo(Location location, double speed, MoveToOption... options) throws Exception {
public void moveTo(Location location, double speed, MotionOption... options) throws Exception {
Location currentLocation = getLocation().convertToUnits(location.getUnits());
location = toHeadLocation(location, currentLocation);

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/openpnp/machine/neoden4/NeoDen4Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.openpnp.spi.Axis;
import org.openpnp.spi.ControllerAxis;
import org.openpnp.spi.MotionPlanner.CompletionType;
import org.openpnp.spi.Movable.MoveToOption;
import org.openpnp.spi.Nozzle;
import org.pmw.tinylog.Logger;
import org.simpleframework.xml.Attribute;
Expand Down Expand Up @@ -488,7 +487,7 @@ private void setMoveSpeed(double speed) throws Exception {
}

@Override
public void moveTo(ReferenceHeadMountable hm, Motion motion, MoveToOption... options)
public void moveTo(ReferenceHeadMountable hm, Motion motion)
throws Exception {
AxesLocation location = motion.getLocation1();
double feedRate = motion.getFeedRatePerSecond(this);
Expand Down
22 changes: 9 additions & 13 deletions src/main/java/org/openpnp/machine/reference/ReferenceDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
import org.openpnp.model.Motion;
import org.openpnp.spi.Driver;
import org.openpnp.spi.MotionPlanner.CompletionType;
import org.openpnp.spi.Movable.MoveToOption;
import org.openpnp.spi.PropertySheetHolder;
import org.openpnp.spi.WizardConfigurable;

/**
* Defines the interface for a simple driver that the ReferenceMachine can drive. All methods result
* Defines the interface for a simple driver that the MotionPlanner can drive. All methods result
* in machine operations and most methods should block until they are complete or throw an error.
*
* This Driver interface is intended to talk to one controller with Axes and Actuators attached.
Expand All @@ -41,8 +40,8 @@
* MotionPlanner will determine which axes are involved and call the drivers accordingly.
*
* Drivers should only expose the functionality of the controller in a unified way. They should not add
* additional logic on top other than what is needed to make the controller behave like any other
* controller. This is different from previous versions of OpenPnP where the driver did much more.
* additional logic other than what is needed to make an attached controller behave like any other. This is
* different from previous versions of OpenPnP where the driver did much more.
*
*/
public interface ReferenceDriver extends Driver, WizardConfigurable, PropertySheetHolder, Closeable {
Expand Down Expand Up @@ -73,24 +72,21 @@ public interface ReferenceDriver extends Driver, WizardConfigurable, PropertyShe
public void setGlobalOffsets(ReferenceMachine machine, AxesLocation axesLocation) throws Exception;

/**
* Moves the specified MappedAxes to the given location at a speed defined by (maximum feed
* rate * speed) where speed is greater than 0 and typically less than or equal to 1. A speed of
* 0 means to move at the minimum possible speed.
* Executes the given Motion.
*
* @param hm The HeadMountable having triggered the move. This is mostly for proprietary machine driver support
* and might only be a stand-in in some motion blending scenarios on the GcodeDriver.
* @param motion The moveTo Motion to execute, including location, feedrate, acceleration etc. as shaped by the MotionPlanner
* @param options Zero to n options from the MoveToOptions enum.
* and might only be a stand-in in some motion blending scenarios.
* @param motion The moveTo Motion to execute, including target location, feedrate, acceleration etc. as shaped by
* the MotionPlanner
* @throws Exception
*/
public void moveTo(ReferenceHeadMountable hm, Motion motion, MoveToOption... options) throws Exception;
public void moveTo(ReferenceHeadMountable hm, Motion motion) throws Exception;

/**
* Perform a coordinated wait for completion. This must be issued before capturing camera frames etc.
* @see org.openpnp.spi.MotionPlanner.waitForCompletion(HeadMountable, CompletionType)
*
* @param hm The HeadMountable to wait for. If null, wait for all the axes on the driver. Most drivers/controllers will probably
* not be able to wait for just a sub-set of axes but the interface should allow for this.
* not be able to wait for just a sub-set of axes, so the'll wait for all the axes anyway.
* @param completionType The kind of completion wanted.
* @throws Exception
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
import org.openpnp.model.AxesLocation;
import org.openpnp.model.Configuration;
import org.openpnp.model.Location;
import org.openpnp.model.Motion.MotionOption;
import org.openpnp.model.Part;
import org.openpnp.spi.Axis;
import org.openpnp.spi.HeadMountable;
import org.openpnp.spi.MotionPlanner.CompletionType;
import org.openpnp.spi.Movable.MoveToOption;
import org.openpnp.spi.PropertySheetHolder;
import org.openpnp.spi.base.AbstractHead;
import org.openpnp.spi.base.AbstractHeadMountable;
Expand Down Expand Up @@ -139,7 +139,7 @@ public boolean isInsideSoftLimits(HeadMountable hm, Location location) throws E
}

@Override
public void moveTo(HeadMountable hm, Location location, double speed, MoveToOption... options) throws Exception {
public void moveTo(HeadMountable hm, Location location, double speed, MotionOption... options) throws Exception {
ReferenceMachine machine = getMachine();
AxesLocation mappedAxes = hm.getMappedAxes(machine);
if (!mappedAxes.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.openpnp.spi.Feeder;
import org.openpnp.spi.HeadMountable;
import org.openpnp.spi.Machine;
import org.openpnp.spi.Movable.LocationOption;
import org.openpnp.spi.Locatable.LocationOption;
import org.openpnp.spi.Nozzle;
import org.openpnp.util.NanosecondTime;
import org.pmw.tinylog.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.openpnp.machine.reference.axis.wizards.ReferenceCamClockwiseAxisConfigurationWizard;
import org.openpnp.model.AxesLocation;
import org.openpnp.model.Configuration;
import org.openpnp.spi.Movable.LocationOption;
import org.openpnp.spi.Locatable.LocationOption;
import org.openpnp.spi.base.AbstractMachine;
import org.openpnp.spi.base.AbstractSingleTransformedAxis;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@
import org.openpnp.model.Configuration;
import org.openpnp.model.Length;
import org.openpnp.model.LengthUnit;
import org.openpnp.model.Location;
import org.openpnp.spi.Axis;
import org.openpnp.spi.Movable.LocationOption;
import org.openpnp.spi.base.AbstractAxis;
import org.openpnp.spi.base.AbstractControllerAxis;
import org.openpnp.spi.Locatable.LocationOption;
import org.openpnp.spi.base.AbstractMachine;
import org.openpnp.spi.base.AbstractTransformedAxis;
import org.openpnp.spi.base.AbstractSingleTransformedAxis;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
import org.openpnp.model.AxesLocation;
import org.openpnp.model.Length;
import org.openpnp.model.LengthUnit;
import org.openpnp.model.Location;
import org.openpnp.spi.Axis;
import org.openpnp.spi.Movable.LocationOption;
import org.openpnp.spi.base.AbstractControllerAxis;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.openpnp.model.LengthUnit;
import org.openpnp.spi.Axis;
import org.openpnp.spi.Machine;
import org.openpnp.spi.Movable.LocationOption;
import org.openpnp.spi.Locatable.LocationOption;
import org.openpnp.spi.base.AbstractAxis;
import org.openpnp.spi.base.AbstractMachine;
import org.openpnp.spi.base.AbstractTransformedAxis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.openpnp.model.Configuration;
import org.openpnp.model.Length;
import org.openpnp.model.LengthUnit;
import org.openpnp.spi.Movable.LocationOption;
import org.openpnp.spi.Locatable.LocationOption;
import org.openpnp.spi.base.AbstractMachine;
import org.openpnp.spi.base.AbstractSingleTransformedAxis;
import org.pmw.tinylog.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,9 @@
import org.openpnp.machine.reference.axis.wizards.ReferenceVirtualAxisConfigurationWizard;
import org.openpnp.model.AxesLocation;
import org.openpnp.model.Length;
import org.openpnp.model.LengthUnit;
import org.openpnp.spi.Axis;
import org.openpnp.spi.CoordinateAxis;
import org.openpnp.spi.Machine;
import org.openpnp.spi.Movable.LocationOption;
import org.openpnp.spi.base.AbstractAxis;
import org.openpnp.spi.base.AbstractCoordinateAxis;
import org.simpleframework.xml.Element;

/**
* The ReferenceVirtualAxis is a pseudo-axis used to track a coordinate virtually i.e. without
Expand Down

0 comments on commit 1f52b1c

Please sign in to comment.