00001 // 00002 // DISCLAIMER: 00003 // This software was produced by the National Institute of Standards 00004 // and Technology (NIST), an agency of the U.S. government, and by statute is 00005 // not subject to copyright in the United States. Recipients of this 00006 // software assume all responsibility associated with its operation, 00007 // modification,maintenance, and subsequent redistribution. 00008 // 00009 // See NIST Administration Manual 4.09.07 b and Appendix I. 00010 00011 00012 /* ToolChanger class 00013 00014 See pages 53-58 of the spec. 00015 00016 There is currently no data giving the location of a tool. It 00017 may be useful to add this (either to ToolChanger or to KTool). 00018 00019 The NoTool tool is (1) active when there is definitely no tool 00020 currently being held and (2) what FoundTool returns when the tool last 00021 sought by FindTool was not found. The UnDefTool is active when the 00022 system does not know whether or not a tool is being held. 00023 00024 It is not clear how the BaseTool (15-word description) and the RefTool 00025 (5-word description) should be handled. They are mentioned only on 00026 pages 53 and 56 the spec. It is not clear how the BaseTool differs 00027 from the NoTool. 00028 00029 The "tools" data member is modeled as a vector of pointers to KTool 00030 because when it was modeled as a vector of KTool, adding tools had to 00031 be done by push_back(*noTool) and similar statements. But that makes 00032 a copy of noTool and then adds a pointer to the copy. Then findTool 00033 finds the copy and it is not equal to noTool, so equality tests 00034 fail. C++ strikes again. 00035 00036 The checkIn ippTargetVector gives the location in machine coordinates 00037 (assuming there is no tool) to which the machine will be moved (for an 00038 automatic tool change) or must be moved (for a manual tool changer) in 00039 order to change the tool. The default checkIn location is (0, 0, 0). 00040 The checkIn location can be changed with setCheckIn. The checkIn can 00041 be used to produce a response to a GetChangeToolAction command (see 00042 pages 57-58). To be correct, the data in a GetChangeToolActionResponse 00043 (1) must be transformed to the current coordinate system, and (2) 00044 since the center of the ball is the position that is being controlled, 00045 must be offset according to the tool's dimensions and angles. 00046 00047 The current tool has two alignment vectors of type ippTargetVector 00048 (defined in IppCmdRes.h). These are maintained in machine coordinates 00049 so that they do not change if the coordinate system changes. The 00050 alignment vectors change when an AlignTool command is given (see page 00051 70). The vectors must be transformed from the current coordinate 00052 system to the machine coordinate system when the AlignTool command is 00053 carried out and must be transformed from the machine coordinate system 00054 to the current coordinate system when a response to 00055 GetProp(Tool.Alignment()) command is made. Since only the current tool 00056 has alignment vectors, they are properties of the ToolChanger, not of 00057 KTool. The default alignment is (0, 0, 0). 00058 00059 */ 00060 #pragma once 00061 #include "ippdme/ippdme.h" 00062 class ippGoToPars; 00063 00064 #include "ippTargetVector.h" 00065 #include "ippKTool.h" 00066 #include <vector> 00067 00068 EXPIMP_TEMPLATE template class IPPDME_EXT_CLASS std::allocator<ippKToolPtr>; 00069 EXPIMP_TEMPLATE template class IPPDME_EXT_CLASS std::vector<ippKToolPtr>; 00070 00071 class IPPDME_EXT_CLASS ippToolChanger : public ippObject 00072 { 00073 private: 00074 00075 ippKToolPtr _activeTool; 00076 ippKToolPtr _foundTool; 00077 ippKToolPtr _baseTool; 00078 ippKToolPtr _refTool; 00079 ippKToolPtr _noTool; 00080 ippKToolPtr _unDefTool; 00081 00082 std::vector<ippKToolPtr> _tools; /* all the tools the toolchanger knows about */ 00083 00084 ippTargetVector _checkIn; 00085 ippTargetVector _alignment1; 00086 ippTargetVector _alignment2; 00087 00088 public: 00089 00090 ippToolChanger (); 00091 00092 ~ippToolChanger (); 00093 00094 ippKToolPtr getActiveTool()const {return _activeTool;} 00095 00096 const ippTargetVector& getCheckIn()const {return _checkIn;} 00097 00098 ippKToolPtr getFoundTool()const {return _foundTool;} 00099 00100 ippKToolPtr getNoTool() const {return _noTool;} 00101 00102 const std::vector<ippKToolPtr>& getToolList() const {return _tools;} 00103 00104 ippKToolPtr getUnDefTool() const {return _unDefTool;} 00105 00106 ippTargetVector& getAlignment1() {return _alignment1;} 00107 ippTargetVector& getAlignment2() {return _alignment2;} 00108 00109 void setActiveTool( ippKToolPtr inTool); 00110 void setCheckIn(const ippTargetVector & inCheckIn); 00111 void setFoundTool( ippKToolPtr inTool); 00112 00113 void addTool(ippKToolPtr addIt); 00114 ippKToolPtr removeTool(const ippKToolPtr removeIt); 00115 ippKToolPtr findTool(const char * name); 00116 00117 00118 // other internals 00119 void clear(); 00120 00121 }; 00122 IPP_DECLARE_SMARTPOINTER(ippToolChanger); 00123