Visual Servoing Platform  version 3.5.1 under development (2023-03-14)
vpRobotViper650.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Interface for the Irisa's Viper S650 robot controlled by an Adept
33  *MotionBlox.
34  *
35  * Authors:
36  * Fabien Spindler
37  *
38  *****************************************************************************/
39 
40 #ifndef vpRobotViper650_h
41 #define vpRobotViper650_h
42 
43 #include <visp3/core/vpConfig.h>
44 
45 #ifdef VISP_HAVE_VIPER650
46 
47 #include <iostream>
48 #include <stdio.h>
49 
50 #include <visp3/core/vpColVector.h>
51 #include <visp3/core/vpDebug.h>
52 #include <visp3/robot/vpRobot.h>
53 #include <visp3/robot/vpViper650.h>
54 
55 // low level controller api
56 extern "C" {
57 #include "irisa_Viper650.h"
58 #include "trycatch.h"
59 }
60 
337 class VISP_EXPORT vpRobotViper650 : public vpViper650, public vpRobot
338 {
339 
340 public: /* Constantes */
342  typedef enum {
344  MANUAL,
346  ESTOP
347  } vpControlModeType;
348 
349  /* Max velocity used during robot control in position.
350  * this value could be changed using setPositioningVelocity().
351  */
352  static const double m_defaultPositioningVelocity; // = 20.0;
353 
354 private: /* Not allowed functions. */
358  vpRobotViper650(const vpRobotViper650 &robot);
359 
360 private: /* Attributs prives. */
370  static bool m_robotAlreadyCreated;
371 
372  double m_positioningVelocity;
373 
374  // Variables used to compute the measured velocities (see getVelocity() )
375  vpColVector m_q_prev_getvel;
376  vpHomogeneousMatrix m_fMc_prev_getvel;
377  vpHomogeneousMatrix m_fMe_prev_getvel;
378  double m_time_prev_getvel;
379  bool m_first_time_getvel;
380 
381  // Variables used to compute the measured displacement (see getDisplacement() )
382  vpColVector m_q_prev_getdis;
383  bool m_first_time_getdis;
384  vpControlModeType m_controlMode;
385 
386 public: /* Methode publiques */
387  explicit vpRobotViper650(bool verbose = true);
388  virtual ~vpRobotViper650(void);
389 
390  // Force/Torque control
391  void biasForceTorqueSensor() const;
392 
393  void closeGripper() const;
394 
395  void disableJoint6Limits() const;
396  void enableJoint6Limits() const;
397 
402  vpControlModeType getControlMode() const { return m_controlMode; }
403 
404  void getDisplacement(vpRobot::vpControlFrameType frame, vpColVector &displacement);
405  void getForceTorque(vpColVector &H) const;
406  vpColVector getForceTorque() const;
407 
408  double getMaxRotationVelocityJoint6() const;
409 
410  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position);
411  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position, double &timestamp);
412  void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position);
413  void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position, double &timestamp);
414 
415  double getPositioningVelocity(void) const;
416  bool getPowerState() const;
417 
418  double getTime() const;
419  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity);
420  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity, double &timestamp);
421 
422  vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
423  vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
424 
425  void get_cMe(vpHomogeneousMatrix &cMe) const;
426  void get_cVe(vpVelocityTwistMatrix &cVe) const;
427  void get_eJe(vpMatrix &eJe);
428  void get_fJe(vpMatrix &fJe);
429 
430  void init(void);
431  void
434  void init(vpViper650::vpToolType tool, const std::string &filename);
435  void init(vpViper650::vpToolType tool, const vpHomogeneousMatrix &eMc_);
436 
437  void move(const std::string &filename);
438 
439  void openGripper();
440 
441  void powerOn();
442  void powerOff();
443 
444  static bool readPosFile(const std::string &filename, vpColVector &q);
445  static bool savePosFile(const std::string &filename, const vpColVector &q);
446 
447  void set_eMc(const vpHomogeneousMatrix &eMc_);
448  void set_eMc(const vpTranslationVector &etc_, const vpRxyzVector &erc_);
449 
450  void setMaxRotationVelocity(double w_max);
451  void setMaxRotationVelocityJoint6(double w6_max);
452 
453  // Position control
454  void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &position);
455  void setPosition(const vpRobot::vpControlFrameType frame, double pos1, double pos2, double pos3, double pos4,
456  double pos5, double pos6);
457  void setPosition(const std::string &filename);
458  void setPositioningVelocity(double velocity);
459 
460  // State
462  // Velocity control
463  void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity);
464 
465  void stopMotion();
466 
467 private:
468  double m_maxRotationVelocity_joint6;
469 };
470 
471 #endif
472 #endif /* #ifndef vpRobotViper650_h */
Implementation of column vector and the associated operations.
Definition: vpColVector.h:131
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:154
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:152
Control of Irisa's Viper S650 robot named Viper650.
static const double m_defaultPositioningVelocity
@ AUTO
Automatic control mode (default).
vpControlModeType getControlMode() const
Class that defines a generic virtual robot.
Definition: vpRobot.h:60
vpControlFrameType
Definition: vpRobot.h:76
virtual void get_eJe(vpMatrix &_eJe)=0
Get the robot Jacobian expressed in the end-effector frame.
virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)=0
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position)=0
Get the robot position (frame has to be specified).
vpRobotStateType
Definition: vpRobot.h:65
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:201
virtual void init()=0
virtual void get_fJe(vpMatrix &_fJe)=0
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
void setMaxRotationVelocity(double maxVr)
Definition: vpRobot.cpp:260
virtual void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q)=0
Set a displacement (frame has to be specified) in position control.
Implementation of a rotation vector as Euler angle minimal representation.
Definition: vpRxyzVector.h:184
Class that consider the case of a translation vector.
Modelisation of the ADEPT Viper 650 robot.
Definition: vpViper650.h:103
vpToolType
List of possible tools that can be attached to the robot end-effector.
Definition: vpViper650.h:127
virtual void set_eMc(const vpHomogeneousMatrix &eMc_)
Definition: vpViper.cpp:1230
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpViper.cpp:922
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpViper.cpp:938