Visual Servoing Platform  version 3.0.0
vpRobotViper650.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 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 
272 class VISP_EXPORT vpRobotViper650
273  :
274  public vpViper650,
275  public vpRobot
276 {
277 
278 public: /* Constantes */
279 
281  typedef enum {
284  ESTOP
285  } vpControlModeType;
286 
287  /* Vitesse maximale par default lors du positionnement du robot.
288  * C'est la valeur a la construction de l'attribut prive \a
289  * positioningVelocity. Cette valeur peut etre changee par la fonction
290  * #setPositioningVelocity.
291  */
292  static const double defaultPositioningVelocity; // = 20.0;
293 
294 private: /* Not allowed functions. */
295 
299  vpRobotViper650 (const vpRobotViper650 & robot);
300 
301 private: /* Attributs prives. */
302 
312  static bool robotAlreadyCreated;
313 
314  double positioningVelocity;
315 
316  // Variables used to compute the measured velocities (see getVelocity() )
317  vpColVector q_prev_getvel;
318  vpHomogeneousMatrix fMc_prev_getvel;
319  double time_prev_getvel;
320  bool first_time_getvel;
321 
322  // Variables used to compute the measured displacement (see
323  // getDisplacement() )
324  vpColVector q_prev_getdis;
325  bool first_time_getdis;
326  vpControlModeType controlMode;
327 
328 
329 public: /* Methode publiques */
330 
331  vpRobotViper650 (bool verbose=true);
332  virtual ~vpRobotViper650 (void);
333 
334  // Force/Torque control
335  void biasForceTorqueSensor() const;
336 
337  void disableJoint6Limits() const;
338  void enableJoint6Limits() const;
339 
345  return controlMode;
346  }
347 
349  vpColVector &displacement);
350  void getForceTorque(vpColVector &H) const;
351 
352  double getMaxRotationVelocityJoint6() const;
353 
354  void getPosition (const vpRobot::vpControlFrameType frame,
355  vpColVector &position);
356  void getPosition (const vpRobot::vpControlFrameType frame,
357  vpColVector &position,
358  double &timestamp);
359  void getPosition (const vpRobot::vpControlFrameType frame,
360  vpPoseVector &position);
361  void getPosition (const vpRobot::vpControlFrameType frame,
362  vpPoseVector &position,
363  double &timestamp);
364 
365  double getPositioningVelocity (void) const;
366  bool getPowerState() const;
367 
368  double getTime () const;
369  void getVelocity (const vpRobot::vpControlFrameType frame,
370  vpColVector & velocity);
371  void getVelocity (const vpRobot::vpControlFrameType frame,
372  vpColVector & velocity, double &timestamp);
373 
374  vpColVector getVelocity (const vpRobot::vpControlFrameType frame);
375  vpColVector getVelocity (const vpRobot::vpControlFrameType frame, double &timestamp);
376 
377  void get_cMe(vpHomogeneousMatrix &cMe) const;
378  void get_cVe(vpVelocityTwistMatrix &cVe) const;
379  void get_eJe(vpMatrix &eJe);
380  void get_fJe(vpMatrix &fJe);
381 
382  void init (void);
383  void init (vpViper650::vpToolType tool,
386  void init (vpViper650::vpToolType tool,
387  const std::string &filename);
388  void init (vpViper650::vpToolType tool,
389  const vpHomogeneousMatrix &eMc_);
390 
391  void set_eMc(const vpHomogeneousMatrix &eMc_);
392  void set_eMc(const vpTranslationVector &etc_, const vpRxyzVector &erc_);
393 
394  void move(const char *filename);
395 
396  void powerOn();
397  void powerOff();
398 
399  static bool readPosFile(const char *filename, vpColVector &q);
400  static bool savePosFile(const char *filename, const vpColVector &q);
401 
402  void setMaxRotationVelocity(double w_max);
403  void setMaxRotationVelocityJoint6(double w6_max);
404 
405  // Position control
406  void setPosition(const vpRobot::vpControlFrameType frame,
407  const vpColVector &position) ;
408  void setPosition (const vpRobot::vpControlFrameType frame,
409  const double pos1, const double pos2, const double pos3,
410  const double pos4, const double pos5, const double pos6) ;
411  void setPosition(const char *filename) ;
412  void setPositioningVelocity (const double velocity);
413 
414  // State
416  // Velocity control
417  void setVelocity (const vpRobot::vpControlFrameType frame,
418  const vpColVector & velocity);
419 
420  void stopMotion();
421 
422 private:
423  void getArticularDisplacement(vpColVector &displacement);
424  void getCameraDisplacement(vpColVector &displacement);
425  double maxRotationVelocity_joint6;
426 };
427 
428 #endif
429 #endif /* #ifndef vpRobotViper650_h */
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpViper.cpp:948
static const double defaultPositioningVelocity
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:92
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:1258
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:62
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:87
void setMaxRotationVelocity(const double maxVr)
Definition: vpRobot.cpp:262
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpViper.cpp:927
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.