58 #include <visp/vpFeaturePoint3D.h>
59 #include <visp/vpHomogeneousMatrix.h>
60 #include <visp/vpMath.h>
61 #include <visp/vpParseArgv.h>
62 #include <visp/vpPoint.h>
63 #include <visp/vpServo.h>
64 #include <visp/vpSimulatorCamera.h>
67 #define GETOPTARGS "h"
77 void usage(
const char *name,
const char *badparam)
80 Simulation of a 3D visual servoing:\n\
81 - servo a 3D point,\n\
82 - eye-in-hand control law,\n\
83 - velocity computed in the camera frame,\n\
96 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
108 bool getOptions(
int argc,
const char **argv)
115 case 'h': usage(argv[0], NULL);
return false;
break;
118 usage(argv[0], optarg);
123 if ((c == 1) || (c == -1)) {
125 usage(argv[0], NULL);
126 std::cerr <<
"ERROR: " << std::endl;
127 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
135 main(
int argc,
const char ** argv)
138 if (getOptions(argc, argv) ==
false) {
145 std::cout << std::endl ;
146 std::cout <<
"-------------------------------------------------------" << std::endl ;
147 std::cout <<
" Test program for vpServo " <<std::endl ;
148 std::cout <<
" Eye-in-hand task control, velocity computed in the camera frame" << std::endl ;
149 std::cout <<
" Simulation " << std::endl ;
150 std::cout <<
" task : servo a 3D point " << std::endl ;
151 std::cout <<
"-------------------------------------------------------" << std::endl ;
152 std::cout << std::endl ;
171 std::cout <<
"Point coordinates in the camera frame: " << point.
cP.
t() ;
186 std::cout << std::endl ;
195 unsigned int iter=0 ;
199 std::cout <<
"---------------------------------------------" << iter <<std::endl ;
218 std::cout <<
"|| s - s* || = " << ( task.
getError() ).sumSquare() <<std::endl ;
void set_XYZ(const double X, const double Y, const double Z)
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)
create a new ste of two visual features
void setLambda(double _lambda)
set the gain lambda
void track(const vpHomogeneousMatrix &cMo)
void buildFrom(const vpPoint &p)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Class that defines what is a point.
void kill()
destruction (memory deallocation if required)
vpColVector getError() const
vpColVector computeControlLaw()
compute the desired control law
Class that defines the 3D point visual feature.
vpRowVector t() const
transpose of Vector
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 required to compute the visual servoing control law descbribed in and .
void setServo(vpServoType _servo_type)
Choice of the visual servoing control law.
void setWorldCoordinates(const double ox, const double oy, const double oz)
Set the point world coordinates. We mean here the coordinates of the point in the object frame...