sdhserial.h
Go to the documentation of this file.
1 //======================================================================
28 //======================================================================
29 
30 #ifndef SDHSERIAL_H_
31 #define SDHSERIAL_H_
32 
33 #include "sdhlibrary_settings.h"
34 
35 //----------------------------------------------------------------------
36 // System Includes - include with <>
37 //----------------------------------------------------------------------
38 
39 #include <assert.h>
40 #if ! SDH_USE_VCC
41 # include <unistd.h>
42 #endif
43 
44 //----------------------------------------------------------------------
45 // Project Includes - include with ""
46 //----------------------------------------------------------------------
47 
48 #include "dbg.h"
49 #include "sdhexception.h"
50 #include "simplevector.h"
51 #include "simplestringlist.h"
52 #include "sdhbase.h"
53 #include "serialbase.h"
54 
55 //----------------------------------------------------------------------
56 // Defines, enums, unions, structs,
57 //----------------------------------------------------------------------
58 
59 #include "sdh_codes.h"
60 
61 //----------------------------------------------------------------------
62 // Global variables
63 //----------------------------------------------------------------------
64 
65 
66 //----------------------------------------------------------------------
67 // Function declarations
68 //----------------------------------------------------------------------
69 
70 
71 //----------------------------------------------------------------------
72 // Class declarations
73 //----------------------------------------------------------------------
74 
76 
77 // forward declarations of privatly used structures:
78 struct sSDHBinaryRequest;
79 struct sSDHBinaryResponse;
80 
91 class VCC_EXPORT cSDHSerial : public cSDHBase
92 {
93  friend struct sSDHBinaryRequest;
94  friend struct sSDHBinaryResponse;
95 
96 protected:
102  double m_sequtime;
103 
105  char const* EOL;
106 
109 
110 
113 
116 
117 public:
118  //#################################################################
126  //-----------------------------------------------------------------
136  cSDHSerial( int _debug_level=0 );
137 
138 
139  //-----------------------------------------------------------------
143  virtual ~cSDHSerial()
144  {}
145 
146 
147  //-----------------------------------------------------------------
171  void Open( cSerialBase* _com );
172 
173 
177  void Close();
178 
179 
183  virtual bool IsOpen( void );
184 
185 
201  void Send( char const* s, int nb_lines=All, int nb_lines_total=All, int max_retries=3 );
202 
203 
207  void ExtractFirmwareState();
208 
209 
213  double GetDuration( char* line );
214 
215 
223  double get_duration( void );
224 
228  void Sync( );
229 
233  void BinarySync( double timeout_s = 0.5 );
234 
238  void SyncUnknown( );
239 
240 
254  cSimpleVector AxisCommand( char const* command, int axis=All, double* value=NULL );
255 
269  cSimpleVector BinaryAxisCommand( eCommandCode command, int axis=All, double* value=NULL );
270 
271 
272  // end of doxygen name group sdhlibrary_cpp_csdhserial_internal
274  //################################################################
275 
276  //################################################################
283  //-----------------------------------------------------------------
298  cSimpleVector pid( int axis, double* p=NULL, double* i=NULL, double* d=NULL );
299 
300  //-----------------------------------------------------------------
318  cSimpleVector kv( int axis=All, double* kv=NULL );
319 
320  //-----------------------------------------------------------------
333  cSimpleVector ilim( int axis=All, double* limit=NULL );
334 
335  //-----------------------------------------------------------------
352  cSimpleVector power( int axis=All, double* flag=NULL );
353 
354  // end of doxygen name group sdhlibrary_cpp_csdhserial_setup_commands
356  //#################################################################
357 
358 
359  //#################################################################
366  //-----------------------------------------------------------------
370  void demo( bool onoff );
371 
372  //-----------------------------------------------------------------
381  int property( char const* propname, int value );
382 
383  //-----------------------------------------------------------------
386  int user_errors( int value );
387 
388  //-----------------------------------------------------------------
391  int terminal( int value );
392 
393  //-----------------------------------------------------------------
396  int debug( int value );
397 
398  //-----------------------------------------------------------------
399 
400  // end of doxygen name group sdhlibrary_cpp_csdhserial_misc_commands
402  //#################################################################
403 
404  //#################################################################
411  //-----------------------------------------------------------------
435  cSimpleVector v( int axis=All, double* velocity=NULL );
436 
437  //-----------------------------------------------------------------
459  cSimpleVector tvav( int axis=All, double* velocity=NULL );
460 
461  //-----------------------------------------------------------------
476  cSimpleVector vlim( int axis=All, double* dummy=NULL );
477 
478  //-----------------------------------------------------------------
493  cSimpleVector alim( int axis=All, double* dummy=NULL );
494 
495  //-----------------------------------------------------------------
511  cSimpleVector a( int axis=All, double* acceleration=NULL );
512 
513  //-----------------------------------------------------------------
529  cSimpleVector p( int axis=All, double* angle=NULL );
530 
531  //-----------------------------------------------------------------
547  cSimpleVector tpap( int axis=All, double* angle=NULL );
548 
549  //-----------------------------------------------------------------
563  double m( bool sequ );
564 
565  //-----------------------------------------------------------------
571  void stop( void );
572 
573 
574  //-----------------------------------------------------------------
582  eVelocityProfile vp( eVelocityProfile velocity_profile = eVP_INVALID );
583 
584 
585  //-----------------------------------------------------------------
593  eControllerType con( eControllerType controller );
594 
595  // end of doxygen name group sdhlibrary_cpp_csdhserial_movement_commands
597  //#################################################################
598 
599  //#################################################################
606  //-----------------------------------------------------------------
624  cSimpleVector pos( int axis=All, double* dummy=NULL );
625 
637  //-----------------------------------------------------------------
638  cSimpleVector pos_save( int axis=All, double* value=NULL );
639 
640  //-----------------------------------------------------------------
641 
655  cSimpleVector ref( int axis=All, double* value=NULL );
656 
657  //-----------------------------------------------------------------
675  cSimpleVector vel( int axis=All, double* dummy=NULL );
676 
698  cSimpleVector rvel( int axis, double* dummy=NULL );
699 
700 
701  //-----------------------------------------------------------------
712  cSimpleVector state( int axis=All, double* dummy=NULL );
713 
714  //-----------------------------------------------------------------
721  cSimpleVector temp( void );
722 
723  //-----------------------------------------------------------------
732  cSimpleVector temp_electronics( void );
733 
734  //-----------------------------------------------------------------
742  char* ver( void );
743  //-----------------------------------------------------------------
744 
752  char* ver_date( void );
753  //-----------------------------------------------------------------
754 
762  char* id( void );
763 
764  //-----------------------------------------------------------------
772  char* sn( void );
773 
774  //-----------------------------------------------------------------
782  char* soc( void );
783 
784  //-----------------------------------------------------------------
792  char* soc_date( void );
793 
794  //-----------------------------------------------------------------
798  int numaxis( void );
799 
800 
801  // end of doxygen name group sdhlibrary_cpp_csdhserial_diagnosis_commands
803  //#################################################################
804 
805  //#################################################################
812  //-----------------------------------------------------------------
825  cSimpleVector igrip( int axis=All, double* limit=NULL );
826 
827  //-----------------------------------------------------------------
840  cSimpleVector ihold( int axis=All, double* limit=NULL );
841 
842  //-----------------------------------------------------------------
856  double selgrip( eGraspId grip, bool sequ );
857 
858  //-----------------------------------------------------------------
873  double grip( double close, double velocity, bool sequ );
874 
875  // end of doxygen name group sdhlibrary_cpp_csdhserial_grip_commands
877  //#################################################################
878 
879 }; // end of class cSDHSerial
880 //=====================================================================
881 
883 typedef cSimpleVector (cSDHSerial::*pSetFunction)(int, double*);
884 
886 typedef cSimpleVector (cSDHSerial::*pGetFunction)(int, double*);
887 
889 
890 #endif
891 
892 
893 //======================================================================
894 /*
895  Here are some settings for the emacs/xemacs editor (and can be safely ignored):
896  (e.g. to explicitely set C++ mode for *.h header files)
897 
898  Local Variables:
899  mode:C++
900  mode:ELSE
901  End:
902 */
903 //======================================================================
904 
serialbase.h
Interface of class #SDH::cSerialBase, a virtal base class to access serial communication channels lik...
cSDHSerial::~cSDHSerial
virtual ~cSDHSerial()
Definition: sdhserial.h:143
cSimpleStringList
A simple string list. (Fixed maximum number of strings of fixed maximum length)
Definition: simplestringlist.h:70
NAMESPACE_SDH_END
#define NAMESPACE_SDH_END
Definition: sdhlibrary_settings.h:80
sSDHBinaryRequest
data structure with binary data for request from PC to SDH
Definition: sdhserial.cpp:65
cSerialBase
Low-level communication class to access a serial port.
Definition: serialbase.h:105
sSDHBinaryResponse
data structure with binary data for response from SDH to PC
Definition: sdhserial.cpp:100
cSDHSerial
The class to communicate with a SDH via RS232.
Definition: sdhserial.h:91
cSDHSerial::reply
cSimpleStringList reply
Space for the replies from the SDH.
Definition: sdhserial.h:112
NULL
#define NULL
Definition: getopt1.c:56
cSimpleVector
A simple vector implementation.
Definition: simplevector.h:91
dbg.h
This file contains interface and implementation of class #SDH::cDBG, a class for colorfull debug mess...
sdh_codes.h
This file contains function to convert the binary command codes of the SDH. To use this from a non gc...
pGetFunction
cSimpleVector(cSDHSerial::* pGetFunction)(int, double *)
Type of a pointer to a "get-axis-values" function like cSDHSerial::p, cSDHSerial::pos,...
Definition: sdhserial.h:886
cSDHSerial::com
cSerialBase * com
The communication object to the serial device (RS232 port or ESD CAN net)
Definition: sdhserial.h:108
cSDHSerial::m_sequtime
double m_sequtime
additional time in seconds to wait for sequential execution of m command (as these are always execute...
Definition: sdhserial.h:102
cSDHBase
The base class to control the SCHUNK Dexterous Hand.
Definition: sdhbase.h:97
eCommandCode
enum eCommandCodeEnum eCommandCode
typedef for eCommandCodeEnum, see there
Definition: sdh_command_codes.h:148
cSDHBase::IsOpen
virtual bool IsOpen(void)=0
Return true if connection to SDH firmware/hardware is open.
cSDHSerial::nb_lines_to_ignore
int nb_lines_to_ignore
number of remaining reply lines of a previous (non-sequential) command
Definition: sdhserial.h:115
simplevector.h
Interface of class #SDH::cSimpleVector.
simplestringlist.h
Interface of class #SDH::cSimpleStringList.
NAMESPACE_SDH_START
#define NAMESPACE_SDH_START
Definition: sdhlibrary_settings.h:79
sdhexception.h
Interface of the exception base class #SDH::cSDHLibraryException and #SDH::cMsg.
pSetFunction
cSimpleVector(cSDHSerial::* pSetFunction)(int, double *)
Type of a pointer to a "set-axis-values" function like cSDHSerial::p, cSDHSerial::pos,...
Definition: sdhserial.h:883
sdhlibrary_settings.h
This file contains settings to make the SDHLibrary compile on differen systems:
sdhbase.h
Interface of class #SDH::cSDHBase.
cSDHSerial::EOL
char const * EOL
String to use as "End Of Line" marker when sending to SDH.
Definition: sdhserial.h:105


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:58