2 #include <visp/vpDisplayX.h>
3 #include <visp/vpDisplayGDI.h>
4 #include <visp/vpFeatureBuilder.h>
5 #include <visp/vpImageIo.h>
6 #include <visp/vpImageSimulator.h>
7 #include <visp/vpServo.h>
8 #include <visp/vpServoDisplay.h>
9 #include <visp/vpSimulatorCamera.h>
28 for (
int i = 0; i < 4; i++) X_[i].resize(3);
30 X_[0][0] = -0.1; X_[1][0] = 0.1; X_[2][0] = 0.1; X_[3][0] = -0.1;
31 X_[0][1] = -0.1; X_[1][1] = -0.1; X_[2][1] = 0.1; X_[3][1] = 0.1;
32 X_[0][2] = 0; X_[1][2] = 0; X_[2][2] = 0; X_[3][2] = 0;
39 sim_.
init(target_, X_);
67 static std::vector<vpImagePoint> traj[4];
68 for (
unsigned int i=0; i<4; i++) {
69 traj[i].push_back(dot[i].getCog());
71 for (
unsigned int i=0; i<4; i++) {
72 for (
unsigned int j=1; j<traj[i].size(); j++) {
81 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)
88 std::vector<vpPoint> point(4) ;
89 point[0].setWorldCoordinates(-0.1,-0.1, 0);
90 point[1].setWorldCoordinates( 0.1,-0.1, 0);
91 point[2].setWorldCoordinates( 0.1, 0.1, 0);
92 point[3].setWorldCoordinates(-0.1, 0.1, 0);
102 #if defined(VISP_HAVE_X11)
104 #elif defined(VISP_HAVE_GDI)
107 std::cout <<
"No image viewer is available..." << std::endl;
112 "Click in the 4 dots to initialise the tracking and start the servo",
117 std::vector<vpDot2> dot(4);
119 for (
int i = 0 ; i < 4 ; i++) {
120 point[i].track(cdMo);
123 dot[i].setGraphics(
true);
124 dot[i].initTracking(I);
145 for (
int i = 0 ; i < 4 ; i++) {
150 point[i].changeFrame(cMo, cP) ;
156 display_trajectory(I, dot);
static void display(vpServo &s, const vpCameraParameters &cam, vpImage< unsigned char > &I, vpColor currentColor=vpColor::green, vpColor desiredColor=vpColor::red, unsigned int thickness=1)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
unsigned int getWidth() const
double getSamplingTime() const
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Class that defines the simplest robot: a free flying camera.
void getImage(vpImage< unsigned char > &I, const vpCameraParameters &cam)
Display for windows using GDI (available on any windows 32 platform).
Define the X11 console to display images.
void acquire(vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void addFeature(vpBasicFeature &s, vpBasicFeature &s_star, const unsigned int select=vpBasicFeature::FEATURE_ALL)
create a new ste of two visual features
void setLambda(double _lambda)
set the gain lambda
Class that defines a 2D point visual feature which is composed by two parameters that are the cartes...
vpVirtualGrabber(const std::string &filename, const vpCameraParameters &cam)
static int wait(double t0, double t)
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
virtual void setSamplingTime(const double &delta_t)
void kill()
destruction (memory deallocation if required)
vpColVector computeControlLaw()
compute the desired control law
static void display(const vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
void init(const vpImage< unsigned char > &I, vpColVector *_X)
void getPosition(vpHomogeneousMatrix &wMc) const
Class which enables to project an image in the 3D space and get the view of a virtual camera...
void setInterpolationType(const vpInterpolationType interp)
void setInteractionMatrixType(const vpServoIteractionMatrixType &interactionMatrixType, const vpServoInversionType &interactionMatrixInversion=PSEUDO_INVERSE)
Set the type of the interaction matrix (current, mean, desired, user).
static double rad(double deg)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
void setCleanPreviousImage(const bool &clean, const vpColor &color=vpColor::white)
virtual void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)=0
vpHomogeneousMatrix inverse() const
unsigned int getHeight() const
virtual bool getClick(bool blocking=true)=0
void set_Z(const double Z)
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
void setCameraPosition(const vpHomogeneousMatrix &_cMt)
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
static void read(vpImage< unsigned char > &I, const char *filename)
Class required to compute the visual servoing control law descbribed in and .
void setServo(vpServoType _servo_type)
Choice of the visual servoing control law.