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>
97void usage(
const char *name,
const char *badparam);
98bool getOptions(
int argc,
const char **argv);
108void usage(
const char *name,
const char *badparam)
111Simulation of a 3D visual servoing:\n\
112- eye-in-hand control law,\n\
113- velocity computed in the camera frame,\n\
126 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
138bool getOptions(
int argc,
const char **argv)
146 usage(argv[0], NULL);
150 usage(argv[0], optarg_);
155 if ((c == 1) || (c == -1)) {
157 usage(argv[0], NULL);
158 std::cerr <<
"ERROR: " << std::endl;
159 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
166int main(
int argc,
const char **argv)
170 if (getOptions(argc, argv) ==
false) {
178 std::string username;
183 std::string logdirname;
185 logdirname =
"C:/temp/" + username;
187 logdirname =
"/tmp/" + username;
195 std::cerr << std::endl <<
"ERROR:" << std::endl;
196 std::cerr <<
" Cannot create " << logdirname << std::endl;
200 std::string logfilename;
201 logfilename = logdirname +
"/log.dat";
204 std::ofstream flog(logfilename.c_str());
208 std::cout << std::endl;
209 std::cout <<
"-------------------------------------------------------" << std::endl;
210 std::cout <<
" Test program for vpServo " << std::endl;
211 std::cout <<
" Eye-in-hand task control, velocity computed in the camera frame" << std::endl;
212 std::cout <<
" Simulation " << std::endl;
213 std::cout <<
" task : 3D visual servoing " << std::endl;
214 std::cout <<
"-------------------------------------------------------" << std::endl;
215 std::cout << std::endl;
228 robot.getPosition(wMc);
246 unsigned int iter = 0;
248 while (iter++ < 200) {
249 std::cout <<
"------------------------------------" << iter << std::endl;
252 robot.getPosition(wMc);
275 w = lambda * tu_cRcd;
279 for (
unsigned int i = 0; i < 3; i++) {
281 velocity[i + 3] = w[i];
288 std::cout <<
"|| s - s* || = " << ctcd.
t() <<
" " << tu_cRcd.
t() << std::endl;
291 flog << velocity.
t() <<
" " << ctcd.
t() <<
" " << tu_cRcd.
t() << std::endl;
298 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
Implementation of column vector and the associated operations.
static vpMatrix skew(const vpColVector &v)
error that can be emited 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)
Implementation of a matrix and operations on matrices.
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Implementation of a pose vector and operations on poses.
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
Implementation of a rotation matrix and operations on such kind of matrices.
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.