Visual servoing experiment on 4 points with a visualization and image generation from the camera and from an external view using vpSimulator.
#include <visp/vpConfig.h>
#include <visp/vpDebug.h>
#if (defined(VISP_HAVE_COIN_AND_GUI) && (defined(VISP_HAVE_GTK) || defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)))
#include <visp/vpImage.h>
#include <visp/vpCameraParameters.h>
#include <visp/vpTime.h>
#include <visp/vpImage.h>
#include <visp/vpImageConvert.h>
#include <visp/vpSimulator.h>
#if defined(VISP_HAVE_X11)
# include <visp/vpDisplayX.h>
#elif defined(VISP_HAVE_GDI)
# include <visp/vpDisplayGDI.h>
#elif defined(VISP_HAVE_GTK)
# include <visp/vpDisplayGTK.h>
#endif
#include <visp/vpMath.h>
#include <visp/vpHomogeneousMatrix.h>
#include <visp/vpPose.h>
#include <visp/vpFeaturePoint.h>
#include <visp/vpDot2.h>
#include <visp/vpServo.h>
#include <visp/vpServoDisplay.h>
#include <visp/vpRobotCamera.h>
#include <visp/vpFeatureBuilder.h>
#include <visp/vpIoTools.h>
static
void *mainLoop (void *_simu)
{
for (int i = 0 ; i < 4 ; i++)
point[i].project(cMo_d) ;
for (int i = 0 ; i < 4 ; i++)
#if defined(VISP_HAVE_X11)
#elif defined(VISP_HAVE_GDI)
#elif defined(VISP_HAVE_GTK)
#endif
disp.
init(I,100,100,
"Simulation display");
std::cout << "A click in the four dots clockwise. " << std::endl;
for (int i = 0 ; i < 4 ; i++)
{
std::cout << "A click in the dot " << i << std::endl;
}
for (int i = 0 ; i < 4 ; i++)
int k = 0;
while(k++ < 200){
for (int i = 0 ; i < 4 ; i++)
{
}
}
void *a=NULL ;
return a ;
}
int
main()
{
try {
std::cout << "Load : ./4Points.iv" << std::endl
<< "This file should be in the working directory" << std::endl;
simu.
load(
"./4points.iv") ;
return 0;
}
std::cout << "Catch an exception: " << e << std::endl;
return 1;
}
}
#else
int
main()
{
vpTRACE(
"You should install Coin3D and SoQT or SoWin or SoXt") ;
}
#endif