00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 #ifndef ATISensor_hpp 00071 #define ATISensor_hpp 00072 00073 #include "Sensor.h" 00074 #include "Math/Vector7.h" 00075 #include "FileData/MatrixData.h" 00076 #include "HardwareErrors.h" 00077 00078 #ifdef __unix 00079 #include "IODevices/UnixSerialPort.h" 00080 #endif 00081 00082 #ifdef WIN32 00083 #include <windows.h> 00084 #endif 00085 00087 namespace OSCAR { 00088 00089 typedef Array<Vector7> Vector7Array; 00090 00104 class ATISensor : public Sensor<Vector7> 00105 { 00106 public: 00107 00122 ATISensor(unsigned int portNo, OSCARError& err = DUMMY_ERROR(noError)); 00123 00129 ~ATISensor(); 00130 00143 virtual bool Initialize(); 00144 00157 virtual bool Read(Vector7Array forces); 00158 00191 bool Read(Vector7 &forces); 00192 00209 bool SendCommand(char* command, String& string); 00210 00246 bool SetSpatialXform(const String& filename); 00247 00267 bool SetSpatialXform(const SpatialXform& spatialxform); 00268 00279 bool GetSpatialXform(SpatialXform& spatialXform) const; 00280 00299 bool ApplyTransform(bool aTrans); 00300 00317 bool GetTransformFlag(); 00318 00319 bool SetBias(Vector7 bs); //Temporary function 05-28-03 00320 bool GetBias(Vector7& bs); //Temporary function 05-28-03 00321 00330 bool Close(); 00331 00332 protected: 00333 00350 bool transformForces(Vector7 &forces); 00351 00352 private: 00353 00354 unsigned int portNum; 00355 bool applyTransform; 00356 SpatialXform forceTransform; 00357 Vector7 bias; 00358 00359 #ifdef __unix 00360 unsigned int serial_port; 00361 struct termio currentState; 00362 struct termio savedState; 00363 UnixSerialPort* ftSens; 00364 #endif 00365 #ifdef WIN32 00366 HANDLE comHandle; 00367 #endif 00368 }; 00369 00370 } 00371 00372 #endif //ATISensor_hpp
| RRG Homepage | OSCAR Overview | OSCAR Tutorials | Simulations |