Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpRobotViper650.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Interface for the Irisa's Viper S650 robot controlled by an Adept MotionBlox.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 
38 #ifndef vpRobotViper650_h
39 #define vpRobotViper650_h
40 
41 #include <visp3/core/vpConfig.h>
42 
43 #ifdef VISP_HAVE_VIPER650
44 
45 #include <iostream>
46 #include <stdio.h>
47 
48 #include <visp3/robot/vpRobot.h>
49 #include <visp3/core/vpColVector.h>
50 #include <visp3/core/vpDebug.h>
51 #include <visp3/robot/vpViper650.h>
52 
53 // low level controller api
54 extern "C" {
55 # include "irisa_Viper650.h"
56 # include "trycatch.h"
57 }
58 
59 
336 class VISP_EXPORT vpRobotViper650
337  :
338  public vpViper650,
339  public vpRobot
340 {
341 
342 public: /* Constantes */
343 
345  typedef enum {
348  ESTOP
349  } vpControlModeType;
350 
351  /* Vitesse maximale par default lors du positionnement du robot.
352  * C'est la valeur a la construction de l'attribut prive \a
353  * positioningVelocity. Cette valeur peut etre changee par la fonction
354  * #setPositioningVelocity.
355  */
356  static const double defaultPositioningVelocity; // = 20.0;
357 
358 private: /* Not allowed functions. */
359 
363  vpRobotViper650 (const vpRobotViper650 & robot);
364 
365 private: /* Attributs prives. */
366 
376  static bool robotAlreadyCreated;
377 
378  double positioningVelocity;
379 
380  // Variables used to compute the measured velocities (see getVelocity() )
381  vpColVector q_prev_getvel;
382  vpHomogeneousMatrix fMc_prev_getvel;
383  double time_prev_getvel;
384  bool first_time_getvel;
385 
386  // Variables used to compute the measured displacement (see
387  // getDisplacement() )
388  vpColVector q_prev_getdis;
389  bool first_time_getdis;
390  vpControlModeType controlMode;
391 
392 
393 public: /* Methode publiques */
394 
395  vpRobotViper650 (bool verbose=true);
396  virtual ~vpRobotViper650 (void);
397 
398  // Force/Torque control
399  void biasForceTorqueSensor() const;
400 
401  void closeGripper() const;
402 
403  void disableJoint6Limits() const;
404  void enableJoint6Limits() const;
405 
411  return controlMode;
412  }
413 
415  vpColVector &displacement);
416  void getForceTorque(vpColVector &H) const;
417  vpColVector getForceTorque() const;
418 
419  double getMaxRotationVelocityJoint6() const;
420 
421  void getPosition (const vpRobot::vpControlFrameType frame,
422  vpColVector &position);
423  void getPosition (const vpRobot::vpControlFrameType frame,
424  vpColVector &position,
425  double &timestamp);
426  void getPosition (const vpRobot::vpControlFrameType frame,
427  vpPoseVector &position);
428  void getPosition (const vpRobot::vpControlFrameType frame,
429  vpPoseVector &position,
430  double &timestamp);
431 
432  double getPositioningVelocity (void) const;
433  bool getPowerState() const;
434 
435  double getTime () const;
436  void getVelocity (const vpRobot::vpControlFrameType frame,
437  vpColVector & velocity);
438  void getVelocity (const vpRobot::vpControlFrameType frame,
439  vpColVector & velocity, double &timestamp);
440 
441  vpColVector getVelocity (const vpRobot::vpControlFrameType frame);
442  vpColVector getVelocity (const vpRobot::vpControlFrameType frame, double &timestamp);
443 
444  void get_cMe(vpHomogeneousMatrix &cMe) const;
445  void get_cVe(vpVelocityTwistMatrix &cVe) const;
446  void get_eJe(vpMatrix &eJe);
447  void get_fJe(vpMatrix &fJe);
448 
449  void init(void);
450  void init(vpViper650::vpToolType tool,
453  void init(vpViper650::vpToolType tool, const std::string &filename);
454  void init(vpViper650::vpToolType tool, const vpHomogeneousMatrix &eMc_);
455 
456 
457  void move(const std::string &filename);
458 
459  void openGripper();
460 
461  void powerOn();
462  void powerOff();
463 
464  static bool readPosFile(const std::string &filename, vpColVector &q);
465  static bool savePosFile(const std::string &filename, const vpColVector &q);
466 
467  void set_eMc(const vpHomogeneousMatrix &eMc_);
468  void set_eMc(const vpTranslationVector &etc_, const vpRxyzVector &erc_);
469 
470  void setMaxRotationVelocity(double w_max);
471  void setMaxRotationVelocityJoint6(double w6_max);
472 
473  // Position control
474  void setPosition(const vpRobot::vpControlFrameType frame,
475  const vpColVector &position) ;
476  void setPosition (const vpRobot::vpControlFrameType frame,
477  const double pos1, const double pos2, const double pos3,
478  const double pos4, const double pos5, const double pos6) ;
479  void setPosition(const std::string &filename) ;
480  void setPositioningVelocity (const double velocity);
481 
482  // State
484  // Velocity control
485  void setVelocity (const vpRobot::vpControlFrameType frame,
486  const vpColVector & velocity);
487 
488  void stopMotion();
489 
490 private:
491  void getArticularDisplacement(vpColVector &displacement);
492  void getCameraDisplacement(vpColVector &displacement);
493  double maxRotationVelocity_joint6;
494 };
495 
496 #endif
497 #endif /* #ifndef vpRobotViper650_h */
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpViper.cpp:969
static const double defaultPositioningVelocity
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:97
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get a displacement (frame as to ve specified) between two successive position control.
Perspective projection without distortion model.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Control of Irisa's Viper S650 robot named Viper650.
virtual void get_eJe(vpMatrix &_eJe)=0
Get the robot Jacobian expressed in the end-effector frame.
virtual void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q)=0
Set a displacement (frame has to be specified) in position control.
Class that defines a generic virtual robot.
Definition: vpRobot.h:58
Automatic control mode (default).
vpControlFrameType
Definition: vpRobot.h:76
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:201
vpRobotStateType
Definition: vpRobot.h:64
virtual void set_eMc(const vpHomogeneousMatrix &eMc_)
Definition: vpViper.cpp:1279
virtual void init()=0
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get the robot position (frame has to be specified).
virtual void get_fJe(vpMatrix &_fJe)=0
Get the robot Jacobian expressed in the robot reference (or world) frame.
Modelisation of the ADEPT Viper 650 robot.
Definition: vpViper650.h:102
Manual control mode activated when the dead man switch is in use.
Implementation of a velocity twist matrix and operations on such kind of matrices.
vpToolType
List of possible tools that can be attached to the robot end-effector.
Definition: vpViper650.h:127
void setMaxRotationVelocity(const double maxVr)
Definition: vpRobot.cpp:262
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpViper.cpp:948
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:93
Implementation of a rotation vector as Euler angle minimal representation.
Definition: vpRxyzVector.h:154
vpControlModeType getControlMode() const
virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)=0
Set the velocity (frame has to be specified) that will be applied to the velocity controller...
Class that consider the case of a translation vector.