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"
76 void usage(
const char *name,
const char *badparam);
77 bool getOptions(
int argc,
const char **argv);
87 void usage(
const char *name,
const char *badparam)
90 Simulation of a 2D visual servoing on a circle:\n\
91 - eye-in-hand control law,\n\
92 - velocity computed in the camera frame,\n\
105 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
117 bool getOptions(
int argc,
const char **argv)
124 case 'h': usage(argv[0], NULL);
return false;
break;
127 usage(argv[0], optarg_);
132 if ((c == 1) || (c == -1)) {
134 usage(argv[0], NULL);
135 std::cerr <<
"ERROR: " << std::endl;
136 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
144 main(
int argc,
const char ** argv)
148 if (getOptions(argc, argv) ==
false) {
155 std::cout << std::endl ;
156 std::cout <<
"-------------------------------------------------------" << std::endl ;
157 std::cout <<
" Test program for vpServo " <<std::endl ;
158 std::cout <<
" Simulation " << std::endl ;
159 std::cout <<
" task : servo a circle " << std::endl ;
160 std::cout <<
"-------------------------------------------------------" << std::endl ;
161 std::cout << std::endl ;
201 std::cout << std::endl ;
210 unsigned int iter=0 ;
214 std::cout <<
"---------------------------------------------" << iter <<std::endl ;
228 std::cout <<
"task rank: " << task.
getTaskRank() <<std::endl ;
232 std::cout <<
"|| s - s* || = " << ( task.
getError() ).sumSquare() << std::endl ;
241 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Class that defines the simplest robot: a free flying camera.
void addFeature(vpBasicFeature &s, vpBasicFeature &s_star, const unsigned int select=vpBasicFeature::FEATURE_ALL)
error that can be emited by ViSP classes.
void track(const vpHomogeneousMatrix &cMo)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
vpColVector getError() const
vpColVector computeControlLaw()
void getPosition(vpHomogeneousMatrix &wMc) const
Class that provides a data structure for the column vectors as well as a set of operations on these v...
vpHomogeneousMatrix inverse() const
void print(const vpServo::vpServoPrintType display_level=ALL, std::ostream &os=std::cout)
Class that defines 2D ellipse visual feature.
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
Class that defines what is a circle.
void setServo(const vpServoType &servo_type)
unsigned int getTaskRank() const
void setWorldCoordinates(const vpColVector &oP)