286 lines
20 KiB
HTML
286 lines
20 KiB
HTML
|
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: package reprap</title>
|
|
</head><body bgcolor="#f0f0f8">
|
|
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
<tr bgcolor="#7799ee">
|
|
<td valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>reprap</strong></big></big> (version 2.0)</font></td
|
|
><td align=right valign=bottom
|
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/lib/python2.5/site-packages/reprap/__init__.py">/usr/lib/python2.5/site-packages/reprap/__init__.py</a></font></td></tr></table>
|
|
<p><tt>This is the main pyRepRap module for controlling a serial<br>
|
|
SNAP RepRap machine.<br>
|
|
<br>
|
|
Import this module and use the internally created objects<br>
|
|
reprap.cartesian and reprap.extruder to control the machine.<br>
|
|
<br>
|
|
<br>
|
|
<br>
|
|
Example:<br>
|
|
<br>
|
|
# Import the reprap modules<br>
|
|
import reprap, time<br>
|
|
<br>
|
|
# Initialise serial port, here the first port (0) is used.<br>
|
|
reprap.<a href="#-openSerial">openSerial</a>( 0, 19200, 60 )<br>
|
|
<br>
|
|
# These devices are present in network, will automatically scan in the future.<br>
|
|
reprap.cartesian.x.active = True<br>
|
|
reprap.cartesian.y.active = True<br>
|
|
reprap.cartesian.z.active = True<br>
|
|
reprap.extruder.active = True<br>
|
|
<br>
|
|
# Set axies to notify arrivals<br>
|
|
reprap.cartesian.x.setNotify()<br>
|
|
reprap.cartesian.y.setNotify()<br>
|
|
reprap.cartesian.z.setNotify()<br>
|
|
<br>
|
|
# Set stepper speed to 220 (out of 255)<br>
|
|
reprap.cartesian.setSpeed(220)<br>
|
|
# Set power to 83%<br>
|
|
reprap.cartesian.setPower(83)<br>
|
|
<br>
|
|
# The module is now ready to recieve commands #<br>
|
|
<br>
|
|
# Send all axies to home position. Wait until arrival.<br>
|
|
reprap.cartesian.homeReset()<br>
|
|
<br>
|
|
# When using seek with no waitArrival = True/False argument, it defaults to true<br>
|
|
# Seek to X1000, Y1000<br>
|
|
reprap.cartesian.seek( (1000, 1000, None) )<br>
|
|
<br>
|
|
# Pause<br>
|
|
time.sleep(2)<br>
|
|
<br>
|
|
# Seek to X500, Y1000<br>
|
|
reprap.cartesian.seek( (500, 1000, None) )<br>
|
|
<br>
|
|
time.sleep(2)<br>
|
|
<br>
|
|
# Seek to X1000, Y500<br>
|
|
reprap.cartesian.seek( (1000, 500, None) )<br>
|
|
<br>
|
|
time.sleep(2)<br>
|
|
<br>
|
|
# Seek to X100, Y100<br>
|
|
reprap.cartesian.seek( (100, 100, None) )<br>
|
|
<br>
|
|
# Send all axies to home position. Wait until arrival.<br>
|
|
reprap.cartesian.homeReset()<br>
|
|
<br>
|
|
# Shut off power to all motors.<br>
|
|
reprap.cartesian.free()</tt></p>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#aa55cc">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
|
|
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="reprap.baseplotters.html">baseplotters</a><br>
|
|
<a href="reprap.ffm.html">ffm</a><br>
|
|
<a href="reprap.gopython.html">gopython</a><br>
|
|
</td><td width="25%" valign=top><a href="reprap.hershey.html">hershey</a><br>
|
|
<a href="reprap.plugins.html">plugins</a><br>
|
|
<a href="reprap.preferences.html">preferences</a><br>
|
|
</td><td width="25%" valign=top><a href="reprap.reprap.html">reprap</a><br>
|
|
<a href="reprap.shapeplotter.html">shapeplotter</a><br>
|
|
<a href="reprap.snap.html">snap</a><br>
|
|
</td><td width="25%" valign=top><a href="reprap.toolpath.html">toolpath</a><br>
|
|
<a href="reprap.wxpygame.html">wxpygame</a><br>
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ee77aa">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl>
|
|
<dt><font face="helvetica, arial"><a href="reprap.html#axisClass">axisClass</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="reprap.html#cartesianClass">cartesianClass</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="reprap.html#extruderClass">extruderClass</a>
|
|
</font></dt></dl>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="axisClass">class <strong>axisClass</strong></a></font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Used to control a RepRap axis.<br>
|
|
X, Y & Z instances are automatically created in the reprap module,<br>
|
|
so for basic use just use reprap.cartesian.x, reprap.cartesian.y<br>
|
|
& reprap.cartesian.z rather than defining new ones.<br>
|
|
<br>
|
|
Most of the time the functions in reprap.cartesian will be <br>
|
|
sufficient. E.g. to move just one axis you can use:<br>
|
|
reprap.cartesian.<a href="#axisClass-seek">seek</a>((200, None, None))<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="axisClass-__init__"><strong>__init__</strong></a>(self, address)</dt><dd><tt>Create an axis instance with address (1-255). Instances for the three axies are automatically created and can be accessed via reprap.cartesian.x, reprap.cartesian.y & reprap.cartesian.z<br>
|
|
These instances are pre-configured with the correct addresses and alow the use of whole machine reprap.cartesian commands.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-backward"><strong>backward</strong></a>(self, speed<font color="#909090">=None</font>)</dt><dd><tt>Spin axis backward at given speed (0-255)<br>
|
|
If no speed is specified then a value must have been previously set with <a href="#axisClass">axisClass</a>.<a href="#axisClass-setSpeed">setSpeed</a>()</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-backward1"><strong>backward1</strong></a>(self)</dt><dd><tt>Move axis one step backward</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-forward"><strong>forward</strong></a>(self, speed<font color="#909090">=None</font>)</dt><dd><tt>Spin axis forward at given speed (0-255)<br>
|
|
If no speed is specified then a value must have been previously set with <a href="#axisClass">axisClass</a>.<a href="#axisClass-setSpeed">setSpeed</a>()</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-forward1"><strong>forward1</strong></a>(self)</dt><dd><tt>Move axis one step forward<br>
|
|
Return the completed state as a bool.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-free"><strong>free</strong></a>(self)</dt><dd><tt>Power off coils on stepper</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-getPos"><strong>getPos</strong></a>(self)</dt><dd><tt>Return the axis postition as an integer.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-getSensors"><strong>getSensors</strong></a>(self)</dt><dd><tt>Debug only. Returns raw PIC port bytes)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-homeReset"><strong>homeReset</strong></a>(self, speed<font color="#909090">=None</font>, waitArrival<font color="#909090">=True</font>)</dt><dd><tt>Go to 0 position. If waitArrival is True, funtion waits until reset is compete to return</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-seek"><strong>seek</strong></a>(self, pos, speed<font color="#909090">=None</font>, waitArrival<font color="#909090">=True</font>)</dt><dd><tt>Seek to axis location pos. If waitArrival is True, funtion waits until seek is compete to return</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-setNotify"><strong>setNotify</strong></a>(self)</dt><dd><tt>Set axis to notify on arrivals</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-setPos"><strong>setPos</strong></a>(self, pos)</dt><dd><tt>set current position (integer) (set variable, not physical position)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-setPower"><strong>setPower</strong></a>(self, power)</dt><dd><tt>Set stepper motor power (0-100%)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="axisClass-setSpeed"><strong>setSpeed</strong></a>(self, speed)</dt><dd><tt>Set axis move speed (0-255)</tt></dd></dl>
|
|
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="cartesianClass">class <strong>cartesianClass</strong></a></font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Main cartesian robot class<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="cartesianClass-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Create a cartesian instance. An instances is automatically created and can be accessed via reprap.cartesian<br>
|
|
You will only need to create another one in you want to control more than one machine at the same time.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="cartesianClass-free"><strong>free</strong></a>(self)</dt><dd><tt>Free all motors (no current on coils)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="cartesianClass-getPos"><strong>getPos</strong></a>(self)</dt><dd><tt>Return the current positions of all three axies as a tuple (x, y, z)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="cartesianClass-homeReset"><strong>homeReset</strong></a>(self, speed<font color="#909090">=None</font>, waitArrival<font color="#909090">=True</font>)</dt><dd><tt>Reset all axies to the home position with speed (0-255) and wait until arrival (boolean)<br>
|
|
WARNING : Reseting all axies at the same time is unstable. suggest using waitArrival = True option.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="cartesianClass-seek"><strong>seek</strong></a>(self, pos, speed<font color="#909090">=False</font>, waitArrival<font color="#909090">=True</font>)</dt><dd><tt>Seek to a position ( tuple (x, y, z) ) with speed (0-255) and and wait until arrival (boolean)<br>
|
|
Seek will automatically select between a standard seek and a syncronised seek when it is required<br>
|
|
When waitArrival is True, funtion does not return until all seeks are compete</tt></dd></dl>
|
|
|
|
<dl><dt><a name="cartesianClass-setPower"><strong>setPower</strong></a>(self, power)</dt><dd><tt>Set stepper power (0-100)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="cartesianClass-setSpeed"><strong>setSpeed</strong></a>(self, speed)</dt><dd><tt>Set axies move speed (0-255)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="cartesianClass-stop"><strong>stop</strong></a>(self)</dt><dd><tt>Stop all motors (but retain current)</tt></dd></dl>
|
|
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="extruderClass">class <strong>extruderClass</strong></a></font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Used to control a RepRap thermoplast extruder.<br>
|
|
An instance is automatically created in the reprap module, so for<br>
|
|
basic use just use reprap.extruder rather than defining a new one<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="extruderClass-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Create an extruder instance. An instance is automatically create at reprap.extruder.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="extruderClass-freeMotor"><strong>freeMotor</strong></a>(self)</dt><dd><tt>Power off the extruder motor</tt></dd></dl>
|
|
|
|
<dl><dt><a name="extruderClass-getTemp"><strong>getTemp</strong></a>(self)</dt><dd><tt>Returns current extruder temperature in degrees Celsius as an integer</tt></dd></dl>
|
|
|
|
<dl><dt><a name="extruderClass-getVersion"><strong>getVersion</strong></a>(self)</dt><dd><tt>Returns (major, minor) firmware version as a two integer tuple.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="extruderClass-setCooler"><strong>setCooler</strong></a>(self, speed)</dt><dd><tt>Set the speed (0-255) of the cooling fan</tt></dd></dl>
|
|
|
|
<dl><dt><a name="extruderClass-setMotor"><strong>setMotor</strong></a>(self, direction, speed)</dt><dd><tt>Set motor direction (reprap.MOTOR_BACKWARD or reprap.MOTOR_FORWARD) and speed (0-255)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="extruderClass-setTemp"><strong>setTemp</strong></a>(self, temperature, lock<font color="#909090">=False</font>)</dt><dd><tt>Set the extruder target temperature (degrees Celsius). Lock is unused</tt></dd></dl>
|
|
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#eeaa77">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl><dt><a name="-closeSerial"><strong>closeSerial</strong></a>()</dt><dd><tt>Close serial port for SNAP RepRap communications</tt></dd></dl>
|
|
<dl><dt><a name="-openSerial"><strong>openSerial</strong></a>(port<font color="#909090">=0</font>, rate<font color="#909090">=19200</font>, timeout<font color="#909090">=60</font>)</dt><dd><tt>Open serial port for SNAP RepRap communications</tt></dd></dl>
|
|
<dl><dt><a name="-scanNetwork"><strong>scanNetwork</strong></a>()</dt><dd><tt>Scan reprap network for devices (incomplete) - this will be used by autoconfig functions when complete</tt></dd></dl>
|
|
<dl><dt><a name="-testComms"><strong>testComms</strong></a>()</dt><dd><tt>Test that serial communications are working properly with simple loopback (incomplete)</tt></dd></dl>
|
|
</td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#55aa55">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
|
<td width="100%"><strong>CMD_BACKWARD1</strong> = 13<br>
|
|
<strong>CMD_CALIBRATE</strong> = 9<br>
|
|
<strong>CMD_DDA</strong> = 11<br>
|
|
<strong>CMD_FORWARD</strong> = 1<br>
|
|
<strong>CMD_FORWARD1</strong> = 12<br>
|
|
<strong>CMD_FREE</strong> = 6<br>
|
|
<strong>CMD_GETDEBUGINFO</strong> = 54<br>
|
|
<strong>CMD_GETMODULETYPE</strong> = 255<br>
|
|
<strong>CMD_GETPOS</strong> = 4<br>
|
|
<strong>CMD_GETRANGE</strong> = 10<br>
|
|
<strong>CMD_GETSENSOR</strong> = 15<br>
|
|
<strong>CMD_GETTEMP</strong> = 10<br>
|
|
<strong>CMD_GETTEMPINFO</strong> = 55<br>
|
|
<strong>CMD_HOMERESET</strong> = 16<br>
|
|
<strong>CMD_ISEMPTY</strong> = 8<br>
|
|
<strong>CMD_NOTIFY</strong> = 7<br>
|
|
<strong>CMD_PRESCALER</strong> = 51<br>
|
|
<strong>CMD_PWMPERIOD</strong> = 50<br>
|
|
<strong>CMD_REVERSE</strong> = 2<br>
|
|
<strong>CMD_SEEK</strong> = 5<br>
|
|
<strong>CMD_SETCOOLER</strong> = 11<br>
|
|
<strong>CMD_SETHEAT</strong> = 9<br>
|
|
<strong>CMD_SETPOS</strong> = 3<br>
|
|
<strong>CMD_SETPOWER</strong> = 14<br>
|
|
<strong>CMD_SETVREF</strong> = 52<br>
|
|
<strong>CMD_SYNC</strong> = 8<br>
|
|
<strong>CMD_VERSION</strong> = 0<br>
|
|
<strong>CMD__setTempScaler</strong> = 53<br>
|
|
<strong>MOTOR_BACKWARD</strong> = 2<br>
|
|
<strong>MOTOR_FORWARD</strong> = 1<br>
|
|
<strong>SYNC_DEC</strong> = 3<br>
|
|
<strong>SYNC_INC</strong> = 2<br>
|
|
<strong>SYNC_NONE</strong> = 0<br>
|
|
<strong>SYNC_SEEK</strong> = 1<br>
|
|
<strong>UNITS_INCHES</strong> = 3<br>
|
|
<strong>UNITS_MM</strong> = 1<br>
|
|
<strong>UNITS_STEPS</strong> = 2<br>
|
|
<strong>__author__</strong> = 'Stefan Blanke (greenarrow) (greenarrow@users.sourceforge.net)'<br>
|
|
<strong>__credits__</strong> = ''<br>
|
|
<strong>__licence__</strong> = '<font color="#c040c0">\n</font>pyRepRap is free software: you can redistribute...ap. If not, see <http://www.gnu.org/licenses/>.<font color="#c040c0">\n</font>'<br>
|
|
<strong>__license__</strong> = 'GPL 3.0'<br>
|
|
<strong>__version__</strong> = '2.0'<br>
|
|
<strong>cartesian</strong> = <reprap.cartesianClass instance at 0x7f61b5917cb0><br>
|
|
<strong>extruder</strong> = <reprap.extruderClass instance at 0x7f61b5917c68><br>
|
|
<strong>printDebug</strong> = False</td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#7799ee">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
|
|
<td width="100%">Stefan Blanke (greenarrow) (greenarrow@users.sourceforge.net)</td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#7799ee">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Credits</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
|
|
<td width="100%"></td></tr></table>
|
|
</body></html> |