44 #include <visp3/core/vpConfig.h> 46 #if defined(VISP_HAVE_MODULE_ROBOT) \ 47 && (defined(VISP_HAVE_LAPACK) || defined(VISP_HAVE_EIGEN3) || defined(VISP_HAVE_OPENCV)) 49 #include <visp3/core/vpCameraParameters.h> 50 #include <visp3/core/vpDisplay.h> 51 #include <visp3/core/vpHomogeneousMatrix.h> 52 #include <visp3/core/vpImage.h> 53 #include <visp3/core/vpMath.h> 54 #include <visp3/core/vpPoint.h> 55 #include <visp3/gui/vpDisplayGDI.h> 56 #include <visp3/gui/vpDisplayX.h> 57 #include <visp3/gui/vpPlot.h> 58 #include <visp3/io/vpParseArgv.h> 59 #include <visp3/robot/vpSimulatorCamera.h> 60 #include <visp3/visual_features/vpFeatureBuilder.h> 61 #include <visp3/visual_features/vpFeatureSegment.h> 62 #include <visp3/vs/vpServo.h> 71 int main(
int argc,
const char **argv)
74 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 75 int opt_no_display = 0;
78 int opt_normalized = 1;
81 vpParseArgv::vpArgvInfo argTable[] = {
82 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 86 "1 to use normalized features, 0 for non normalized."},
98 std::cout <<
"Used options: " << std::endl;
99 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 100 opt_curves = (opt_no_display == 0) ? 1 : 0;
101 std::cout <<
" - no display: " << opt_no_display << std::endl;
102 std::cout <<
" - curves : " << opt_curves << std::endl;
104 std::cout <<
" - normalized: " << opt_normalized << std::endl;
108 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) 110 if (!opt_no_display) {
111 #if defined(VISP_HAVE_X11) 113 #elif defined VISP_HAVE_GDI 120 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 137 for (
int i = 0; i < 4; i++) {
142 for (
int i = 0; i < 4; i++) {
148 for (
int i = 0; i < 2; i++) {
149 if (opt_normalized) {
168 for (
int i = 0; i < 2; i++)
171 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 172 if (!opt_no_display) {
174 for (
int i = 0; i < 2; i++) {
182 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 186 graph =
new vpPlot(2, 500, 500, 700, 10,
"Curves...");
199 float sampling_time = 0.02f;
211 for (
int i = 0; i < 4; i++)
214 for (
int i = 0; i < 2; i++)
217 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 218 if (!opt_no_display) {
220 for (
int i = 0; i < 2; i++) {
231 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 233 graph->
plot(0, iter, v);
241 }
while ((task.
getError()).sumSquare() > 0.0005);
243 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 247 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) 248 if (!opt_no_display && display != NULL)
252 std::cout <<
"final error=" << (task.
getError()).sumSquare() << std::endl;
255 std::cout <<
"Catch an exception: " << e << std::endl;
260 #elif !(defined(VISP_HAVE_LAPACK) || defined(VISP_HAVE_EIGEN3) || defined(VISP_HAVE_OPENCV)) 263 std::cout <<
"Cannot run this example: install Lapack, Eigen3 or OpenCV" << std::endl;
269 std::cout <<
"Test empty since visp_robot module is not available.\n" << std::endl;
void setPosition(const vpHomogeneousMatrix &wMc)
VISP_EXPORT int wait(double t0, double t)
End of the argument list.
Class that defines generic functionnalities for display.
void setWorldCoordinates(double oX, double oY, double oZ)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
void print(unsigned int select=FEATURE_ALL) const
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines the simplest robot: a free flying camera.
void addFeature(vpBasicFeature &s, vpBasicFeature &s_star, unsigned int select=vpBasicFeature::FEATURE_ALL)
Argument is for help displaying.
Display for windows using GDI (available on any windows 32 platform).
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Stand alone argument associated to an int var that is set to 1.
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
error that can be emited by ViSP classes.
vpHomogeneousMatrix inverse() const
vpHomogeneousMatrix getPosition() const
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
VISP_EXPORT double measureTimeMs()
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
void setMaxRotationVelocity(double maxVr)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
virtual void setSamplingTime(const double &delta_t)
Print an error message if an option is not in the argument list.
vpColVector computeControlLaw()
Class that defines a 2D segment visual features. This class allow to consider two sets of visual feat...
static void display(const vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
void plot(unsigned int graphNum, unsigned int curveNum, double x, double y)
void setInteractionMatrixType(const vpServoIteractionMatrixType &interactionMatrixType, const vpServoInversionType &interactionMatrixInversion=PSEUDO_INVERSE)
static double rad(double deg)
void initGraph(unsigned int graphNum, unsigned int curveNbr)
No abrevation. Print an error message if an option is abrevated (ie "-i" in place of "-int" which is ...
void setNormalized(bool normalized)
Implementation of column vector and the associated operations.
No default options like -help.
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...
vpColVector getError() const
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
void setServo(const vpServoType &servo_type)
void setMaxTranslationVelocity(double maxVt)
Argument is associated to an int.