00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef WORLD_HH
00021 #define WORLD_HH
00022
00023 #include "ippdme/ippToolChanger.h"
00024 #include "ippdme/Command/ippCommand.h"
00025 #include "ippdme/Command/ippOnScanReportCommand.h"
00026 #include "ippdme/Command/ippOnPtMeasReportCommand.h"
00027 #include "ippdme/ippCsyTransform.h"
00028 #include "ippdme/ippCoordSysType.h"
00029 #include "ippdme/Property/ippOnePropertyAlignment.h"
00030 #include "ippdme/ippMachineClassType.h"
00031 #include "ippdme/ippDaemon.h"
00032
00033
00034 class ippAlignToolCommand;
00035 class ippAlignToolCommand;
00036 class ippChangeToolCommand;
00037 class ippLockAxisCommand;
00038 class ippOnMoveReportECommand;
00039 class ippOnPtMeasReportCommand;
00040 class ippOnScanReportCommand;
00041 class ippPtMeasCommand;
00042 class ippScanInCylEndIsPlaneCommand;
00043 class ippScanInCylEndIsSphereCommand;
00044 class ippScanInPlaneEndIsCylCommand;
00045 class ippScanInPlaneEndIsPlaneCommand;
00046 class ippScanInPlaneEndIsSphereCommand;
00047 class ippScanOnCircleCommand;
00048 class ippScanOnLineCommand;
00049 class ippSetCoordSystemCommand;
00050 class ippSetCsyTransformationCommand;
00051 class ippSetPropCommand;
00052 class ippOnePropertyAlignment;
00053
00054
00067
00068
00069
00070
00071
00072
00073
00074
00075 typedef enum goness {ready, moving, erred, aborted};
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 class IPPDME_EXT_CLASS world
00100 {
00101 private:
00102
00103 ippCoordSysType _Csy;
00104 ippCsyTransform _csyJogDisplay;
00105 ippCsyTransform _csyJogMove;
00106 ippCsyTransform _csyMoveable;
00107 ippCsyTransform _csyMultiple;
00108 ippCsyTransform _csyPart;
00109 ippCsyTransform _csySensor;
00110
00111 double _currentR;
00112
00113 double _currentX;
00114 double _currentY;
00115 double _currentZ;
00116
00117 double _currentQ ;
00118 int _IJKAct;
00119 double _currentContactI;
00120 double _currentContactJ;
00121 double _currentContactK;
00122
00123 double _homeX;
00124 double _homeY;
00125 double _homeZ;
00126 bool _isHomed;
00127 double _limitLowerX;
00128 double _limitLowerY;
00129 double _limitLowerZ;
00130 double _limitUpperX;
00131 double _limitUpperY;
00132 double _limitUpperZ;
00133 bool _lockedC;
00134 bool _lockedPhi;
00135 bool _lockedR;
00136 bool _lockedX;
00137 bool _lockedY;
00138 bool _lockedZ;
00139 ippMachineClassType _machineClass;
00140 double _measuredX1;
00141 double _measuredY1;
00142 double _measuredZ1;
00143 double _measuredX2;
00144 double _measuredY2;
00145 double _measuredZ2;
00146 double _measuredX3;
00147 double _measuredY3;
00148 double _measuredZ3;
00149
00150 std::map<int,ippDaemonConstPtr> _daemons;
00151 ippOnScanReportCommandPtr _OnScanReportCmd;
00152 ippOnPtMeasReportCommandPtr _OnPtMeasReportCmd;
00153
00154
00155 bool _outOfRangeFlag;
00156 unsigned int _pointTag;
00157 goness _readiness;
00158 ippToolChangerPtr _toolCollection;
00159 bool _userEnabled;
00160
00161 void updateAlignTool(const ippAlignToolCommand * theAlignTool);
00162 void updateChangeTool(const ippChangeToolCommand * theChangeTool);
00163 void updateEndSession();
00164 void updateHome();
00165 void updateLockAxis(const ippLockAxisCommand * theLockAxis);
00166 void updateOnMoveReportE(const ippOnMoveReportECommand * theOnMove);
00167 void updateOnPtMeasReport(const ippOnPtMeasReportCommand * theOnPtMeas);
00168 void updateOnScanReport(const ippOnScanReportCommand * theOnScan);
00169 void updatePtMeas(const ippPtMeasCommand * thePtMeas);
00170 void updateScanInCylEndIsPlane(const ippScanInCylEndIsPlaneCommand * theScan);
00171 void updateScanInCylEndIsSphere(const ippScanInCylEndIsSphereCommand * theScan);
00172 void updateScanInPlaneEndIsCyl(const ippScanInPlaneEndIsCylCommand * theScan);
00173 void updateScanInPlaneEndIsPlane(const ippScanInPlaneEndIsPlaneCommand * theScan);
00174 void updateScanInPlaneEndIsSphere(const ippScanInPlaneEndIsSphereCommand * theScan);
00175 void updateScanOnCircle(const ippScanOnCircleCommand * theScan);
00176 void updateScanOnLine(const ippScanOnLineCommand * theScan);
00177 void updateSetCoordSystem(const ippSetCoordSystemCommand * theSet);
00178 void updateSetCsyTransformation(const ippSetCsyTransformationCommand * theSet);
00179 void updateSetProp(const ippSetPropCommand * theSet);
00180 void updateStartSession();
00181 public:
00182 world();
00183 virtual ~world();
00184
00185 void setMachineClass(ippMachineClassType type ){ _machineClass = type; }
00186
00187 void setIsHomed(bool inIsHomed) { _isHomed = inIsHomed; }
00188 void setReadiness(goness inReadiness){ _readiness = inReadiness; }
00189
00190 ippOnePropertyAlignmentPtr getCurrentAlignment() ;
00191 ippCoordSysType getCurrentCsy() const { return _Csy; }
00192 double getCurrentR()const { return _currentR; }
00193 double getCurrentToolA()const { return _toolCollection->getActiveTool()->getAngleA();}
00194 double getCurrentToolB()const { return _toolCollection->getActiveTool()->getAngleB();}
00195 double getCurrentToolC()const { return _toolCollection->getActiveTool()->getAngleC();}
00196 double getProbeRadius()const { return _toolCollection->getActiveTool()->getRadius(); }
00197 double getCurrentX() const { return _currentX; }
00198 double getCurrentY() const { return _currentY; }
00199 double getCurrentZ() const { return _currentZ; }
00200 double getCurrentQ() const { return _currentQ; }
00201 int getIJKAct() const { return _IJKAct; }
00202 bool getIsHomed() const { return _isHomed; }
00203 double getLimitLowerX() const { return _limitLowerX; }
00204 double getLimitLowerY()const { return _limitLowerY; }
00205 double getLimitLowerZ()const { return _limitLowerZ; }
00206 double getLimitUpperX()const { return _limitUpperX; }
00207 double getLimitUpperY()const { return _limitUpperY; }
00208 double getLimitUpperZ()const { return _limitUpperZ; }
00209 ippCsyTransform * getJogDisplayCsyTransform() { return &_csyJogDisplay; }
00210 ippCsyTransform * getJogMoveCsyTransform() { return &_csyJogMove; }
00211 ippMachineClassType getMachineClass() const { return _machineClass; }
00212 double getMeasuredX1()const { return _measuredX1; }
00213 double getMeasuredY1()const { return _measuredY1; }
00214 double getMeasuredZ1()const { return _measuredZ1; }
00215 double getMeasuredX2()const { return _measuredX2; }
00216 double getMeasuredY2()const { return _measuredY2; }
00217 double getMeasuredZ2()const { return _measuredZ2; }
00218 double getMeasuredX3()const { return _measuredX3; }
00219 double getMeasuredY3()const { return _measuredY3; }
00220 double getMeasuredZ3()const { return _measuredZ3; }
00221 ippCsyTransform * getMoveableCsyTransform() { return &_csyMoveable; }
00222 ippCsyTransform * getMultipleCsyTransform() { return &_csyMultiple; }
00223
00224
00225 ippOnScanReportCommandConstPtr getOnScanReportCommand() const;
00226 ippOnPtMeasReportCommandConstPtr getOnPtMeasReportCommand() const;
00227
00228
00229 bool getOutOfRangeFlag()const { return _outOfRangeFlag; }
00230 ippCsyTransform * getPartCsyTransform() { return &_csyPart; }
00231 goness getReadiness()const { return _readiness; }
00232 ippCsyTransform * getSensorCsyTransform() { return &_csySensor; }
00233 ippToolChangerPtr getTools() { return _toolCollection; }
00234 bool getUserEnabled()const { return _userEnabled; }
00235
00236
00237
00238 bool inWorkVolume(double x, double y, double z) const;
00239
00240
00241 void stopAllDaemons();
00242 bool daemonExists(int tag) const;
00243 int daemonCount() const;
00244 void addDaemon(const ippOnMoveReportECommand *);
00245 void stopDaemon(int tag);
00246 ippDaemonConstPtr getDaemon() const;
00247
00248
00249 void putCurrentXYZ(double x, double y, double z)
00250 {
00251 _currentX = x;
00252 _currentY = y;
00253 _currentZ = z;
00254 }
00255
00256 void putCurrentContactIJK(double i, double j, double k)
00257 {
00258 _currentContactI = i;
00259 _currentContactJ = j;
00260 _currentContactK = k;
00261 }
00262 void putCurrentQ(double quality_factor);
00263
00264 void setMeasuredX1(double inX1){ _measuredX1 = inX1; }
00265 void setMeasuredY1(double inY1){ _measuredY1 = inY1; }
00266 void setMeasuredZ1(double inZ1){ _measuredZ1 = inZ1; }
00267 void setMeasuredX2(double inX2){ _measuredX2 = inX2; }
00268 void setMeasuredY2(double inY2){ _measuredY2 = inY2; }
00269 void setMeasuredZ2(double inZ2){ _measuredZ2 = inZ2; }
00270 void setMeasuredX3(double inX3){ _measuredX3 = inX3; }
00271 void setMeasuredY3(double inY3){ _measuredY3 = inY3; }
00272 void setMeasuredZ3(double inZ3){ _measuredZ3 = inZ3; }
00273 void update(ippCommandConstPtr aCommand);
00274
00275 };
00276
00277 #endif