Test for reading the Virtuose's and Glove joint positions.
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <visp3/core/vpCameraParameters.h>
#include <visp3/core/vpImage.h>
#include <visp3/core/vpMeterPixelConversion.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/robot/vpVirtuose.h>
#if defined(VISP_HAVE_VIRTUOSE) && (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
int main()
{
#ifdef ENABLE_VISP_NAMESPACE
#endif
int port = 53210;
std::string ip = "localhost";
std::vector<vpVirtuose> virtuose(4);
std::vector<vpHomogeneousMatrix> wMd(4);
for (size_t device = 0; device < virtuose.size(); device++) {
std::cout << "Try to connect to " << ip << " port " << (port + device) << std::endl;
virtuose[device].setIpAddressAndPort(ip, port + static_cast<int>(device));
virtuose[device].init();
}
std::cout << "After init" << std::endl;
#if 0
for (size_t device = 0; device < virtuose.size(); device++) {
std::cout << "Number of joints: " << virtuose[device].getJointsNumber()
<< " Joint position: " << virtuose[device].getArticularPosition().t() << std::endl
<< " Cartesian position: " << virtuose[device].getAvatarPosition().t() << std::endl;
}
#endif
bool end = false;
#if defined(VISP_HAVE_X11)
vpDisplayX d(I);
#elif defined(VISP_HAVE_GDI)
#endif
while (!end) {
for (size_t device = 0; device < virtuose.size(); device++) {
std::cout <<
"Device #" << device <<
" has position: " << wpd.
t() << std::endl;
wMd[device].buildFrom(wpd);
std::stringstream ss;
ss << device;
double X = cMd[0][3];
double Y = cMd[1][3];
double Z = cMd[2][3];
}
end = true;
}
}
for (size_t device = 0; device < virtuose.size(); device++) {
virtuose[device].close();
}
std::cout << "The end" << std::endl;
}
#else
int main() { std::cout << "You should install Virtuose API to use this binary..." << std::endl; }
#endif
Generic class defining intrinsic camera parameters.
static const vpColor white
Display for windows using GDI (available on any windows 32 platform).
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, const vpImagePoint &offset=vpImagePoint(0, 0), const std::string &frameName="", const vpColor &textColor=vpColor::black, const vpImagePoint &textOffset=vpImagePoint(15, 15))
static void flush(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static double rad(double deg)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Implementation of a pose vector and operations on poses.