$search
00001 //====================================================================== 00028 //====================================================================== 00029 00030 #ifndef SDHSERIAL_H_ 00031 #define SDHSERIAL_H_ 00032 00033 #include "sdhlibrary_settings.h" 00034 00035 //---------------------------------------------------------------------- 00036 // System Includes - include with <> 00037 //---------------------------------------------------------------------- 00038 00039 #include <assert.h> 00040 #if ! SDH_USE_VCC 00041 # include <unistd.h> 00042 #endif 00043 00044 //---------------------------------------------------------------------- 00045 // Project Includes - include with "" 00046 //---------------------------------------------------------------------- 00047 00048 #include "dbg.h" 00049 #include "sdhexception.h" 00050 #include "simplevector.h" 00051 #include "simplestringlist.h" 00052 #include "sdhbase.h" 00053 #include "serialbase.h" 00054 00055 //---------------------------------------------------------------------- 00056 // Defines, enums, unions, structs, 00057 //---------------------------------------------------------------------- 00058 00059 #include "sdh_codes.h" 00060 00061 //---------------------------------------------------------------------- 00062 // Global variables 00063 //---------------------------------------------------------------------- 00064 00065 00066 //---------------------------------------------------------------------- 00067 // Function declarations 00068 //---------------------------------------------------------------------- 00069 00070 00071 //---------------------------------------------------------------------- 00072 // Class declarations 00073 //---------------------------------------------------------------------- 00074 00075 NAMESPACE_SDH_START 00076 00077 // forward declarations of privatly used structures: 00078 struct sSDHBinaryRequest; 00079 struct sSDHBinaryResponse; 00080 00091 class VCC_EXPORT cSDHSerial : public cSDHBase 00092 { 00093 friend struct sSDHBinaryRequest; 00094 friend struct sSDHBinaryResponse; 00095 00096 protected: 00102 double m_sequtime; 00103 00105 char const* EOL; 00106 00108 cSerialBase* com; 00109 00110 00112 cSimpleStringList reply; 00113 00115 int nb_lines_to_ignore; 00116 00117 public: 00118 //################################################################# 00126 //----------------------------------------------------------------- 00136 cSDHSerial( int _debug_level=0 ); 00137 00138 00139 //----------------------------------------------------------------- 00143 virtual ~cSDHSerial() 00144 {} 00145 00146 00147 //----------------------------------------------------------------- 00166 void Open( cSerialBase* _com ) 00167 throw(cSDHLibraryException*); 00168 00169 00173 void Close() 00174 throw (cSDHLibraryException*); 00175 00176 00180 virtual bool IsOpen( void ); 00181 00182 00198 void Send( char const* s, int nb_lines=All, int nb_lines_total=All, int max_retries=3 ) 00199 throw( cSDHLibraryException* ); 00200 00201 00205 void ExtractFirmwareState() 00206 throw( cSDHErrorCommunication* ); 00207 00208 00212 double GetDuration( char* line ) 00213 throw( cSDHErrorCommunication* ); 00214 00215 00223 double get_duration( void ); 00224 00228 void Sync( ) 00229 throw( cSDHErrorCommunication* ); 00230 00234 void BinarySync( double timeout_s = 0.5 ) 00235 throw( cSDHErrorCommunication* ); 00236 00240 void SyncUnknown( ) 00241 throw( cSDHErrorCommunication* ); 00242 00243 00257 cSimpleVector AxisCommand( char const* command, int axis=All, double* value=NULL ) 00258 throw (cSDHLibraryException*); 00259 00273 cSimpleVector BinaryAxisCommand( eCommandCode command, int axis=All, double* value=NULL ) 00274 throw (cSDHLibraryException*); 00275 00276 00277 // end of doxygen name group sdhlibrary_cpp_csdhserial_internal 00279 //################################################################ 00280 00281 //################################################################ 00288 //----------------------------------------------------------------- 00303 cSimpleVector pid( int axis, double* p=NULL, double* i=NULL, double* d=NULL ) 00304 throw (cSDHLibraryException*); 00305 00306 //----------------------------------------------------------------- 00324 cSimpleVector kv( int axis=All, double* kv=NULL ) 00325 throw (cSDHLibraryException*); 00326 00327 //----------------------------------------------------------------- 00340 cSimpleVector ilim( int axis=All, double* limit=NULL ) 00341 throw (cSDHLibraryException*); 00342 00343 //----------------------------------------------------------------- 00360 cSimpleVector power( int axis=All, double* flag=NULL ) 00361 throw (cSDHLibraryException*); 00362 00363 // end of doxygen name group sdhlibrary_cpp_csdhserial_setup_commands 00365 //################################################################# 00366 00367 00368 //################################################################# 00375 //----------------------------------------------------------------- 00379 void demo( bool onoff ); 00380 00381 //----------------------------------------------------------------- 00390 int property( char const* propname, int value ); 00391 00392 //----------------------------------------------------------------- 00395 int user_errors( int value ); 00396 00397 //----------------------------------------------------------------- 00400 int terminal( int value ); 00401 00402 //----------------------------------------------------------------- 00405 int debug( int value ); 00406 00407 //----------------------------------------------------------------- 00408 00409 // end of doxygen name group sdhlibrary_cpp_csdhserial_misc_commands 00411 //################################################################# 00412 00413 //################################################################# 00420 //----------------------------------------------------------------- 00444 cSimpleVector v( int axis=All, double* velocity=NULL ) 00445 throw (cSDHLibraryException*); 00446 00447 //----------------------------------------------------------------- 00469 cSimpleVector tvav( int axis=All, double* velocity=NULL ) 00470 throw (cSDHLibraryException*); 00471 00472 //----------------------------------------------------------------- 00487 cSimpleVector vlim( int axis=All, double* dummy=NULL ) 00488 throw (cSDHLibraryException*); 00489 00490 //----------------------------------------------------------------- 00505 cSimpleVector alim( int axis=All, double* dummy=NULL ) 00506 throw (cSDHLibraryException*); 00507 00508 //----------------------------------------------------------------- 00524 cSimpleVector a( int axis=All, double* acceleration=NULL ) 00525 throw (cSDHLibraryException*); 00526 00527 //----------------------------------------------------------------- 00543 cSimpleVector p( int axis=All, double* angle=NULL ) 00544 throw (cSDHLibraryException*); 00545 00546 //----------------------------------------------------------------- 00562 cSimpleVector tpap( int axis=All, double* angle=NULL ) 00563 throw (cSDHLibraryException*); 00564 00565 //----------------------------------------------------------------- 00579 double m( bool sequ ) 00580 throw (cSDHLibraryException*); 00581 00582 //----------------------------------------------------------------- 00588 void stop( void ) 00589 throw(cSDHLibraryException*); 00590 00591 00592 //----------------------------------------------------------------- 00600 eVelocityProfile vp( eVelocityProfile velocity_profile = eVP_INVALID ) 00601 throw (cSDHLibraryException*); 00602 00603 00604 //----------------------------------------------------------------- 00612 eControllerType con( eControllerType controller ) 00613 throw (cSDHLibraryException*); 00614 00615 // end of doxygen name group sdhlibrary_cpp_csdhserial_movement_commands 00617 //################################################################# 00618 00619 //################################################################# 00626 //----------------------------------------------------------------- 00644 cSimpleVector pos( int axis=All, double* dummy=NULL ) 00645 throw (cSDHLibraryException*); 00646 00658 //----------------------------------------------------------------- 00659 cSimpleVector pos_save( int axis=All, double* value=NULL ) 00660 throw (cSDHLibraryException*); 00661 00662 //----------------------------------------------------------------- 00663 00677 cSimpleVector ref( int axis=All, double* value=NULL ) 00678 throw (cSDHLibraryException*); 00679 00680 //----------------------------------------------------------------- 00698 cSimpleVector vel( int axis=All, double* dummy=NULL ) 00699 throw (cSDHLibraryException*); 00700 00722 cSimpleVector rvel( int axis, double* dummy=NULL ) 00723 throw (cSDHLibraryException*); 00724 00725 00726 //----------------------------------------------------------------- 00737 cSimpleVector state( int axis=All, double* dummy=NULL ) 00738 throw (cSDHLibraryException*); 00739 00740 //----------------------------------------------------------------- 00747 cSimpleVector temp( void ) 00748 throw (cSDHLibraryException*); 00749 00750 //----------------------------------------------------------------- 00759 cSimpleVector temp_electronics( void ) 00760 throw (cSDHLibraryException*); 00761 00762 //----------------------------------------------------------------- 00770 char* ver( void ) 00771 throw (cSDHLibraryException*); 00772 //----------------------------------------------------------------- 00773 00781 char* ver_date( void ) 00782 throw (cSDHLibraryException*); 00783 //----------------------------------------------------------------- 00784 00792 char* id( void ) 00793 throw (cSDHLibraryException*); 00794 00795 //----------------------------------------------------------------- 00803 char* sn( void ) 00804 throw (cSDHLibraryException*); 00805 00806 //----------------------------------------------------------------- 00814 char* soc( void ) 00815 throw (cSDHLibraryException*); 00816 00817 //----------------------------------------------------------------- 00825 char* soc_date( void ) 00826 throw (cSDHLibraryException*); 00827 00828 //----------------------------------------------------------------- 00832 int numaxis( void ) 00833 throw (cSDHLibraryException*); 00834 00835 00836 // end of doxygen name group sdhlibrary_cpp_csdhserial_diagnosis_commands 00838 //################################################################# 00839 00840 //################################################################# 00847 //----------------------------------------------------------------- 00860 cSimpleVector igrip( int axis=All, double* limit=NULL ) 00861 throw (cSDHLibraryException*); 00862 00863 //----------------------------------------------------------------- 00876 cSimpleVector ihold( int axis=All, double* limit=NULL ) 00877 throw (cSDHLibraryException*); 00878 00879 //----------------------------------------------------------------- 00893 double selgrip( eGraspId grip, bool sequ ) 00894 throw (cSDHLibraryException*); 00895 00896 //----------------------------------------------------------------- 00911 double grip( double close, double velocity, bool sequ ) 00912 throw (cSDHLibraryException*); 00913 00914 // end of doxygen name group sdhlibrary_cpp_csdhserial_grip_commands 00916 //################################################################# 00917 00918 }; // end of class cSDHSerial 00919 //===================================================================== 00920 00922 typedef cSimpleVector (cSDHSerial::*pSetFunction)(int, double*); 00923 00925 typedef cSimpleVector (cSDHSerial::*pGetFunction)(int, double*); 00926 00927 NAMESPACE_SDH_END 00928 00929 #endif 00930 00931 00932 //====================================================================== 00933 /* 00934 Here are some settings for the emacs/xemacs editor (and can be safely ignored): 00935 (e.g. to explicitely set C++ mode for *.h header files) 00936 00937 Local Variables: 00938 mode:C++ 00939 mode:ELSE 00940 End: 00941 */ 00942 //====================================================================== 00943