62 "Make the SDH move one finger in \"velocity with acceleration ramp\" control mode.\n(C++ demo application using the SDHLibrary-CPP library.)\n" 64 " - Make SDH connected via Ethernet move.\n" 65 " The SDH has IP-Address 192.168.1.42 and is attached to TCP port 23.\n" 66 " (Requires at least SDH-firmware v0.0.3.1)\n" 67 " > demo-velocity-acceleration --tcp=192.168.1.42:23\n" 70 " - Make SDH connected to port 2 = COM3 move:\n" 71 " > demo-velocity-acceleration -p 2\n" 73 " - Make SDH connected to USB to RS232 converter 0 move:\n" 74 " > demo-velocity-acceleration --sdh_rs_device=/dev/ttyUSB0 \n" 76 " - Get the version info of both the joint controllers and the tactile \n" 77 " sensor firmware from an SDH connected via Ethernet.\n" 78 " The joint controllers and the tactile sensors have a common IP-Address,\n" 79 " here 192.168.1.42. The SDH controller is attached to the \n" 80 " default TCP port 23 and the tactile sensors to the default TCP port 13000.\n" 81 " (Requires at least SDH-firmware v0.0.3.2)\n" 82 " > demo-velocity-acceleration --tcp=192.168.1.42 --dsa_tcp -v\n" 84 " - Get the version info of an SDH connected to port 2 = COM3 \n" 85 " > demo-velocity-acceleration --port=2 -v\n";
87 char const*
__author__ =
"Dirk Osswald: dirk.osswald@de.schunk.com";
88 char const*
__url__ =
"http://www.schunk.com";
89 char const*
__version__ =
"$Id: demo-velocity-acceleration.cpp 10351 2013-06-18 16:28:14Z Osswald2 $";
96 "usage: demo-velocity-acceleration [options]\n";
99 int main(
int argc,
char** argv )
116 cdbg <<
"Debug messages of " << argv[0] <<
" are printed like this.\n";
127 cdbg <<
"Successfully created cSDH instance\n";
131 cdbg <<
"Successfully opened communication to SDH\n";
135 std::cout <<
"Preparation:\n";
136 std::cout <<
" Moving to start position with \"pose\" controller type:\n\n";
150 std::cout <<
"Moving in \"velocity with acceleration ramp\" controller type:\n";
151 std::cout <<
" Now move back and forth with increasing acceleration\n";
152 std::cout <<
" and target velocities of alternating sign:\n";
164 double accelerations[] = { 10.0, 20.0, 40.0, 80.0, 160.0, 0.0 };
165 double velocity = 40.0;
172 for (
double sign = -1.0; sign <= 1.0; sign += 2.0 )
174 std::cout <<
"Setting target acceleration,velocity= " << std::setw(7) << accelerations[i] <<
" deg/(s*s) " << std::setw(7) << sign * velocity <<
" deg/s\n";
181 bool position_reached =
false;
182 while ( !position_reached )
185 cdbg <<
" Actual angle: " << std::setw(7) << hand.
GetAxisActualAngle( axis_index ) <<
" deg";
196 }
while ( accelerations[i] != 0.0);
204 std::cout <<
"Setting target acceleration,velocity= " << std::setw(7) << 100.0 <<
" deg/(s*s) " << std::setw(7) << 0.0 <<
" deg/s (for stopping)\n";
231 std::cerr <<
"demo-velocity-acceleration main(): An exception was caught: " << e->
what() <<
"\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
A class to print colored debug messages.
void WaitAxis(std::vector< int > const &axes, double timeout=-1.0)
void SetAxisEnable(std::vector< int > const &axes, std::vector< double > const &states)
velocity controller with acceleration ramp, velocities and accelerations of axes are controlled indep...
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...
void SetAxisTargetAcceleration(std::vector< int >const &axes, std::vector< double >const &accelerations)
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)
char const * __copyright__
void SetAxisTargetAngle(std::vector< int > const &axes, std::vector< double > const &angles)
#define USING_NAMESPACE_SDH
static char const * GetLibraryRelease(void)
int main(int argc, char **argv)
This file contains settings to make the SDHLibrary compile on differen systems:
std::vector< double > GetAxisActualAngle(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
std::vector< double > GetAxisReferenceVelocity(std::vector< int >const &axes)
std::vector< double > GetAxisActualVelocity(std::vector< int >const &axes)
USING_NAMESPACE_SDH NAMESPACE_SDH_START std::ostream * g_sdh_debug_log