64 #include <visp/vpCircle.h>
65 #include <visp/vpFeatureEllipse.h>
66 #include <visp/vpFeatureBuilder.h>
67 #include <visp/vpHomogeneousMatrix.h>
68 #include <visp/vpMath.h>
69 #include <visp/vpParseArgv.h>
70 #include <visp/vpServo.h>
71 #include <visp/vpSimulatorCamera.h>
74 #define GETOPTARGS "h"
84 void usage(
const char *name,
const char *badparam)
87 Simulation of a 2D visual servoing on a circle:\n\
88 - eye-in-hand control law,\n\
89 - velocity computed in the camera frame,\n\
102 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
114 bool getOptions(
int argc,
const char **argv)
121 case 'h': usage(argv[0], NULL);
return false;
break;
124 usage(argv[0], optarg);
129 if ((c == 1) || (c == -1)) {
131 usage(argv[0], NULL);
132 std::cerr <<
"ERROR: " << std::endl;
133 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
141 main(
int argc,
const char ** argv)
144 if (getOptions(argc, argv) ==
false) {
151 std::cout << std::endl ;
152 std::cout <<
"-------------------------------------------------------" << std::endl ;
153 std::cout <<
" Test program for vpServo " <<std::endl ;
154 std::cout <<
" Simulation " << std::endl ;
155 std::cout <<
" task : servo a circle " << std::endl ;
156 std::cout <<
"-------------------------------------------------------" << std::endl ;
157 std::cout << std::endl ;
197 std::cout << std::endl ;
206 unsigned int iter=0 ;
210 std::cout <<
"---------------------------------------------" << iter <<std::endl ;
224 std::cout <<
"task rank: " << task.
getTaskRank() <<std::endl ;
228 std::cout <<
"|| s - s* || = " << ( task.
getError() ).sumSquare() << std::endl ;