46 #include <visp3/core/vpDebug.h>
47 #include <visp3/robot/vpViper650.h>
48 #include <visp3/core/vpMath.h>
49 #include <visp3/core/vpXmlParserCamera.h>
51 static const char *opt_viper650[] = {
"CAMERA",
"eMc_ROT_XYZ",
"eMc_TRANS_XYZ", NULL};
53 #ifdef VISP_HAVE_VIPER650_DATA
55 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_MarlinF033C_without_distortion_Viper650.cnf");
58 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_MarlinF033C_with_distortion_Viper650.cnf");
61 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_PTGreyFlea2_without_distortion_Viper650.cnf");
64 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_PTGreyFlea2_with_distortion_Viper650.cnf");
67 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_schunk_gripper_without_distortion_Viper650.cnf");
70 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_schunk_gripper_with_distortion_Viper650.cnf");
73 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_generic_without_distortion_Viper650.cnf");
76 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_eMc_generic_with_distortion_Viper650.cnf");
79 std::string(VISP_VIPER650_DATA_PATH) + std::string(
"/include/const_camera_Viper650.xml");
81 #endif // VISP_HAVE_VIPER650_DATA
108 c56 = -341.33 / 9102.22;
184 #ifdef VISP_HAVE_VIPER650_DATA
186 std::string filename_eMc;
234 "No predefined file available for a custom tool"
235 "You should use init(vpViper650::vpToolType, const std::string&) or"
236 "init(vpViper650::vpToolType, const vpHomogeneousMatrix&) instead");
252 this->
init (filename_eMc);
254 #else // VISP_HAVE_VIPER650_DATA
318 "No predefined parameters available for a custom tool"
319 "You should use init(vpViper650::vpToolType, const std::string&) or"
320 "init(vpViper650::vpToolType, const vpHomogeneousMatrix&) instead");
325 #endif // VISP_HAVE_VIPER650_DATA
362 const std::string &filename)
403 char Ligne[FILENAME_MAX];
409 bool get_rot_eMc =
false;
410 bool get_trans_eMc =
false;
413 if ((fdtask = fopen(filename.c_str(),
"r" )) == NULL) {
415 "Impossible to read the config file %s.", filename.c_str());
418 while (fgets(Ligne, FILENAME_MAX, fdtask) != NULL) {
420 if (
'#' == Ligne[0]) {
continue; }
422 std::stringstream ss(Ligne);
428 "Cannot parse configuration file %s to retrieve option name"));
432 dim = strlen(namoption);
434 for (code = 0; NULL != opt_viper650[code]; ++ code) {
435 if (strncmp(opt_viper650[code], namoption, dim) == 0) {
445 std::stringstream ss(Ligne);
446 ss >> namoption >> rot_eMc[0] >> rot_eMc[1] >> rot_eMc[2];
450 "Cannot parse configuration file %s to retrieve rotation", filename.c_str()));
454 rot_eMc[0] *= M_PI / 180.0;
455 rot_eMc[1] *= M_PI / 180.0;
456 rot_eMc[2] *= M_PI / 180.0;
462 std::stringstream ss(Ligne);
463 ss >> namoption >> trans_eMc[0] >> trans_eMc[1] >> trans_eMc[2];
467 "Cannot parse configuration file %s to retrieve translation", filename.c_str()));
469 get_trans_eMc =
true;
475 "line #%d.", filename.c_str(), numLn);
482 if (get_rot_eMc && get_trans_eMc) {
483 this->
set_eMc(trans_eMc,rot_eMc);
487 "Could not read translation and rotation parameters from config file %s", filename.c_str());
566 const unsigned int &image_width,
567 const unsigned int &image_height)
const
569 #if defined(VISP_HAVE_XML2) && defined (VISP_HAVE_VIPER650_DATA)
573 std::cout <<
"Get camera parameters for camera \""
575 <<
"from the XML file: \""
577 if (parser.
parse(cam,
583 "Impossible to read the camera parameters.");
588 std::cout <<
"Get camera parameters for camera \""
590 <<
"from the XML file: \""
592 if (parser.
parse(cam,
598 "Impossible to read the camera parameters.");
603 std::cout <<
"Get camera parameters for camera \""
605 <<
"from the XML file: \""
607 if (parser.
parse(cam,
613 "Impossible to read the camera parameters.");
618 std::cout <<
"Get camera parameters for camera \""
620 <<
"from the XML file: \""
622 if (parser.
parse(cam,
628 "Impossible to read the camera parameters.");
634 "No intrinsic parameters available for a custom tool");
647 "Impossible to read the camera parameters.");
655 if (image_width == 640 && image_height == 480) {
656 std::cout <<
"Get default camera parameters for camera \""
668 vpTRACE(
"Cannot get default intrinsic camera parameters for this image resolution");
670 "Impossible to read the camera parameters.");
677 if (image_width == 640 && image_height == 480) {
678 std::cout <<
"Get default camera parameters for camera \""
690 vpTRACE(
"Cannot get default intrinsic camera parameters for this image resolution");
692 "Impossible to read the camera parameters.");
698 if (image_width == 640 && image_height == 480) {
699 std::cout <<
"Get default camera parameters for camera \""
711 vpTRACE(
"Cannot get default intrinsic camera parameters for this image resolution");
713 "Impossible to read the camera parameters.");
719 "No intrinsic parameters available for a custom tool");
724 "Impossible to read the camera parameters.");
static const std::string CONST_EMC_GENERIC_WITH_DISTORTION_FILENAME
vpHomogeneousMatrix eMc
End effector to camera transformation.
Error that can be emited by the vpRobot class and its derivates.
Perspective projection without distortion model.
unsigned int getWidth() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpCameraParameters::vpCameraParametersProjType projModel
static const std::string CONST_EMC_GENERIC_WITHOUT_DISTORTION_FILENAME
static const std::string CONST_EMC_PTGREY_FLEA2_WITHOUT_DISTORTION_FILENAME
error that can be emited by ViSP classes.
vpToolType getToolType() const
Get the current tool type.
static const std::string CONST_EMC_PTGREY_FLEA2_WITH_DISTORTION_FILENAME
static const std::string CONST_EMC_SCHUNK_GRIPPER_WITH_DISTORTION_FILENAME
static const std::string CONST_EMC_MARLIN_F033C_WITHOUT_DISTORTION_FILENAME
XML parser to load and save intrinsic camera parameters.
void getCameraParameters(vpCameraParameters &cam, const unsigned int &image_width, const unsigned int &image_height) const
Implementation of a rotation matrix and operations on such kind of matrices.
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
double c56
Mechanical coupling between joint 5 and joint 6.
static const vpToolType defaultTool
Default tool attached to the robot end effector.
virtual void set_eMc(const vpHomogeneousMatrix &eMc_)
vpCameraParametersProjType
void parseConfigFile(const std::string &filename)
Generic class defining intrinsic camera parameters.
Modelisation of the ADEPT Viper 650 robot.
static const char *const CONST_MARLIN_F033C_CAMERA_NAME
vpToolType
List of possible tools that can be attached to the robot end-effector.
static const char *const CONST_PTGREY_FLEA2_CAMERA_NAME
Perspective projection with distortion model.
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
static double rad(double deg)
static const char *const CONST_SCHUNK_GRIPPER_CAMERA_NAME
static const std::string CONST_EMC_MARLIN_F033C_WITH_DISTORTION_FILENAME
unsigned int getHeight() const
Implementation of a rotation vector as Euler angle minimal representation.
int parse(vpCameraParameters &cam, const std::string &filename, const std::string &camera_name, const vpCameraParameters::vpCameraParametersProjType &projModel, const unsigned int image_width=0, const unsigned int image_height=0)
void setToolType(vpViper650::vpToolType tool)
Set the current tool type.
static const char *const CONST_GENERIC_CAMERA_NAME
Class that consider the case of a translation vector.
void initPersProjWithDistortion(const double px, const double py, const double u0, const double v0, const double kud, const double kdu)
static const std::string CONST_EMC_SCHUNK_GRIPPER_WITHOUT_DISTORTION_FILENAME
static const std::string CONST_CAMERA_FILENAME