79 #include <visp3/core/vpHomogeneousMatrix.h>
80 #include <visp3/core/vpIoTools.h>
81 #include <visp3/core/vpMath.h>
82 #include <visp3/io/vpParseArgv.h>
83 #include <visp3/robot/vpSimulatorCamera.h>
84 #include <visp3/core/vpThetaUVector.h>
85 #include <visp3/core/vpTranslationVector.h>
88 #define GETOPTARGS "h"
90 void usage(
const char *name,
const char *badparam);
91 bool getOptions(
int argc,
const char **argv);
101 void usage(
const char *name,
const char *badparam)
104 Simulation of a 3D visual servoing:\n\
105 - eye-in-hand control law,\n\
106 - velocity computed in the camera frame,\n\
107 - without display.\n\
119 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
131 bool getOptions(
int argc,
const char **argv)
138 case 'h': usage(argv[0], NULL);
return false;
break;
141 usage(argv[0], optarg_);
146 if ((c == 1) || (c == -1)) {
148 usage(argv[0], NULL);
149 std::cerr <<
"ERROR: " << std::endl;
150 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
158 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;
292 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
vpRotationMatrix inverse() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines the simplest robot: a free flying camera.
error that can be emited by ViSP classes.
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Implementation of a rotation matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
static double rad(double deg)
Implementation of column vector and the associated operations.
Implementation of a pose vector and operations on poses.
vpHomogeneousMatrix inverse() const
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.