83 #include <visp/vpHomogeneousMatrix.h>
84 #include <visp/vpIoTools.h>
85 #include <visp/vpMath.h>
86 #include <visp/vpParseArgv.h>
87 #include <visp/vpSimulatorCamera.h>
88 #include <visp/vpThetaUVector.h>
89 #include <visp/vpTranslationVector.h>
92 #define GETOPTARGS "h"
102 void usage(
const char *name,
const char *badparam)
105 Simulation of a 3D visual servoing:\n\
106 - eye-in-hand control law,\n\
107 - velocity computed in the camera frame,\n\
108 - without display.\n\
120 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
132 bool getOptions(
int argc,
const char **argv)
139 case 'h': usage(argv[0], NULL);
return false;
break;
142 usage(argv[0], optarg);
147 if ((c == 1) || (c == -1)) {
149 usage(argv[0], NULL);
150 std::cerr <<
"ERROR: " << std::endl;
151 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
159 main(
int argc,
const char ** argv)
162 if (getOptions(argc, argv) ==
false) {
169 std::string username;
174 std::string logdirname;
176 logdirname =
"C:/temp/" + username;
178 logdirname =
"/tmp/" + username;
188 std::cerr << std::endl
189 <<
"ERROR:" << std::endl;
190 std::cerr <<
" Cannot create " << logdirname << std::endl;
194 std::string logfilename;
195 logfilename = logdirname +
"/log.dat";
198 std::ofstream flog(logfilename.c_str());
202 std::cout << std::endl ;
203 std::cout <<
"-------------------------------------------------------" << std::endl ;
204 std::cout <<
" Test program without vpServo and vpFeature classes " <<std::endl ;
205 std::cout <<
" Eye-in-hand task control, velocity computed in the camera frame" << std::endl ;
206 std::cout <<
" Simulation " << std::endl ;
207 std::cout <<
" task : 3D visual servoing " << std::endl ;
208 std::cout <<
"-------------------------------------------------------" << std::endl ;
209 std::cout << std::endl ;
223 robot.getPosition(wMc) ;
241 unsigned int iter=0 ;
243 while(iter++ < 200) {
244 std::cout <<
"-----------------------------------" << iter <<std::endl ;
247 robot.getPosition(wMc) ;
266 v = -lambda * cRcd * cdtc;
269 w = -lambda * tu_cdRc;
273 for (
unsigned int i=0; i<3; i++) {
275 velocity[i+3] = w[i];
282 std::cout <<
"|| s - s* || = " << cdtc.t() <<
" " << tu_cdRc.t() << std::endl;
285 flog << velocity.t() <<
" " << cdtc.t() <<
" " << tu_cdRc.t() << std::endl;
vpRotationMatrix inverse() const
invert the rotation matrix
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.
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
The vpRotationMatrix considers the particular case of a rotation matrix.
void extract(vpRotationMatrix &R) const
static double rad(double deg)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
The pose is a complete representation of every rigid motion in the euclidian space.
vpHomogeneousMatrix inverse() const
Class that consider the case of a translation vector.
Class that consider the case of the parameterization for the rotation.