81 "In case you have 2 SDHs you can operate one of them by moving the first\n" 82 "hand manualy. You must give parameters for 2 hands on the command line.\n" 83 "(C++ demo application using the SDHLibrary-CPP library.)\n" 86 " - Mimic the manual movements of SDH on port 2 = COM3 \n" 87 " with the SDH on port 5 = COM6:\n" 88 " > demo-mimic -p 2 -p 5\n" 90 " - Mimic the manual movements of SDH with CAN IDs 0x01 and 0x11 on\n" 91 " ESD CAN bus with the SDH with CAN IDs 0x02 and 0x2 on the same\n" 93 " > demo-mimic --can --id_read 0x1 --id_write 0x11 --can --id_read 0x2 --id_write 0x22\n" 95 char const*
__author__ =
"Dirk Osswald: dirk.osswald@de.schunk.com";
96 char const*
__url__ =
"http://www.schunk.com";
97 char const*
__version__ =
"$Id: demo-mimic.cpp 6501 2011-03-01 17:35:45Z Osswald2 $";
112 cdbg <<
"Successfully created cSDH instance " << nb <<
"\n";
116 cdbg <<
"Successfully opened communication to SDH " << nb <<
"\n";
122 int main(
int argc,
char **argv )
138 while ( i<argc && nb_sdh < 2 )
140 if ( !strncmp( argv[i],
"-p", strlen(
"-p" ) ) ||
141 !strncmp( argv[i],
"--port", strlen(
"--port" ) ) ||
142 !strncmp( argv[i],
"--sdhport", strlen(
"--sdhport" ) ) ||
143 !strncmp( argv[i],
"--sdh_rs_device", strlen(
"--sdh_rs_device" ) ) ||
144 !strncmp( argv[i],
"-c", strlen(
"-c" ) ) ||
145 !strncmp( argv[i],
"--can", strlen(
"--can" ) ) ||
146 !strncmp( argv[i],
"--canesd", strlen(
"--canesd" ) ) ||
147 !strncmp( argv[i],
"--canpeak", strlen(
"--canpeak" ) ) ||
148 !strncmp( argv[i],
"--sdh_canpeak_device", strlen(
"--sdh_canpeak_device" ) ) )
157 cerr <<
"You must provide parameters for exactly 2 SDHs. See --help\n";
178 cdbg <<
"Debug messages of " << argv[0] <<
" are printed like this.\n";
189 hand[0] =
GetHand( options1, cdbg, 0 );
190 hand[1] =
GetHand( options2, cdbg, 1 );
200 vector<double> min_angles = hand[1]->
GetAxisMinAngle( hand[1]->all_real_axes );
201 vector<double> max_angles = hand[1]->
GetAxisMaxAngle( hand[1]->all_real_axes );
202 vector<double> angles;
205 double elapsed = 0.0;
211 ToRange( angles, min_angles, max_angles );
218 ToRange( angles, min_angles, max_angles );
223 cout << elapsed <<
" ";
224 elapsed += options1.
period;
226 cout << start.
Elapsed() <<
" ";
229 for ( vector<double>::const_iterator ai = angles.begin();
242 cdbg <<
"Successfully disabled controllers of SDHs and closed connections\n";
246 cerr <<
"demo-mimic main(): Caught exception from SDHLibrary: " << e->
what() <<
". Giving up!\n";
251 cerr <<
"caught unexpected exception!\n";
A meta-value that means "access all possible values".
#SDH::cSDH is the end user interface class to control a SDH (SCHUNK Dexterous Hand).
int Parse(int argc, char **argv, char const *helptext, char const *progname, char const *version, char const *libname, char const *librelease)
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
Interface of auxilliary utility functions for SDHLibrary-CPP.
void SetVelocityProfile(eVelocityProfile velocity_profile)
int main(int argc, char **argv)
double Elapsed(void) const
Return time in seconds elapsed between the time stored in the object and now.
A class to print colored debug messages.
void SetAxisEnable(std::vector< int > const &axes, std::vector< double > const &states)
virtual const char * what() const
Implementation of a class to parse common SDH related command line options.
static char const * GetLibraryName(void)
coordinated position controller (position per axis => "pose controller"), all axes start and stop mov...
char const * __copyright__
void OpenCommunication(NS_SDH cSDH &hand)
Base class for exceptions in the SDHLibrary-CPP.
void SetController(cSDHBase::eControllerType controller)
Interface of auxilliary utility functions for SDHLibrary-CPP.
void Close(bool leave_enabled=false)
void SetAxisTargetVelocity(std::vector< int > const &axes, std::vector< double > const &velocities)
void SetAxisTargetAngle(std::vector< int > const &axes, std::vector< double > const &angles)
double ToRange(double v, double min, double max)
std::vector< double > GetAxisMinAngle(std::vector< int > const &axes)
#define USING_NAMESPACE_SDH
static char const * GetLibraryRelease(void)
This file contains settings to make the SDHLibrary compile on differen systems:
Very simple class to measure elapsed time.
cSDH * GetHand(cSDHOptions &options, cDBG &cdbg, int nb)
std::vector< double > GetAxisActualAngle(std::vector< int > const &axes)
std::vector< double > GetAxisMaxAngle(std::vector< int > const &axes)
double MoveHand(bool sequ=true)
This file contains some basic definitions (defines, macros, datatypes)
class for command line option parsing holding option parsing results
USING_NAMESPACE_SDH NAMESPACE_SDH_START std::ostream * g_sdh_debug_log