 |
Visual Servoing Platform
version 3.2.0
|
78 #include <visp3/core/vpHomogeneousMatrix.h>
79 #include <visp3/core/vpIoTools.h>
80 #include <visp3/core/vpMath.h>
81 #include <visp3/core/vpThetaUVector.h>
82 #include <visp3/core/vpTranslationVector.h>
83 #include <visp3/io/vpParseArgv.h>
84 #include <visp3/robot/vpSimulatorCamera.h>
87 #define GETOPTARGS "h"
89 void usage(
const char *name,
const char *badparam);
90 bool getOptions(
int argc,
const char **argv);
100 void usage(
const char *name,
const char *badparam)
103 Simulation of a 3D visual servoing:\n\
104 - eye-in-hand control law,\n\
105 - velocity computed in the camera frame,\n\
106 - without display.\n\
118 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
130 bool getOptions(
int argc,
const char **argv)
138 usage(argv[0], NULL);
143 usage(argv[0], optarg_);
149 if ((c == 1) || (c == -1)) {
151 usage(argv[0], NULL);
152 std::cerr <<
"ERROR: " << std::endl;
153 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
160 int main(
int argc,
const char **argv)
164 if (getOptions(argc, argv) ==
false) {
171 std::string username;
176 std::string logdirname;
178 logdirname =
"C:/temp/" + username;
180 logdirname =
"/tmp/" + username;
189 std::cerr << std::endl <<
"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;
240 unsigned int iter = 0;
242 while (iter++ < 200) {
243 std::cout <<
"-----------------------------------" << iter << std::endl;
265 v = -lambda * cRcd * cdtc;
268 w = -lambda * tu_cdRc;
272 for (
unsigned int i = 0; i < 3; i++) {
274 velocity[i + 3] = w[i];
281 std::cout <<
"|| s - s* || = " << cdtc.t() <<
" " << tu_cdRc.t() << std::endl;
284 flog << velocity.t() <<
" " << cdtc.t() <<
" " << tu_cdRc.t() << std::endl;
290 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
static double rad(double deg)
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.
Class that defines the simplest robot: a free flying camera.
Implementation of column vector and the associated operations.
void extract(vpRotationMatrix &R) const
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
vpHomogeneousMatrix getPosition() const
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of a pose vector and operations on poses.
vpHomogeneousMatrix inverse() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
error that can be emited by ViSP classes.
vpRotationMatrix inverse() const