 |
Visual Servoing Platform
version 3.3.0
|
40 #include <visp3/robot/vpRobotPioneer.h>
41 #include <visp3/blob/vpDot2.h>
42 #include <visp3/core/vpCameraParameters.h>
43 #include <visp3/core/vpConfig.h>
44 #include <visp3/core/vpHomogeneousMatrix.h>
45 #include <visp3/core/vpImage.h>
46 #include <visp3/core/vpImageConvert.h>
47 #include <visp3/core/vpVelocityTwistMatrix.h>
48 #include <visp3/gui/vpDisplayGDI.h>
49 #include <visp3/gui/vpDisplayX.h>
50 #include <visp3/sensor/vp1394CMUGrabber.h>
51 #include <visp3/sensor/vp1394TwoGrabber.h>
52 #include <visp3/sensor/vpOpenCVGrabber.h>
53 #include <visp3/sensor/vpV4l2Grabber.h>
54 #include <visp3/visual_features/vpFeatureBuilder.h>
55 #include <visp3/visual_features/vpFeatureDepth.h>
56 #include <visp3/visual_features/vpFeaturePoint.h>
58 #if defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_CMU1394) || \
59 (VISP_HAVE_OPENCV_VERSION >= 0x020100)
60 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)
61 #if defined(VISP_HAVE_PIONEER)
62 #define TEST_COULD_BE_ACHIEVED
67 #undef VISP_HAVE_OPENCV // To use a firewire camera
68 #undef VISP_HAVE_V4L2 // To use a firewire camera
92 #ifdef TEST_COULD_BE_ACHIEVED
93 int main(
int argc,
char **argv)
99 double coef = 1. / 6.77;
103 ArArgumentParser parser(&argc, argv);
104 parser.loadDefaultArguments();
108 ArRobotConnector robotConnector(&parser, &robot);
109 if (!robotConnector.connectRobot()) {
110 ArLog::log(ArLog::Terse,
"Could not connect to the robot.");
111 if (parser.checkHelpAndWarnUnparsed()) {
116 if (!Aria::parseArgs()) {
128 std::cout <<
"Robot connected" << std::endl;
135 #if defined(VISP_HAVE_OPENCV)
137 std::cout <<
"Use device: " << device << std::endl;
138 cv::VideoCapture g(device);
139 g.set(CV_CAP_PROP_FRAME_WIDTH, 640);
140 g.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
149 #elif defined(VISP_HAVE_V4L2)
159 #elif defined(VISP_HAVE_DC1394)
167 #elif defined(VISP_HAVE_CMU1394)
179 #if defined(VISP_HAVE_OPENCV)
187 #if defined(VISP_HAVE_X11)
189 #elif defined(VISP_HAVE_GDI)
249 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
279 error.stack(s_Z.
error(s_Zd));
283 v = -lambda * (L * cVe * eJe).pseudoInverse() * error;
285 std::cout <<
"Send velocity to the pionner: " << v[0] <<
" m/s " <<
vpMath::deg(v[1]) <<
" deg/s" << std::endl;
300 std::cout <<
"Ending robot thread..." << std::endl;
304 robot.waitForRunExit();
307 std::cout <<
"Catch an exception: " << e << std::endl;
314 std::cout <<
"You don't have the right 3rd party libraries to run this example..." << std::endl;
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
void open(vpImage< unsigned char > &I)
void setInput(unsigned input=vpV4l2Grabber::DEFAULT_INPUT)
vpMatrix interaction(unsigned int select=FEATURE_ALL)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
void buildFrom(double x, double y, double Z, double LogZoverZstar)
void setDevice(const std::string &devname)
void get_cVe(vpVelocityTwistMatrix &cVe) const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
void buildFrom(double x, double y, double Z)
void acquire(vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
void open(vpImage< unsigned char > &I)
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
static double deg(double rad)
Display for windows using GDI (available on any windows 32 platform).
This tracker is meant to track a blob (connex pixels with same gray level) on a vpImage.
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
void setVideoMode(unsigned long format, unsigned long mode)
void setEllipsoidBadPointsPercentage(const double &percentage=0.0)
Implementation of column vector and the associated operations.
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
Implementation of a matrix and operations on matrices.
void setFramerate(vpV4l2FramerateType framerate)
static unsigned int selectX()
static void display(const vpImage< unsigned char > &I)
void setComputeMoments(bool activate)
void setGrayLevelPrecision(const double &grayLevelPrecision)
void initTracking(const vpImage< unsigned char > &I, unsigned int size=0)
Class that defines a 3D point visual feature which is composed by one parameters that is that defin...
Class for firewire ieee1394 video devices using libdc1394-2.x api.
void get_eJe(vpMatrix &eJe)
void initPersProjWithoutDistortion(double px, double py, double u0, double v0)
VISP_EXPORT void sleepMs(double t)
Class that defines a 2D point visual feature which is composed by two parameters that are the cartes...
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
Interface for Pioneer mobile robots based on Aria 3rd party library.
void setFramerate(unsigned long fps)
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
static void flush(const vpImage< unsigned char > &I)
vpMatrix interaction(unsigned int select=FEATURE_ALL)
void track(const vpImage< unsigned char > &I, bool canMakeTheWindowGrow=true)
void setEllipsoidShapePrecision(const double &ellipsoidShapePrecision)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
void setScale(unsigned scale=vpV4l2Grabber::DEFAULT_SCALE)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
error that can be emited by ViSP classes.
void setGraphics(bool activate)