00001
00028
00029
00030 #ifndef SDHSERIAL_H_
00031 #define SDHSERIAL_H_
00032
00033 #include "sdhlibrary_settings.h"
00034
00035
00036
00037
00038
00039 #include <assert.h>
00040 #if ! SDH_USE_VCC
00041 # include <unistd.h>
00042 #endif
00043
00044
00045
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
00057
00058
00059 NAMESPACE_SDH_START
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00087 class cSDHSerial : public cSDHBase
00088 {
00089 protected:
00095 double m_sequtime;
00096
00098 char const* EOL;
00099
00101 cSerialBase* com;
00102
00103
00105 cSimpleStringList reply;
00106
00108 int nb_lines_to_ignore;
00109
00110 public:
00111
00119
00129 cSDHSerial( int _debug_level=0 );
00130
00131
00132
00136 virtual ~cSDHSerial()
00137 {}
00138
00139
00140
00159 void Open( cSerialBase* _com )
00160 throw(cSDHLibraryException*);
00161
00162
00166 void Close()
00167 throw (cSDHLibraryException*);
00168
00169
00173 virtual bool IsOpen( void );
00174
00175
00191 void Send( char const* s, int nb_lines=All, int nb_lines_total=All, int max_retries=3 )
00192 throw( cSDHLibraryException* );
00193
00194
00198 void ExtractFirmwareState()
00199 throw( cSDHErrorCommunication* );
00200
00201
00205 double GetDuration( char* line )
00206 throw( cSDHErrorCommunication* );
00207
00208
00216 double get_duration( void );
00217
00221 void Sync( )
00222 throw( cSDHErrorCommunication* );
00223
00227 void SyncUnknown( )
00228 throw( cSDHErrorCommunication* );
00229
00230
00244 cSimpleVector AxisCommand( char const* command, int axis=All, double* value=NULL )
00245 throw (cSDHLibraryException*);
00246
00247
00248
00250
00251
00252
00259
00274 cSimpleVector pid( int axis, double* p=NULL, double* i=NULL, double* d=NULL )
00275 throw (cSDHLibraryException*);
00276
00277
00295 cSimpleVector kv( int axis=All, double* kv=NULL )
00296 throw (cSDHLibraryException*);
00297
00298
00311 cSimpleVector ilim( int axis=All, double* limit=NULL )
00312 throw (cSDHLibraryException*);
00313
00314
00331 cSimpleVector power( int axis=All, double* flag=NULL )
00332 throw (cSDHLibraryException*);
00333
00334
00336
00337
00338
00339
00346
00350 void demo( bool onoff );
00351
00352
00361 int property( char const* propname, int value );
00362
00363
00366 int user_errors( int value );
00367
00368
00371 int terminal( int value );
00372
00373
00376 int debug( int value );
00377
00378
00379
00380
00382
00383
00384
00391
00415 cSimpleVector v( int axis=All, double* velocity=NULL )
00416 throw (cSDHLibraryException*);
00417
00418
00433 cSimpleVector vlim( int axis=All, double* dummy=NULL )
00434 throw (cSDHLibraryException*);
00435
00436
00451 cSimpleVector alim( int axis=All, double* dummy=NULL )
00452 throw (cSDHLibraryException*);
00453
00454
00470 cSimpleVector a( int axis=All, double* acceleration=NULL )
00471 throw (cSDHLibraryException*);
00472
00473
00489 cSimpleVector p( int axis=All, double* angle=NULL )
00490 throw (cSDHLibraryException*);
00491
00492
00506 double m( bool sequ )
00507 throw (cSDHLibraryException*);
00508
00509
00515 void stop( void )
00516 throw(cSDHLibraryException*);
00517
00518
00519
00527 eVelocityProfile vp( eVelocityProfile velocity_profile = eVP_INVALID )
00528 throw (cSDHLibraryException*);
00529
00530
00531
00539 eControllerType con( eControllerType controller )
00540 throw (cSDHLibraryException*);
00541
00542
00544
00545
00546
00553
00571 cSimpleVector pos( int axis=All, double* dummy=NULL )
00572 throw (cSDHLibraryException*);
00573
00585
00586 cSimpleVector pos_save( int axis=All, double* value=NULL )
00587 throw (cSDHLibraryException*);
00588
00589
00590
00604 cSimpleVector ref( int axis=All, double* value=NULL )
00605 throw (cSDHLibraryException*);
00606
00607
00625 cSimpleVector vel( int axis=All, double* dummy=NULL )
00626 throw (cSDHLibraryException*);
00627
00649 cSimpleVector rvel( int axis, double* dummy=NULL )
00650 throw (cSDHLibraryException*);
00651
00652
00653
00664 cSimpleVector state( int axis=All, double* dummy=NULL )
00665 throw (cSDHLibraryException*);
00666
00667
00674 cSimpleVector temp( void )
00675 throw (cSDHLibraryException*);
00676
00677
00686 cSimpleVector temp_electronics( void )
00687 throw (cSDHLibraryException*);
00688
00689
00697 char* ver( void )
00698 throw (cSDHLibraryException*);
00699
00700
00708 char* ver_date( void )
00709 throw (cSDHLibraryException*);
00710
00711
00719 char* id( void )
00720 throw (cSDHLibraryException*);
00721
00722
00730 char* sn( void )
00731 throw (cSDHLibraryException*);
00732
00733
00741 char* soc( void )
00742 throw (cSDHLibraryException*);
00743
00744
00752 char* soc_date( void )
00753 throw (cSDHLibraryException*);
00754
00755
00759 int numaxis( void )
00760 throw (cSDHLibraryException*);
00761
00762
00763
00765
00766
00767
00774
00787 cSimpleVector igrip( int axis=All, double* limit=NULL )
00788 throw (cSDHLibraryException*);
00789
00790
00803 cSimpleVector ihold( int axis=All, double* limit=NULL )
00804 throw (cSDHLibraryException*);
00805
00806
00820 double selgrip( eGraspId grip, bool sequ )
00821 throw (cSDHLibraryException*);
00822
00823
00838 double grip( double close, double velocity, bool sequ )
00839 throw (cSDHLibraryException*);
00840
00841
00843
00844
00845 };
00846
00847
00849 typedef cSimpleVector (cSDHSerial::*pSetFunction)(int, double*);
00850
00852 typedef cSimpleVector (cSDHSerial::*pGetFunction)(int, double*);
00853
00854 NAMESPACE_SDH_END
00855
00856 #endif
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870