~jil26/fabinterpreter/Qt_version

« back to all changes in this revision

Viewing changes to software/FabInterpreter/FabAtHomePrinter.h

  • Committer: Jeffrey Lipton
  • Date: 2010-07-10 00:48:14 UTC
  • Revision ID: jil26@cornell.edu-20100710004814-x6y9jkv81x9p8vzy
Set up a Qt version of the FabInterpeter as a seperate branch. this is non functional. PRO file needs to be updated. DLL imports fail

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef FABATHOMEPRINTER_H
 
2
#define FABATHOMEPRINTER_H
 
3
 
 
4
#include "Axis.h"
 
5
#include "Model.h"
 
6
#include "Motor.h"
 
7
#include "Path.h"
 
8
#include "Tool.h"
 
9
 
 
10
class FabAtHomePrinter
 
11
{
 
12
     //CONSTANTS/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
13
     private:
 
14
          byte X_Y_Z_GROUP_ADDRESS;
 
15
          unsigned int NUM_MODULES, BAUD_RATE;
 
16
          unsigned int COM_PORT;
 
17
          double PLATFORM_DELTA;
 
18
          double PRINT_ACCELERATION; //The acceleration that is used while printing.  The unit of PRINT_ACCELERATION is U/(second^2).
 
19
          double OLD_MSPS; //Magic constant from line 58 of FabAtHomeParameters.h in model 1 code.  Used to calculate values for pushout and suckback.
 
20
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
21
     private:
 
22
          Model model;
 
23
          map<string, Motor, LessThanString> motors; //A map from motor names to motors.
 
24
          map<string, MaterialCalibration, LessThanString> materialCalibrations; //A map from material calibration names to material calibrations.
 
25
          bool pausePrintFlag, cancelPrintFlag, redoPathFlag, printing, initialized, paused;
 
26
 
 
27
          //Any \ in filePath must be escaped with \
 
28
          //Returns: "" iff successful or an error message.
 
29
          string loadConfigFile(string filePath);
 
30
 
 
31
          //Switch printer to path mode.
 
32
          //Returns: True iff successful.
 
33
          bool initializePathMode(void);         
 
34
 
 
35
          //Execute the path.
 
36
          //The bay will execute pushout, standard flow, and suckback iff flowDuringPath is true.
 
37
          //A call to this function returns when movement has finished.
 
38
          void executePath(const Path& path, Bay* bay, const bool flowDuringPath);
 
39
 
 
40
          //Execute the points.
 
41
          //The bay will execute pushout, standard flow, and suckback iff flowDuringPath is true.
 
42
          //A call to this function returns when all points are in the path point buffer.
 
43
          void executePoints(const vector<Point>& points, Bay* bay, const bool flowDuringPath, double pushoutDistance, double pushoutVelocity, double standardDistance, double standardVelocity, double suckbackDistance, double suckbackVelocity, const Point& suckbackPoint);
 
44
 
 
45
          //Move all points from segment list to path point buffer.  Physical movement begins as soon as a point is in the path point buffer.
 
46
          //The bay will execute pushout, standard flow, and suckback iff flowDuringPath is true.
 
47
          void downloadSegmentList(Bay* bay, bool startFlow, bool startSuckback, double pushoutDistance, double pushoutVelocity, double standardDistance, double standardVelocity, double suckbackDistance, double suckbackVelocity, const Point& suckbackPoint);
 
48
 
 
49
          //Clears the segment list and then tries to add points into the segment list starting from startIndex.
 
50
          //Segment list has size 1000 but this function does not necessarily fill it completely.
 
51
          //Returns: The last index of points that was added to the segment list or -1 if points is empty.      
 
52
          int fillSegmentList(const vector<Point>& points, const int startIndex);
 
53
 
 
54
          //Returns: A bay that has the material calibration loaded or NULL if no such bay exists.
 
55
          Bay* findBay(MaterialCalibration*);
 
56
 
 
57
          void executePausePath(const Point&);
 
58
          void executeSetupPath(const Point&, const Point&, const double&);
 
59
                    
 
60
          string loadMaterialCalibration(TiXmlNode*);
 
61
          string loadPath(TiXmlNode*);
 
62
 
 
63
          //The copy constructor.  Private to prevent printer from being copied.
 
64
          FabAtHomePrinter(const FabAtHomePrinter&);
 
65
 
 
66
          //The copy assignment operator.  Private to prevent printer from being copied.
 
67
          FabAtHomePrinter& operator=(const FabAtHomePrinter&);
 
68
          
 
69
     public:
 
70
          map<string, Axis, LessThanString> axes; //A map from axis names to axes.
 
71
          Tool tool;
 
72
 
 
73
          FabAtHomePrinter(void);
 
74
 
 
75
          //Inserts into result the names of all material calibrations that are currently loaded.
 
76
          void loadedMaterialCalibrations(vector<string>& result);
 
77
 
 
78
          //Returns: The number of paths currently loaded.
 
79
          int numLoadedPaths(void);
 
80
 
 
81
          //Returns: The number of bays currently loaded.
 
82
          int numLoadedBays(void);
 
83
 
 
84
          //Returns: True iff printer is printing.
 
85
          bool isPrinting(void);
 
86
 
 
87
          //Returns: True iff printer is paused.
 
88
          bool isPaused(void);
 
89
 
 
90
          //Pause print after the current path finishes.
 
91
          //Requires: isPrinting()
 
92
          void pausePrint(void);
 
93
 
 
94
          //Cancel print after the current path finishes.
 
95
          //Requires: isPrinting()
 
96
          void cancelPrint(void);
 
97
 
 
98
          //Redo the current path after the current path finishes.
 
99
          //Requires: isPrinting()
 
100
          void redoPath(void);
 
101
 
 
102
          //Any \ in filePath must be escaped with \
 
103
          //Load a file specifying material configurations and paths.
 
104
          //Returns: "" iff successful or an error message.
 
105
          string loadFabFile(string filePath);
 
106
 
 
107
          //Initialize the printer.
 
108
          //Returns: "" if successful or an error message if failed.
 
109
          string initialize(const string& configFilePath);
 
110
 
 
111
          //Equip a bay with a material calibration or unequip the bay if the material calibration is "".
 
112
          //Requires: !isPrinting() || isPaused() and the bay and material calibration have been loaded.
 
113
          void equipBay(const string& bayName, const string& materialCalibrationName);
 
114
 
 
115
          //Execute all paths which are currently loaded.
 
116
          //A call to this function returns when the print has finished.
 
117
          //If fabricationThread != NULL, messages will periodically be stored in displayText
 
118
          //describing what the printer is currently doing and progress will be reported to fabricationThread when the message changes.
 
119
          //void print(System::ComponentModel::BackgroundWorker* fabricationThread, string& displayText);
 
120
 
 
121
          //Perform clean up when done using printer.
 
122
          //Returns: True iff successful.
 
123
          bool cleanUp(void);
 
124
 
 
125
          //The destructor.
 
126
          ~FabAtHomePrinter(void);
 
127
};
 
128
 
 
129
#endif //ndef FABATHOMEPRINTER_H