summaryrefslogtreecommitdiff
path: root/trunk/software/host/src/org/reprap/Extruder.java
blob: 56de8ee822f4377e8accea1840a3c5b389fe99fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
package org.reprap;

import java.io.IOException;
import org.reprap.devices.ExtruderState;
import javax.media.j3d.Appearance;

public interface Extruder
{
	
	/**
	 * Dispose of the extruder object 
	 */
	public void dispose(); 
	
	/**
	 * Reload the preferences from the preferences file
	 *
	 */
	public int refreshPreferences();

	/**
	 * Start the extruder motor at a given speed.  For old extruders this ranges from 0
	 * to 255 but is scaled by maxSpeed and t0, so that 255 corresponds to the
	 * highest permitted speed.  It is also scaled so that 0 would correspond
	 * with the lowest extrusion speed.
	 * For new extruders this is in mm/minute
	 * @param speed The speed to drive the motor at (0-255)
	 * @throws IOException
	 */
	//public void setExtrusion(double speed) throws IOException;
	
	/**
	 * For stepper extruders, return the PWM to use to drive them in [0, 1]
	 * Negative values returned mean this feature is disabled.
	 */
	public double getPWM();
	
	/**
	 * Start the extruder motor at a given speed.  For old extruders this ranges from 0
	 * to 255 but is scaled by maxSpeed and t0, so that 255 corresponds to the
	 * highest permitted speed.  It is also scaled so that 0 would correspond
	 * with the lowest extrusion speed.
	 * For new extruders this is in mm/minute
	 * @param speed The speed to drive the motor at (0-255)
	 * @param reverse If set, run extruder in reverse
	 * @throws IOException
	 * @throws Exception 
	 */
	public void setExtrusion(double speed, boolean reverse) throws IOException, Exception;
	
	/**
	* start extruding at the normal rate.
	*/
	public void startExtruding() throws Exception;
	
	/**
	* stop extruding
	*/
	public void stopExtruding() throws Exception;
	
	/**
	* Start/stop the extruder motor
	 * @throws Exception 
	*/
	public void setMotor(boolean motorOn) throws IOException, Exception;
		
	/**
	 * Open and close the valve (if any).
	 * @param pulseTime
	 * @param valveOpen
	 * @throws IOException
	 * @throws Exception 
	 */
	public void setValve(boolean valveOpen) throws IOException, Exception;
	
	/**
	 * Turn the heater of the extruder on. Inital temperatur is defined by ???
	 * @throws Exception
	 */
	public void heatOn(boolean wait) throws Exception; 

	/**
	* Turns the heater for the extruder off.
	*/
	public void heatOff() throws Exception; 

	/**
	 * Set the temperature of the extruder at a given height. This height is given
	 * in centigrades, i.e. 100 equals 100 centigrades. 
	 * @param temperature The temperature of the extruder in centigrade
	 * @param wait - wait till it gets there (or not).
	 * @throws Exception
	 */
	public void setTemperature(double temperature, boolean wait) throws Exception; 
	
	/**
	 * Set a heat output power.  For normal production use you would
	 * normally call setTemperature, however this method may be useful
	 * for lower temperature profiling, etc.
	 * @param heat Heater power (0-255)
	 * @param maxTemp Cutoff temperature in celcius
	 * @throws IOException
	 */
	public void setHeater(int heat, double maxTemp) throws IOException; 
	
	/**
	 * Check if the extruder is out of feedstock
	 * @return true if there is no material remaining
	 */
	public boolean isEmpty(); 
	
	/**
	 * @return the target temperature of the extruder
	 */
	public double getTemperatureTarget(); 

	/**
	 * @return the default temperature of the extruder
	 */
	public double getDefaultTemperature();

	/**
	 * @return the current temperature of the extruder 
	 */
	public double getTemperature() throws Exception; 

	/**
	 * @return the infill speed as a value between [0,1]
	 */
	public double getInfillSpeedFactor();
	
	/**
	* @return the infill feedrate as a value in mm/minute
	*/
	public double getInfillFeedrate();

	/**
	 * @return the outline speed as a avlue between [0,1]
	 */
	public double getOutlineSpeedFactor();

	/**
	* @return the infill feedrate as a value in mm/minute
	*/
	public double getOutlineFeedrate();
	
	/**
	 * @return The length in mm to speed up when going round corners
	 */
	public double getAngleSpeedUpLength();

	/**
	 * The factor by which to speed up when going round a corner.
	 * The formula is speed = baseSpeed*[1 - 0.5*(1 + ca)*getAngleSpeedFactor()]
	 * where ca is the cos of the angle between the lines.  So it goes fastest when
	 * the line doubles back on itself (returning 1), and slowest when it 
	 * continues straight (returning 1 - getAngleSpeedFactor()).
	 * @return the angle-speed factor 
	 */
	public double getAngleSpeedFactor();
	
	/**
	* @return the angle feedrate as a value in mm/minute
	*/
	public double getAngleFeedrate();
	
	/**
	 * Turn the cooler (fan?) on or off
	 * @param f true if the cooler is to be turned on, false to turn off
	 * @throws IOException
	 * @throws Exception 
	 */
	public void setCooler(boolean f) throws IOException, Exception ;
	
	/**
	 * Check if the extruder is available, which is determined by ???
	 * @return true if the extruder is available
	 */
	public boolean isAvailable(); 

    /**
     * The speed of X and Y movement
     * @return the XY feedrate in mm/minute
     */
    public double getFastXYFeedrate();
    
    /**
     * The fastest we can extrude in mm/min
     * @return
     */
    public double getFastEFeedrate();
    
	/**
	 * @return slow XY movement feedrate in mm/minute
	 */
	public double getSlowXYFeedrate();
	
	/**
	 * @return the fastest the machine can accelerate
	 */
	public double getMaxAcceleration();
 
    /**
     * @return the extruder speeds
     */
    public double getExtruderSpeed(); 
    
    /**
     * Time to purge the extruder
     * -ve values supress
     * @return
     */
    public double getPurgeTime();
    
    /**
     * Purge the extruder
     *
     */
    public void purge(boolean homeZ) throws Exception;
    
    /**
     * Set the flag to show we're creating a separation
     * @param s
     */
    public void setSeparating(boolean s);

    /**
     * @return the extrusion size in millimeters
     */
    public double getExtrusionSize();
 
    /**
     * @return the extrusion height in millimeters
     */
    public double getExtrusionHeight();

    /**
     * @return the cooling period in seconds
     */
    public double getCoolingPeriod();
    
    /**
     * Find out what our current speed is
     * @return
     */
    public double getCurrentSpeed();
    
    /**
     * Find out if we are currently in reverse
     * @return
     */
    public boolean getReversing();
    
    /**
     * Find out if we're working in 5D
     * @return
     */
    public boolean get5D();
 
    /**
     * Get how much extrudate is deposited in a given time
     * @param time
     * @return
     */
    public double getDistanceFromTime(double time);
    
    /**
     * Get how much extrudate is deposited for a given movement
     * @param distance
     * @return
     */
    public double getDistance(double distance);
    
    /**
     * Find out how far we have extruded so far
     * @return
     */
    public ExtruderState getExtruderState() throws Exception;
    
	/**
	 * Allow otthers to set our extrude length so that all logical extruders
	 * talking to one physical extruder can use the same length instance.
	 * @param e
	 */
	public void setExtrudeState(ExtruderState e);
	
	/**
	 * Zero the extruded length
	 * @throws Exception 
	 *
	 */
	public void zeroExtrudedLength() throws Exception;
    
    /**
     * @return the X offset in millimeters
     */
    public double getOffsetX();
 
    /**
     * @return the Y offset in millimeters
     */
    public double getOffsetY();
 
    /**
     * @return the Z offset in millimeters
     */
    public double getOffsetZ();
    
    /**
     * @return the appearance (colour) to use in the simulation window for this material
     */
    public Appearance getAppearance();  

    /**
     * Each logical extruder has a unique ID
     * @return
     */
    public int getID();
    
    /**
     * Several logical extruders can share one physical extruder
     * This number is unique to each physical extruder
     * @return
     */
    public int getPhysicalExtruderNumber();
    
    /**
     * @return whether nozzle wipe method is enabled or not 
     */
    public boolean getNozzleWipeEnabled();
    
    /**
     * @return the X-cord for the nozzle wiper
     */
    public double getNozzleWipeDatumX();

    /**
     * @return the Y-cord for the nozzle wiper
     */
    public double getNozzleWipeDatumY();
    
    /**
     * @return the X length of the nozzle movement over the wiper
     */
    public double getNozzleWipeStrokeX();
    
    /**
     * @return the Y length of the nozzle movement over the wiper
     */
    public double getNozzleWipeStrokeY();
    
    /**
     * @return the number of times the nozzle moves over the wiper
     */
    public int getNozzleWipeFreq();
    
    /**
     * @return the time to extrude before wiping the nozzle
     */
    public double getNozzleClearTime();
    
    /**
     * @return the time to wait after wiping the nozzle
     */
    public double getNozzleWaitTime();
    
    /**
     * Start polygons at a random location round their perimiter
     * @return
     */
    public boolean randomStart();

    /**
     * Start polygons at an incremented location round their perimiter
     * @return
     */
    public boolean incrementedStart();
    
    /**
     * If this is true, plot outlines from the middle of their infilling hatch to reduce dribble at
     * their starts and ends.  If false, plot the outline as the outline.
     * @return
     */
    public boolean getMiddleStart();
    
    /**
     * get short lengths which need to be plotted faster
     * set -ve to turn this off.
     * @return
     */
    public double getShortLength();
    
    /**
     * Factor (between 0 and 1) to use to set the speed for
     * short lines.
     * @return
     */
    public double getShortLineSpeedFactor();

	/**
	* Feedrate for short lines in mm/minute
	* @return
	*/
	public double getShortLineFeedrate();
    
    /**
     * Number of mm to overlap the hatching infill with the outline.  0 gives none; -ve will 
     * leave a gap between the two
     * @return
     */
    public double getInfillOverlap();
    
    /**
	 * Gets the number of milliseconds to wait before starting the extrude motor
	 * for the first track of a layer
	 * @return
     */
    public double getExtrusionDelayForLayer();
    
    /**
	 * Gets the number of milliseconds to wait before starting the extrude motor
	 * for any other track
	 * @return
     */
    public double getExtrusionDelayForPolygon();
    
    /**
	 * Gets the number of milliseconds to reverse the extrude motor
	 * at the end of a track
	 * @return
     */
    public double getExtrusionReverseDelay();
    
    /**
	 * Gets the number of milliseconds to wait before opening the valve
	 * for the first track of a layer
	 * @return
     */
    public double getValveDelayForLayer();
    
    /**
	 * Gets the number of milliseconds to wait before opening the valve
	 * for any other track
	 * @return
     */
    public double getValveDelayForPolygon();
    
    /**
     * @return the extrusion overrun in millimeters (i.e. how many mm
     * before the end of a track to turn off the extrude motor)
     */
    public double getExtrusionOverRun();
    
    /**
     * @return the valve overrun in millimeters (i.e. how many mm
     * before the end of a track to turn off the extrude motor)
     */
    public double getValveOverRun();
    
    /**
     * The number of times to go round the outline (0 to supress)
     * @return
     */
    public int getShells();
    
    /**
     * The smallest allowable free-movement height above the base
     * @return
     */
    public double getMinLiftedZ();
    
    /**
     * Stop the extrude motor between segments?
     * @return
     */
    public boolean getPauseBetweenSegments();
    
    /**
     * 
     * @param p
     */
	public void setPrinter(Printer p);

	/**
	 * 
	 * @return
	 */
	public Printer getPrinter();
	
	/**
	 * 
	 * @return
	 */
	public double getExtrusionFoundationWidth();
	
	/**
	 * 
	 * @return
	 */
	public double getExtrusionInfillWidth();
	
	/**
	 * How high to lift above the surface for in-air movements
	 * @return
	 */
	public double getLift();
	
	/**
	 * 
	 * @return
	 */
	public double getExtrusionBroadWidth();
	
	
	public int getLowerFineLayers();
	public int getUpperFineLayers();
	
	/**
	 * At the support layer before a layer is to be separated, how far up
	 * the normal Z movement do we go to make a bigger gap to form a weak join?
	 * @return
	 */
	public double getSeparationFraction();
	
	/**
	 * Wait if the XY movement buffer is active in the mictrocontroller
	 * @throws IOException
	 */
	public void waitTillNotBusy() throws IOException;
    
	/**
	 * The arc compensation factor.  
	 * See org.reprap.geometry.polygons.RrPolygon.arcCompensate(...)
	 * @return
	 */
	public double getArcCompensationFactor();
	
	/**
	 * The arc short sides.  
	 * See org.reprap.geometry.polygons.RrPolygon.arcCompensate(...)
	 * @return
	 */
	public double getArcShortSides();
	
	/**
	 * What stuff are we working with?
	 * @return
	 */
	public String getMaterial();
	
	/**
	 * What stuff are we supporting with?
	 * @return
	 */
	public String getSupportMaterial();
	
	public int getSupportExtruderNumber();
	
	public Extruder getSupportExtruder();
	
	/**
	 * What stuff are we infilling with?
	 * @return
	 */
	public String getInfillMaterial();
	
	public int getInfillExtruderNumber();
	
	public Extruder getInfillExtruder();
	
	/**
	 * What are the dimensions for infill?
	 * @return
	 */
	//public String getBroadInfillMaterial();
	
	/**
	 * The direction to hatch even-numbered layers in degrees anticlockwise
	 * from the X axis
	 * @return
	 */
	public double getEvenHatchDirection();

	/**
	 * The direction to hatch odd-numbered layers in degrees anticlockwise
	 * from the X axis
	 * @return
	 */
	public double getOddHatchDirection();
	
}