forked from openpnp/openpnp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adds Actuator.actuate(String) which gives the ability to easily sen…
…d custom commands from machine object implementations. - Adds initial stab at a feeder for the RapidFeeder system as a guide.
- Loading branch information
Showing
9 changed files
with
588 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# RapidFeeder | ||
|
||
This is an experimental implementation RapidFeeder meant to provide a skeleton for full | ||
implementation of the feeder class. | ||
|
||
# Description | ||
|
||
The feeder is a simple auto feeder with two configurable values: address and pitch. Address | ||
sets the bus address of the feeder, and pitch is an arbitrary number that will be passed | ||
to feed operations to tell the feeder how far to advance. | ||
|
||
The feeder implementation also includes QR code scanning for finding feeders on the system, | ||
along with automatic registration of located feeders. | ||
|
||
# Requirements | ||
|
||
The RapidFeeder class requires an actuator with the name "RAPIDFEEDER" to be created on | ||
the machine. The feeder will send actuate(String) commands to this actuator to perform | ||
bus actions. | ||
|
||
# Setup and Scanning | ||
|
||
To perform an initial scan for feeders, go to the Feeders tab and create a new RapidFeeder. You | ||
should name it something that describes the bank of feeders that it will scan for, such as | ||
RapidFeeder-West. | ||
|
||
In the settings for the feeder, locate the Scanning section and define the Scan Start, Scan End and | ||
Scan Increment values: | ||
|
||
- Scan Start: When scanning for QR codes, the camera will be moved to this position to start | ||
scanning. Move the camera to the location of the first possible QR code and save the location. | ||
- Scan End: When scanning for QR codes, the camera will finish the scan at this location. Move | ||
the camera to the location of the last possible QR code and save the location. | ||
- Scan Increment: When scanning for QR codes, the camera will move by this distance between | ||
each image capture. This value should be approximately half the size of the camera image | ||
frame. This ensures that the scan will never advance past a QR code and miss it. | ||
|
||
When the above values are set, press the Scan button. The machine will move the camera along the | ||
line formed by the start and end points and capture QR codes. When it finishes it will create | ||
or update feeders in the feeder tab for each QR code it finds. | ||
|
||
# Usage | ||
|
||
Once scanning is complete, pressing the feed button for any of the new feeders will send | ||
the FEED command to the RAPIDFEEDER actuator in the form of `{{ADDRESS}} FEED {{PITCH}}`. | ||
|
135 changes: 135 additions & 0 deletions
135
src/main/java/org/openpnp/machine/rapidplacer/RapidFeeder.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,135 @@ | ||
/* | ||
* 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.machine.rapidplacer; | ||
|
||
import javax.swing.Action; | ||
|
||
import org.openpnp.gui.support.Wizard; | ||
import org.openpnp.machine.reference.ReferenceFeeder; | ||
import org.openpnp.model.Configuration; | ||
import org.openpnp.model.Length; | ||
import org.openpnp.model.LengthUnit; | ||
import org.openpnp.model.Location; | ||
import org.openpnp.spi.Actuator; | ||
import org.openpnp.spi.Nozzle; | ||
import org.openpnp.spi.PropertySheetHolder; | ||
import org.simpleframework.xml.Attribute; | ||
import org.simpleframework.xml.Element; | ||
|
||
public class RapidFeeder extends ReferenceFeeder { | ||
static String actuatorName = "RAPIDFEEDER"; | ||
|
||
@Element(required = false) | ||
protected Location scanStartLocation = new Location(LengthUnit.Millimeters); | ||
|
||
@Element(required = false) | ||
protected Location scanEndLocation = new Location(LengthUnit.Millimeters); | ||
|
||
@Element(required = false) | ||
protected Length scanIncrement = new Length(4, LengthUnit.Millimeters); | ||
|
||
@Attribute(required = false) | ||
protected String address; | ||
|
||
@Attribute(required = false) | ||
protected int pitch = 4; | ||
|
||
@Override | ||
public Location getPickLocation() throws Exception { | ||
return location; | ||
} | ||
|
||
@Override | ||
public void feed(Nozzle nozzle) throws Exception { | ||
Actuator actuator = nozzle.getHead().getActuatorByName(actuatorName); | ||
if (actuator == null) { | ||
actuator = Configuration.get().getMachine().getActuatorByName(actuatorName); | ||
} | ||
if (actuator == null) { | ||
throw new Exception("Feed failed. Unable to find an actuator named " + actuatorName); | ||
} | ||
actuator.actuate(String.format("%s FEED %d", address, pitch)); | ||
} | ||
|
||
@Override | ||
public Wizard getConfigurationWizard() { | ||
return new RapidFeederConfigurationWizard(this); | ||
} | ||
|
||
@Override | ||
public String getPropertySheetHolderTitle() { | ||
return getClass().getSimpleName() + " " + getName(); | ||
} | ||
|
||
@Override | ||
public PropertySheetHolder[] getChildPropertySheetHolders() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Action[] getPropertySheetHolderActions() { | ||
return null; | ||
} | ||
|
||
public Location getScanStartLocation() { | ||
return scanStartLocation; | ||
} | ||
|
||
public void setScanStartLocation(Location scanStartLocation) { | ||
this.scanStartLocation = scanStartLocation; | ||
firePropertyChange("scanStartLocation", null, scanStartLocation); | ||
} | ||
|
||
public Location getScanEndLocation() { | ||
return scanEndLocation; | ||
} | ||
|
||
public void setScanEndLocation(Location scanEndLocation) { | ||
this.scanEndLocation = scanEndLocation; | ||
firePropertyChange("scanEndLocation", null, scanEndLocation); | ||
} | ||
|
||
public Length getScanIncrement() { | ||
return scanIncrement; | ||
} | ||
|
||
public void setScanIncrement(Length scanIncrement) { | ||
this.scanIncrement = scanIncrement; | ||
firePropertyChange("scanIncrements", null, scanIncrement); | ||
} | ||
|
||
public String getAddress() { | ||
return address; | ||
} | ||
|
||
public void setAddress(String address) { | ||
this.address = address; | ||
firePropertyChange("address", null, address); | ||
} | ||
|
||
public int getPitch() { | ||
return pitch; | ||
} | ||
|
||
public void setPitch(int pitch) { | ||
this.pitch = pitch; | ||
firePropertyChange("pitch", null, pitch); | ||
} | ||
} |
Oops, something went wrong.