 |
Visual Servoing Platform
version 3.3.0
|
44 #include <visp3/core/vpConfig.h>
46 #ifdef VISP_HAVE_MODULE_ROBOT
48 #include <visp3/core/vpCameraParameters.h>
49 #include <visp3/core/vpDisplay.h>
50 #include <visp3/core/vpHomogeneousMatrix.h>
51 #include <visp3/core/vpImage.h>
52 #include <visp3/core/vpMath.h>
53 #include <visp3/core/vpPoint.h>
54 #include <visp3/gui/vpDisplayGDI.h>
55 #include <visp3/gui/vpDisplayX.h>
56 #include <visp3/gui/vpPlot.h>
57 #include <visp3/io/vpParseArgv.h>
58 #include <visp3/robot/vpSimulatorCamera.h>
59 #include <visp3/visual_features/vpFeatureBuilder.h>
60 #include <visp3/visual_features/vpFeatureSegment.h>
61 #include <visp3/vs/vpServo.h>
70 int main(
int argc,
const char **argv)
73 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
74 int opt_no_display = 0;
77 int opt_normalized = 1;
80 vpParseArgv::vpArgvInfo argTable[] = {
81 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
85 "1 to use normalized features, 0 for non normalized."},
97 std::cout <<
"Used options: " << std::endl;
98 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
99 opt_curves = (opt_no_display == 0) ? 1 : 0;
100 std::cout <<
" - no display: " << opt_no_display << std::endl;
101 std::cout <<
" - curves : " << opt_curves << std::endl;
103 std::cout <<
" - normalized: " << opt_normalized << std::endl;
107 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)
109 if (!opt_no_display) {
110 #if defined(VISP_HAVE_X11)
112 #elif defined VISP_HAVE_GDI
119 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
136 for (
int i = 0; i < 4; i++) {
141 for (
int i = 0; i < 4; i++) {
147 for (
int i = 0; i < 2; i++) {
148 if (opt_normalized) {
167 for (
int i = 0; i < 2; i++)
170 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
171 if (!opt_no_display) {
173 for (
int i = 0; i < 2; i++) {
181 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
185 graph =
new vpPlot(2, 500, 500, 700, 10,
"Curves...");
198 float sampling_time = 0.02f;
210 for (
int i = 0; i < 4; i++)
213 for (
int i = 0; i < 2; i++)
216 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
217 if (!opt_no_display) {
219 for (
int i = 0; i < 2; i++) {
230 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
232 graph->
plot(0, iter, v);
240 }
while ((task.
getError()).sumSquare() > 0.0005);
246 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
250 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
251 if (!opt_no_display && display != NULL)
255 std::cout <<
"final error=" << (task.
getError()).sumSquare() << std::endl;
258 std::cout <<
"Catch an exception: " << e << std::endl;
266 std::cout <<
"Test empty since visp_robot module is not available.\n" << std::endl;
Argument is for help displaying.
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
VISP_EXPORT int wait(double t0, double t)
void setNormalized(bool normalized)
Stand alone argument associated to an int var that is set to 1.
static double rad(double deg)
Generic class defining intrinsic camera parameters.
void setPosition(const vpHomogeneousMatrix &wMc)
void setMaxTranslationVelocity(double maxVt)
Display for windows using GDI (available on any windows 32 platform).
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
Class that defines a 2D segment visual features. This class allow to consider two sets of visual feat...
void print(unsigned int select=FEATURE_ALL) const
Class that defines the simplest robot: a free flying camera.
Implementation of column vector and the associated operations.
void setServo(const vpServoType &servo_type)
VISP_EXPORT double measureTimeMs()
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
vpHomogeneousMatrix getPosition() const
static const vpColor green
Print an error message if an option is not in the argument list.
static void display(const vpImage< unsigned char > &I)
void setWorldCoordinates(double oX, double oY, double oZ)
void setMaxRotationVelocity(double maxVr)
vpColVector getError() const
No default options like -help.
void addFeature(vpBasicFeature &s, vpBasicFeature &s_star, unsigned int select=vpBasicFeature::FEATURE_ALL)
End of the argument list.
void setInteractionMatrixType(const vpServoIteractionMatrixType &interactionMatrixType, const vpServoInversionType &interactionMatrixInversion=PSEUDO_INVERSE)
void plot(unsigned int graphNum, unsigned int curveNum, double x, double y)
vpColVector computeControlLaw()
No abrevation. Print an error message if an option is abrevated (ie "-i" in place of "-int" which is ...
static void flush(const vpImage< unsigned char > &I)
virtual void setSamplingTime(const double &delta_t)
vpHomogeneousMatrix inverse() const
void initGraph(unsigned int graphNum, unsigned int curveNbr)
Class that defines what is a point.
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
Class that defines generic functionnalities for display.
error that can be emited by ViSP classes.
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
Argument is associated to an int.