85 "Simple demo to test cDSA class of SDHLibrary-cpp for tactile sensor data\n" 88 "This program does not use command line options. Instead all communication\n" 89 "parameters are fixed here in the source code\n" 92 char const*
__author__ =
"Dirk Osswald: dirk.osswald@de.schunk.com";
93 char const*
__url__ =
"http://www.schunk.com";
94 char const*
__version__ =
"$Id: demo-dsa-simple.cpp 12284 2014-09-30 08:28:44Z Osswald2 $";
98 "usage: demo-dsa-simple\n" 107 int main(
int argc,
char **argv )
113 string tcp_adr =
"192.168.100.200";
117 int dsa_tcp_port = 13000;
118 double timeout = -1.0;
125 ostream* debuglog =
NULL;
126 debuglog =
new ofstream(
"demo-dsa-simple.log", ios_base::app );
127 cDBG cdbg( debug_level>0,
"red", debuglog );
130 cdbg <<
"Debug messages of " << argv[0] <<
" are printed like this.\n";
140 cdbg <<
"debug_level=" << debug_level <<
" tcp_adr=" << tcp_adr <<
" dsa_tcp_port=" << dsa_tcp_port <<
"\n";
141 ts =
new cDSA( debug_level, tcp_adr.c_str(), dsa_tcp_port, timeout );
145 bool do_single_frames = framerate < 30;
147 if ( do_single_frames )
150 cdbg <<
"Starting DSA pull-mode, framerate=0 do_rle=" << do_RLE <<
" do_data_acquisition=false" <<
"\n";
156 cdbg <<
"Starting DSA push-mode, framerate=1 do_rle=" << do_RLE <<
" do_data_acquisition=true" <<
"\n";
163 double period_s = 0.0;
165 period_s = 1.0 / double(framerate);
178 if ( do_single_frames )
204 cout <<
"Actual framerate=" << ((nb_frames-nb_last)/last.
Elapsed( now )) <<
"Hz nb_frames=" << nb_frames <<
" nb_errors=" << nb_errors <<
" (" << ((100.0*nb_errors)/nb_frames) <<
"%)\n";
206 if ( last.
Elapsed( now ) > 3.0 )
216 cerr <<
"Caught and ignored cDSAException: " << e->
what() <<
" nb_errors=" << nb_errors <<
"\n";
217 cdbg <<
"Caught and ignored cDSAException: " << e->
what() <<
" nb_errors=" << nb_errors <<
"\n";
223 if ( do_single_frames )
225 remaining_s = period_s - (start.
Elapsed());
226 if ( remaining_s > 0.0 )
234 cerr <<
"\ndemo-dsa-simple main(): Caught exception from SDHLibrary: " << e->
what() <<
". Giving up!\n";
235 cdbg <<
"\ndemo-dsa-simple main(): Caught exception from SDHLibrary: " << e->
what() <<
". Giving up!\n";
240 cerr <<
"\ncaught unknown exception, giving up\n";
241 cdbg <<
"\ncaught unknown exception, giving up\n";
This file contains the interface to class #SDH::cSDH, the end user class to access the SDH from a PC...
#define SDH_ASSERT_TYPESIZES()
macro to assert that the defined typedefs have the expected sizes
void StoreNow(void)
Store current time internally.
A class to print colored debug messages.
Derived exception class for low-level DSA related exceptions.
double Elapsed(void) const
Return time in seconds elapsed between the time stored in the object and now.
void SetFramerate(UInt16 framerate, bool do_RLE=true, bool do_data_acquisition=true)
SDH::cDSA is the end user interface class to access the DSACON32m, the tactile sensor controller of t...
Base class for exceptions in the SDHLibrary-CPP.
Interface of auxilliary utility functions for SDHLibrary-CPP.
virtual const char * what() const
This file contains interface to #SDH::cDSA, a class to communicate with the tactile sensors of the SD...
#define USING_NAMESPACE_SDH
This file contains settings to make the SDHLibrary compile on differen systems:
Very simple class to measure elapsed time.
This file contains some basic definitions (defines, macros, datatypes)
USING_NAMESPACE_SDH NAMESPACE_SDH_START std::ostream * g_sdh_debug_log
sTactileSensorFrame const & UpdateFrame()
read the tactile sensor frame from remote DSACON32m and return a reference to it. A command to query ...
int main(int argc, char **argv)
char const * __copyright__
void SetFramerateRetries(UInt16 framerate, bool do_RLE=true, bool do_data_acquisition=true, unsigned int retries=0, bool ignore_exceptions=false)