Go to the documentation of this file.
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";
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";
void SetAxisTargetVelocity(std::vector< int > const &axes, std::vector< double > const &velocities)
#define USING_NAMESPACE_SDH
Base class for exceptions in the SDHLibrary-CPP.
Very simple class to measure elapsed time.
std::vector< double > GetAxisMinAngle(std::vector< int > const &axes)
double Elapsed(void) const
Return time in seconds elapsed between the time stored in the object and now.
void SetAxisTargetAngle(std::vector< int > const &axes, std::vector< double > const &angles)
@ eVP_RAMP
ramp velocity profile
std::vector< double > GetAxisActualAngle(std::vector< int > const &axes)
std::vector< double > GetAxisMaxAngle(std::vector< int > const &axes)
Implementation of a class to parse common SDH related command line options.
cSDH * GetHand(cSDHOptions &options, cDBG &cdbg, int nb)
double MoveHand(bool sequ=true)
void OpenCommunication(NS_SDH cSDH &hand)
static char const * GetLibraryRelease(void)
@ eCT_POSE
coordinated position controller (position per axis => "pose controller"), all axes start and stop mov...
class for command line option parsing holding option parsing results
void SetVelocityProfile(eVelocityProfile velocity_profile)
#SDH::cSDH is the end user interface class to control a SDH (SCHUNK Dexterous Hand).
A class to print colored debug messages.
int main(int argc, char **argv)
This file contains some basic definitions (defines, macros, datatypes)
void SetAxisEnable(std::vector< int > const &axes, std::vector< double > const &states)
double ToRange(double v, double min, double max)
Interface of auxilliary utility functions for SDHLibrary-CPP.
This file contains settings to make the SDHLibrary compile on differen systems:
static char const * GetLibraryName(void)
USING_NAMESPACE_SDH NAMESPACE_SDH_START std::ostream * g_sdh_debug_log
This file contains the interface to class #SDH::cSDH, the end user class to access the SDH from a PC.
char const * __copyright__
virtual const char * what() const
int Parse(int argc, char **argv, char const *helptext, char const *progname, char const *version, char const *libname, char const *librelease)
void SetController(cSDHBase::eControllerType controller)
void Close(bool leave_enabled=false)
Interface of auxilliary utility functions for SDHLibrary-CPP.
#define SDH_ASSERT_TYPESIZES()
macro to assert that the defined typedefs have the expected sizes
@ All
A meta-value that means "access all possible values".
sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:58