43 #include <visp3/core/vpConfig.h>
45 #ifdef VISP_HAVE_MODULE_ROBOT
47 #include <visp3/core/vpCameraParameters.h>
48 #include <visp3/core/vpDisplay.h>
49 #include <visp3/gui/vpDisplayGDI.h>
50 #include <visp3/gui/vpDisplayX.h>
51 #include <visp3/visual_features/vpFeatureBuilder.h>
52 #include <visp3/visual_features/vpFeatureSegment.h>
53 #include <visp3/core/vpHomogeneousMatrix.h>
54 #include <visp3/core/vpImage.h>
55 #include <visp3/core/vpMath.h>
56 #include <visp3/io/vpParseArgv.h>
57 #include <visp3/gui/vpPlot.h>
58 #include <visp3/core/vpPoint.h>
59 #include <visp3/robot/vpSimulatorCamera.h>
60 #include <visp3/vs/vpServo.h>
69 int main(
int argc,
const char **argv)
72 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
73 int opt_no_display = 0;
76 int opt_normalized = 1;
79 vpParseArgv::vpArgvInfo argTable[] =
81 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
83 "Disable display and graphics viewer."},
86 "1 to use normalized features, 0 for non normalized."},
100 std::cout <<
"Used options: " << std::endl;
101 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
102 opt_curves = (opt_no_display == 0) ? 1 : 0;
103 std::cout <<
" - no display: " << opt_no_display << std::endl;
104 std::cout <<
" - curves : " << opt_curves << std::endl;
106 std::cout <<
" - normalized: " << opt_normalized << std::endl;
110 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)
112 if (!opt_no_display) {
113 #if defined(VISP_HAVE_X11)
115 #elif defined VISP_HAVE_GDI
122 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
139 for (
int i=0; i<4; i++) {
144 for (
int i=0; i<4; i++) {
150 for (
int i=0; i <2; i++)
152 if (opt_normalized) {
172 for (
int i=0; i <2; i++)
175 #if (defined (VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
176 if (!opt_no_display) {
178 for (
int i=0; i <2; i++) {
186 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
191 graph =
new vpPlot(2, 500, 500, 700, 10,
"Curves...");
203 float sampling_time = 0.010f;
213 for (
int i=0; i <4; i++)
216 for (
int i=0; i <2; i++)
219 #if (defined (VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
220 if (!opt_no_display) {
222 for (
int i=0; i <2; i++) {
233 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
236 graph->
plot(0, iter, v);
244 }
while(( task.
getError() ).sumSquare() > 0.0005);
250 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
254 #if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
255 if (!opt_no_display && display != NULL)
259 std::cout <<
"final error=" << ( task.
getError() ).sumSquare() << std::endl;
263 std::cout <<
"Catch an exception: " << e << std::endl;
271 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)
virtual void init(vpImage< unsigned char > &I, int x=-1, int y=-1, const char *title=NULL)=0
Class that defines generic functionnalities for display.
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines the simplest robot: a free flying camera.
Display for windows using GDI (available on any windows 32 platform).
Define the X11 console to display images.
void addFeature(vpBasicFeature &s, vpBasicFeature &s_star, const unsigned int select=vpBasicFeature::FEATURE_ALL)
error that can be emited by ViSP classes.
void plot(const unsigned int graphNum, const unsigned int curveNum, const double x, const double y)
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Class that defines what is a point.
virtual void setSamplingTime(const double &delta_t)
vpColVector getError() const
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.
vpHomogeneousMatrix getPosition() const
void setInteractionMatrixType(const vpServoIteractionMatrixType &interactionMatrixType, const vpServoInversionType &interactionMatrixInversion=PSEUDO_INVERSE)
static double rad(double deg)
VISP_EXPORT double measureTimeMs()
void initGraph(unsigned int graphNum, unsigned int curveNbr)
void setNormalized(bool normalized)
Command line argument parsing.
void setWorldCoordinates(const double oX, const double oY, const double oZ)
Implementation of column vector and the associated operations.
vpHomogeneousMatrix inverse() const
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
void setServo(const vpServoType &servo_type)
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
void print(const unsigned int select=FEATURE_ALL) const