57 #include <visp/vpFeatureBuilder.h>
58 #include <visp/vpFeatureEllipse.h>
59 #include <visp/vpHomogeneousMatrix.h>
60 #include <visp/vpMath.h>
61 #include <visp/vpParseArgv.h>
62 #include <visp/vpRobotCamera.h>
63 #include <visp/vpServo.h>
64 #include <visp/vpSphere.h>
65 #include <visp/vpSimulatorCamera.h>
68 #define GETOPTARGS "h"
78 void usage(
const char *name,
const char *badparam)
81 Simulation of a 2D visual servoing on a sphere:\n\
82 - eye-in-hand control law,\n\
83 - velocity computed in the camera frame,\n\
85 - a secondary task is the added.\n\
97 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
110 bool getOptions(
int argc,
const char **argv)
117 case 'h': usage(argv[0], NULL);
return false;
break;
120 usage(argv[0], optarg);
125 if ((c == 1) || (c == -1)) {
127 usage(argv[0], NULL);
128 std::cerr <<
"ERROR: " << std::endl;
129 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
137 main(
int argc,
const char ** argv)
140 if (getOptions(argc, argv) ==
false) {
147 std::cout << std::endl ;
148 std::cout <<
"-------------------------------------------------------" << std::endl ;
149 std::cout <<
" Test program for vpServo " <<std::endl ;
150 std::cout <<
" Simulation " << std::endl ;
151 std::cout <<
" task : servo a sphere with a secondary task" << std::endl ;
152 std::cout <<
"-------------------------------------------------------" << std::endl ;
153 std::cout << std::endl ;
192 std::cout << std::endl ;
201 unsigned int iter=0 ;
205 std::cout <<
"---------------------------------------------" << iter <<std::endl ;
225 std::cout <<
"de2dt :"<< de2dt.
t() << std::endl;
228 std::cout <<
"(I-WpW)de2dt :"<< sec.
t() << std::endl;
230 if (iter>20) v += sec ;
235 std::cout <<
"|| s - s* || = " << ( task.
getError() ).sumSquare() <<std::endl ;