72#include <visp3/core/vpConfig.h>
73#include <visp3/core/vpHomogeneousMatrix.h>
74#include <visp3/core/vpIoTools.h>
75#include <visp3/core/vpMath.h>
76#include <visp3/core/vpThetaUVector.h>
77#include <visp3/core/vpTranslationVector.h>
78#include <visp3/io/vpParseArgv.h>
79#include <visp3/robot/vpSimulatorCamera.h>
84#ifdef ENABLE_VISP_NAMESPACE
88void usage(
const char *name,
const char *badparam);
89bool getOptions(
int argc,
const char **argv);
99void usage(
const char *name,
const char *badparam)
102Simulation of a 3D visual servoing:\n\
103- eye-in-hand control law,\n\
104- velocity computed in the camera frame,\n\
118 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
130bool getOptions(
int argc,
const char **argv)
138 usage(argv[0],
nullptr);
142 usage(argv[0], optarg_);
147 if ((c == 1) || (c == -1)) {
149 usage(argv[0],
nullptr);
150 std::cerr <<
"ERROR: " << std::endl;
151 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
158int 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 <<
"ERROR:" << std::endl;
189 std::cerr <<
" Cannot create " << logdirname << std::endl;
193 std::string logfilename;
194 logfilename = logdirname +
"/log.dat";
197 std::ofstream flog(logfilename.c_str());
201 std::cout << std::endl;
202 std::cout <<
"-------------------------------------------------------" << std::endl;
203 std::cout <<
" Test program without vpServo and vpFeature classes " << std::endl;
204 std::cout <<
" Eye-in-hand task control, velocity computed in the camera frame" << std::endl;
205 std::cout <<
" Simulation " << std::endl;
206 std::cout <<
" task : 3D visual servoing " << std::endl;
207 std::cout <<
"-------------------------------------------------------" << std::endl;
208 std::cout << std::endl;
221 robot.getPosition(wMc);
239 unsigned int iter = 0;
241 while (iter++ < 200) {
242 std::cout <<
"-----------------------------------" <<
iter << std::endl;
245 robot.getPosition(wMc);
250 cdMc = cdMo *
cMo.inverse();
264 v = -lambda * cRcd * cdtc;
267 w = -lambda * tu_cdRc;
271 for (
unsigned int i = 0;
i < 3;
i++) {
273 velocity[
i + 3] =
w[
i];
280 std::cout <<
"|| s - s* || = " << cdtc.t() <<
" " << tu_cdRc.t() << std::endl;
283 flog << velocity.t() <<
" " << cdtc.t() <<
" " << tu_cdRc.t() << std::endl;
290 std::cout <<
"Catch a ViSP exception: " <<
e << std::endl;
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
void extract(vpRotationMatrix &R) const
static double rad(double deg)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Implementation of a pose vector and operations on poses.
Implementation of a rotation matrix and operations on such kind of matrices.
vpRotationMatrix inverse() const
Class that defines the simplest robot: a free flying camera.
Implementation of a rotation vector as axis-angle minimal representation.
Class that consider the case of a translation vector.