42 #include <visp3/core/vpConfig.h> 43 #ifdef VISP_HAVE_PTU46 46 #include <visp3/core/vpDebug.h> 47 #include <visp3/core/vpIoTools.h> 48 #include <visp3/robot/vpPtu46.h> 49 #include <visp3/robot/vpRobotException.h> 50 #include <visp3/robot/vpRobotPtu46.h> 56 bool vpRobotPtu46::robotAlreadyCreated =
false;
72 vpRobotPtu46::vpRobotPtu46(
const char *device) :
vpRobot()
74 this->device =
new char[FILENAME_MAX];
76 sprintf(this->device,
"%s", device);
82 delete[] this->device;
90 delete[] this->device;
113 if (0 != ptu.close()) {
114 vpERROR_TRACE(
"Error while closing communications with the robot ptu-46.");
117 vpRobotPtu46::robotAlreadyCreated =
false;
144 if (0 != ptu.init(device)) {
309 "Modification of the robot state");
340 if (0 != ptu.move(artpos, positioningVelocity, PTU_ABSOLUTE_MODE)) {
441 if (0 != ptu.getCurrentPosition(artpos)) {
484 TPtuFrame ptuFrameInterface;
488 "use setRobotState(vpRobot::STATE_VELOCITY_CONTROL) first) ");
490 "Cannot send a velocity to the robot " 491 "use setRobotState(vpRobot::STATE_VELOCITY_CONTROL) first) ");
496 ptuFrameInterface = PTU_CAMERA_FRAME;
498 vpERROR_TRACE(
"Bad dimension fo speed vector in camera frame");
505 ptuFrameInterface = PTU_ARTICULAR_FRAME;
508 "in articular frame");
514 "in the reference frame:" 515 "functionality not implemented");
520 "functionality not implemented");
524 "in the end-effector frame:" 525 "functionality not implemented");
533 double ptuSpeedInterface[2];
540 for (
unsigned int i = 0; i < 2; ++i)
542 if (fabs(v[i]) > max) {
553 for (
unsigned int i = 0; i < 2; ++i)
554 ptuSpeedInterface[i] = v[i] * max;
563 vpCDEBUG(12) <<
"v: " << ptuSpeedInterface[0] <<
" " << ptuSpeedInterface[1] << std::endl;
564 ptu.move(ptuSpeedInterface, ptuFrameInterface);
589 TPtuFrame ptuFrameInterface = PTU_ARTICULAR_FRAME;
594 "functionality not implemented");
597 ptuFrameInterface = PTU_ARTICULAR_FRAME;
602 "functionality not implemented");
606 "functionality not implemented");
610 "functionality not implemented");
615 double ptuSpeedInterface[2];
617 ptu.getCurrentSpeed(ptuSpeedInterface, ptuFrameInterface);
619 q_dot[0] = ptuSpeedInterface[0];
620 q_dot[1] = ptuSpeedInterface[1];
663 std::ifstream fd(filename.c_str(), std::ios::in);
670 std::string key(
"R:");
671 std::string id(
"#PTU-EVI - Position");
672 bool pos_found =
false;
677 while (std::getline(fd, line)) {
680 if (!(line.compare(0,
id.size(), id) == 0)) {
681 std::cout <<
"Error: this position file " << filename <<
" is not for Ptu-46 robot" << std::endl;
685 if ((line.compare(0, 1,
"#") == 0)) {
688 if ((line.compare(0, key.size(), key) == 0)) {
696 std::istringstream ss(line);
712 std::cout <<
"Error: unable to find a position for Ptu-46 robot in " << filename << std::endl;
745 ptu.measureDpl(d_, PTU_CAMERA_FRAME);
755 ptu.measureDpl(d_, PTU_ARTICULAR_FRAME);
763 "functionality not implemented");
767 "functionality not implemented");
771 "functionality not implemented");
776 #elif !defined(VISP_BUILD_SHARED_LIBS) 779 void dummy_vpRobotPtu46(){};
Implementation of a matrix and operations on matrices.
void get_fJe(const vpColVector &q, vpMatrix &fJe) const
Error that can be emited by the vpRobot class and its derivates.
void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q)
void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &q_dot)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void get_cMe(vpHomogeneousMatrix &_cMe) const
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &q_dot)
static const double defaultPositioningVelocity
void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q)
double maxRotationVelocity
Initialize the position controller.
void getDisplacement(vpRobot::vpControlFrameType frame, vpColVector &q)
Class that defines a generic virtual robot.
void get_fJe(vpMatrix &_fJe)
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
vpRobot::vpRobotStateType setRobotState(vpRobot::vpRobotStateType newState)
void get_cMe(vpHomogeneousMatrix &_cMe) const
Initialize the velocity controller.
static const unsigned int ndof
virtual ~vpRobotPtu46(void)
vpVelocityTwistMatrix buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
unsigned int getRows() const
void get_eJe(vpMatrix &_eJe)
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
void get_cVe(vpVelocityTwistMatrix &_cVe) const
double getPositioningVelocity(void)
vpMatrix eJe
robot Jacobian expressed in the end-effector frame
Implementation of column vector and the associated operations.
virtual vpRobotStateType getRobotState(void) const
bool readPositionFile(const std::string &filename, vpColVector &q)
vpMatrix fJe
robot Jacobian expressed in the robot reference frame available
void setPositioningVelocity(const double velocity)
void resize(const unsigned int i, const bool flagNullify=true)