46 #include <boost/bind.hpp> 47 #include <boost/mem_fn.hpp> 73 cdbg <<
"cDSAUpdater::Updater(): thread started\n";
85 if ( error_level > 0 )
89 boost::this_thread::sleep(boost::posix_time::milliseconds(1000/40));
97 cdbg <<
"cDSAUpdater::Updater(): ignoring " << e->
what() <<
"\n";
105 std::cerr <<
"cDSAUpdater::Updater(): Too many errors from Tactile sensors of SDH. Reconnecting to DSACON32m!\n";
110 boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
115 cdbg <<
"cDSAUpdater::Updater(): ignoring " << e->
what() <<
" while reconnecting step 1\n";
126 cdbg <<
"cDSAUpdater::Updater(): ignoring " << e->
what() <<
" while reconnecting step 2\n";
135 std::cerr <<
"cDSAUpdater::Updater() Succesfully reconnected to DSACON32m of SDH\n";
140 cdbg <<
"cDSAUpdater::Updater(): ignoring " << e->
what() <<
" while reconnecting step 3\n";
158 cdbg <<
"cDSAUpdater::cDSAUpdater(): Starting new updater thread...";
174 expected_area[0] = eaf0p * FullArea( 0 );
175 expected_area[1] = eaf0d * FullArea( 1 );
176 expected_area[2] = eaf1p * FullArea( 2 );
177 expected_area[3] = eaf1d * FullArea( 3 );
178 expected_area[4] = eaf2p * FullArea( 4 );
179 expected_area[5] = eaf2d * FullArea( 5 );
185 for (
int i=0; i<6; i++ )
186 expected_area[i] = eafx[i] * FullArea( i );
205 bool is_grasped =
true;
206 for (
int i=0; i<6; i++ )
208 contact_info =
ts->GetContactInfo(i);
SDH::cDSA * ts
ptr to the cDSA tactile sensor object to use
helper stuff for the DSA using boost
This file contains the interface to class #SDH::cSDH, the end user class to access the SDH from a PC...
A class to print colored debug messages.
sMatrixInfo const & GetMatrixInfo(int m) const
Return a reference to the sMatrixInfo of matrix m read from the remote DSACON32m controller.
void Open(void)
(Re-)open connection to DSACON32m controller, this is called by the constructor automatically, but is still usefull to call after a call to Close()
Derived exception class for low-level DSA related exceptions.
void Close(void)
Set the framerate of the remote DSACON32m controller to 0 and close connection to it...
cIsGraspedByArea(SDH::cDSA *_ts)
default constructor which initializes the internal date
double FullArea(int m)
helper function, return full area of sensor patch m in mm*mm
void SetFramerate(UInt16 framerate, bool do_RLE=true, bool do_data_acquisition=true)
cDSAUpdater(cDSA *_ts, int _error_threshold=DEFAULT_ERROR_THRESHOLD)
SDH::cDSA is the end user interface class to access the DSACON32m, the tactile sensor controller of t...
abstract base class for calculation of IsGrasped condition using tactile sensor information ...
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...
void SetCondition(double eaf0p, double eaf0d, double eaf1p, double eaf1d, double eaf2p, double eaf2d)
boost::thread updater_thread
#define USING_NAMESPACE_SDH
void Updater()
the actual run function of the updater thread
This file contains settings to make the SDHLibrary compile on differen systems:
This file contains some basic definitions (defines, macros, datatypes)
double expected_area[6]
array of expected contact area of sensor patch in mm*mm
virtual bool IsGrasped(void)
USING_NAMESPACE_SDH cDBG cdbg
sTactileSensorFrame const & UpdateFrame()
read the tactile sensor frame from remote DSACON32m and return a reference to it. A command to query ...