2 #include <visp3/core/vpConfig.h>
3 #include <visp3/gui/vpDisplayFactory.h>
4 #include <visp3/robot/vpSimulatorAfma6.h>
5 #include <visp3/visual_features/vpFeatureBuilder.h>
6 #include <visp3/vs/vpServo.h>
8 #ifdef ENABLE_VISP_NAMESPACE
15 unsigned int thickness = 3;
16 static std::vector<vpImagePoint> traj[4];
18 for (
unsigned int i = 0; i < 4; i++) {
20 point[i].project(cMo);
22 traj[i].push_back(cog);
24 for (
unsigned int i = 0; i < 4; i++) {
25 for (
unsigned int j = 1; j < traj[i].size(); j++) {
33 #if defined(VISP_HAVE_THREADS)
34 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
35 std::shared_ptr<vpDisplay> display;
69 std::vector<vpPoint> point;
70 point.push_back(
vpPoint(-0.1, -0.1, 0));
71 point.push_back(
vpPoint(0.1, -0.1, 0));
72 point.push_back(
vpPoint(0.1, 0.1, 0));
73 point.push_back(
vpPoint(-0.1, 0.1, 0));
81 for (
unsigned int i = 0; i < 4; i++) {
89 vpSimulatorAfma6 robot(
true);
96 std::cout <<
"Robot joint limits: " << std::endl;
97 for (
unsigned int i = 0; i < 3; i++)
98 std::cout <<
"Joint " << i <<
": min " << qmin[i] <<
" max " << qmax[i] <<
" (m)" << std::endl;
99 for (
unsigned int i = 3; i < qmin.
size(); i++)
100 std::cout <<
"Joint " << i <<
": min " <<
vpMath::deg(qmin[i]) <<
" max " <<
vpMath::deg(qmax[i]) <<
" (deg)"
107 bool ret = robot.initialiseCameraRelativeToObject(cMo);
110 robot.setDesiredCameraPosition(cdMo);
113 #if defined(VISP_HAVE_DISPLAY)
114 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
120 std::cout <<
"No image viewer is available..." << std::endl;
124 robot.setCameraParameters(cam);
128 cMo = robot.get_cMo();
130 for (
unsigned int i = 0; i < 4; i++) {
136 robot.getInternalView(Iint);
138 display_trajectory(Iint, point, cMo, cam);
163 std::cout <<
"Catch an exception: " << e << std::endl;
165 #if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
166 if (display !=
nullptr) {
unsigned int size() const
Return the number of elements of the 2D array.
Generic class defining intrinsic camera parameters.
@ perspectiveProjWithoutDistortion
Perspective projection without distortion model.
Implementation of column vector and the associated operations.
static const vpColor blue
static const vpColor green
Class that defines generic functionalities for display.
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
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)
error that can be emitted by ViSP classes.
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpImagePoint &t)
Class that defines a 2D point visual feature which is composed by two parameters that are the cartes...
Implementation of an homogeneous matrix and operations on such kind of matrices.
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 double deg(double rad)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE
void setVerbose(bool verbose)
@ STATE_VELOCITY_CONTROL
Initialize the velocity controller.
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
void setInteractionMatrixType(const vpServoIteractionMatrixType &interactionMatrixType, const vpServoInversionType &interactionMatrixInversion=PSEUDO_INVERSE)
void addFeature(vpBasicFeature &s_cur, vpBasicFeature &s_star, unsigned int select=vpBasicFeature::FEATURE_ALL)
void setServo(const vpServoType &servo_type)
vpColVector computeControlLaw()
std::shared_ptr< vpDisplay > createDisplay()
Return a smart pointer vpDisplay specialization if a GUI library is available or nullptr otherwise.
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.
VISP_EXPORT int wait(double t0, double t)