85 #include <visp3/core/vpHomogeneousMatrix.h> 86 #include <visp3/core/vpIoTools.h> 87 #include <visp3/core/vpMath.h> 88 #include <visp3/io/vpParseArgv.h> 89 #include <visp3/robot/vpSimulatorCamera.h> 90 #include <visp3/visual_features/vpFeatureThetaU.h> 91 #include <visp3/visual_features/vpFeatureTranslation.h> 92 #include <visp3/vs/vpServo.h> 95 #define GETOPTARGS "h" 97 void usage(
const char *name,
const char *badparam);
98 bool getOptions(
int argc,
const char **argv);
108 void usage(
const char *name,
const char *badparam)
111 Simulation of a 3D visual servoing:\n\ 112 - eye-in-hand control law,\n\ 113 - velocity computed in the camera frame,\n\ 114 - without display.\n\ 126 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
138 bool getOptions(
int argc,
const char **argv)
146 usage(argv[0], NULL);
151 usage(argv[0], optarg_);
157 if ((c == 1) || (c == -1)) {
159 usage(argv[0], NULL);
160 std::cerr <<
"ERROR: " << std::endl;
161 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
168 int main(
int argc,
const char **argv)
172 if (getOptions(argc, argv) ==
false) {
180 std::string username;
185 std::string logdirname;
187 logdirname =
"C:/temp/" + username;
189 logdirname =
"/tmp/" + username;
197 std::cerr << std::endl <<
"ERROR:" << std::endl;
198 std::cerr <<
" Cannot create " << logdirname << std::endl;
202 std::string logfilename;
203 logfilename = logdirname +
"/log.dat";
206 std::ofstream flog(logfilename.c_str());
210 std::cout << std::endl;
211 std::cout <<
"-------------------------------------------------------" << std::endl;
212 std::cout <<
" Test program for vpServo " << std::endl;
213 std::cout <<
" Eye-in-hand task control, velocity computed in the camera frame" << std::endl;
214 std::cout <<
" Simulation " << std::endl;
215 std::cout <<
" task : 3D visual servoing " << std::endl;
216 std::cout <<
"-------------------------------------------------------" << std::endl;
217 std::cout << std::endl;
230 robot.getPosition(wMc);
248 unsigned int iter = 0;
250 while (iter++ < 200) {
251 std::cout <<
"------------------------------------" << iter << std::endl;
254 robot.getPosition(wMc);
277 w = lambda * tu_cRcd;
281 for (
unsigned int i = 0; i < 3; i++) {
283 velocity[i + 3] = w[i];
290 std::cout <<
"|| s - s* || = " << ctcd.
t() <<
" " << tu_cRcd.
t() << std::endl;
293 flog << velocity.
t() <<
" " << ctcd.
t() <<
" " << tu_cRcd.
t() << std::endl;
300 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
Implementation of a matrix and operations on matrices.
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
static vpMatrix skew(const vpColVector &v)
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.