main_compliantfingers.cc

This example demonstartes the BHandForce::adjustForce() method.

The force should be adjustet to zero by each finger. So, if you apply a force on a fingertip it will comply.

00001 // ***************************************************************************
00002 //                           main_compliantfingers.cc
00003 //                            Programm which demonstrates the adjustForce() function
00004 //                            of each finger
00005 //
00006 //    copyright            : (C) 2004 by tbaier
00007 //    email                : tbaier@informatik.uni-hamburg.de
00008 // ***************************************************************************
00009 
00010 #include <iostream>
00011 #include "bhandforcekin.h"
00012 
00013 
00014 
00015 int main(int argc, char *argv[])
00016 {
00017 
00018   if ((argc != 2)){
00019     std::cerr << "** usage: compliantFingers <serial port> \n" << std::endl;
00020     return -1;
00021    }
00022 
00023   BHandForceKin hand(*++argv);
00024 
00025   try{
00026     hand.init();
00027     hand.open(FINGERS);
00028     hand.closeSpread();
00029     hand.initForceSensor(FINGERS);
00030   }
00031   catch(BHandException e){
00032 
00033     std::cerr << e << std::endl;
00034     exit(-1);
00035   }
00036 
00037   try{
00038     while(42){
00039      hand.adjustForce(FINGERS, 0);
00040    }
00041 
00042      hand.stop();
00043   }
00044   catch (BHandException e){
00045     std::cout << "\t ** MAINFORCETEST::Catched BHandException" << std::endl;
00046     std::cout << e << std::endl;
00047   }
00048   catch (BHMotorException e){
00049     std::cout << "\t ** MAINFORCETEST::Catched BMotorException" << std::endl;
00050     std::cout << e << std::endl;
00051   }
00052 
00053   return 0;
00054 }


tams Tim Baier bhandlib v0.25
Generated Wed Aug 16 14:57:08 2006 by doxygen 1.4.7