ViSP  2.9.0
vpRobotViper850.h
1 /****************************************************************************
2  *
3  * $Id: vpRobotViper850.h 4594 2014-01-20 15:08:07Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Interface for the Irisa's Viper S850 robot controlled by an Adept MotionBlox.
36  *
37  * Authors:
38  * Fabien Spindler
39  *
40  *****************************************************************************/
41 
42 #ifndef vpRobotViper850_h
43 #define vpRobotViper850_h
44 
45 #include <visp/vpConfig.h>
46 
47 #ifdef VISP_HAVE_VIPER850
48 
49 #include <iostream>
50 #include <stdio.h>
51 
52 #include <visp/vpRobot.h>
53 #include <visp/vpColVector.h>
54 #include <visp/vpDebug.h>
55 #include <visp/vpViper850.h>
56 
57 // low level controller api
58 extern "C" {
59 # include "irisa_Viper850.h"
60 # include "trycatch.h"
61 }
62 
63 
276 class VISP_EXPORT vpRobotViper850
277  :
278  public vpViper850,
279  public vpRobot
280 {
281 
282 public: /* Constantes */
283 
285  typedef enum {
288  ESTOP
289  } vpControlModeType;
290 
291  /* Vitesse maximale par default lors du positionnement du robot.
292  * C'est la valeur a la construction de l'attribut prive \a
293  * positioningVelocity. Cette valeur peut etre changee par la fonction
294  * #setPositioningVelocity.
295  */
296  static const double defaultPositioningVelocity; // = 20.0;
297 
298 private: /* Not allowed functions. */
299 
303  vpRobotViper850 (const vpRobotViper850 & robot);
304 
305 private: /* Attributs prives. */
306 
316  static bool robotAlreadyCreated;
317 
318  double positioningVelocity;
319 
320  // Variables used to compute the measured velocities (see getVelocity() )
321  vpColVector q_prev_getvel;
322  vpHomogeneousMatrix fMc_prev_getvel;
323  double time_prev_getvel;
324  bool first_time_getvel;
325 
326  // Variables used to compute the measured displacement (see
327  // getDisplacement() )
328  vpColVector q_prev_getdis;
329  bool first_time_getdis;
330  vpControlModeType controlMode;
331 
332 
333 public: /* Methode publiques */
334 
335  vpRobotViper850 (bool verbose=true);
336  virtual ~vpRobotViper850 (void);
337 
338  // Force/Torque control
339  void biasForceTorqueSensor() const;
340 
341  void closeGripper() const;
342 
343  void disableJoint6Limits() const;
344  void enableJoint6Limits() const;
345 
347  vpColVector &displacement);
353  return controlMode;
354  }
355 
356  void getForceTorque(vpColVector &H) const;
357 
358  double getMaxRotationVelocityJoint6() const;
359  void getPosition (const vpRobot::vpControlFrameType frame,
360  vpColVector &position);
361  void getPosition (const vpRobot::vpControlFrameType frame,
362  vpColVector &position, double &timestamp);
363  void getPosition (const vpRobot::vpControlFrameType frame,
364  vpPoseVector &position);
365  void getPosition (const vpRobot::vpControlFrameType frame,
366  vpPoseVector &position, double &timestamp);
367 
368  double getPositioningVelocity (void) const;
369  bool getPowerState() const;
370 
371  void getVelocity (const vpRobot::vpControlFrameType frame,
372  vpColVector & velocity);
373  void getVelocity (const vpRobot::vpControlFrameType frame,
374  vpColVector & velocity, double &timestamp);
375 
376  vpColVector getVelocity (const vpRobot::vpControlFrameType frame);
377  vpColVector getVelocity (const vpRobot::vpControlFrameType frame, double &timestamp);
378 
379  double getTime() const;
380 
381  void get_cMe(vpHomogeneousMatrix &cMe) const;
382  void get_cVe(vpVelocityTwistMatrix &cVe) const;
383  void get_eJe(vpMatrix &eJe);
384  void get_fJe(vpMatrix &fJe);
385 
386  void init (void);
387  void init (vpViper850::vpToolType tool,
390 
391  void move(const char *filename) ;
392 
393  void openGripper();
394 
395  void powerOn() ;
396  void powerOff() ;
397 
398  static bool readPosFile(const char *filename, vpColVector &q) ;
399  static bool savePosFile(const char *filename, const vpColVector &q) ;
400 
401  void setMaxRotationVelocity(double w_max);
402  void setMaxRotationVelocityJoint6(double w6_max);
403 
404  // Position control
405  void setPosition(const vpRobot::vpControlFrameType frame,
406  const vpColVector &position) ;
407  void setPosition (const vpRobot::vpControlFrameType frame,
408  const double pos1, const double pos2, const double pos3,
409  const double pos4, const double pos5, const double pos6) ;
410  void setPosition(const char *filename) ;
411  void setPositioningVelocity (const double velocity);
412 
413  // State
415 
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 
426  double maxRotationVelocity_joint6;
427 };
428 
429 
430 
431 
432 
433 /*
434  * Local variables:
435  * c-basic-offset: 2
436  * End:
437  */
438 
439 #endif
440 #endif /* #ifndef vpRobotViper850_h */
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpViper.cpp:952
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
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.
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Control of Irisa's Viper S850 robot named Viper850.
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:60
vpControlFrameType
Definition: vpRobot.h:78
vpControlModeType getControlMode() const
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:190
vpRobotStateType
Definition: vpRobot.h:66
virtual void init()=0
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get the robot position (frame has to be specified).
vpToolType
List of possible tools that can be attached to the robot end-effector.
Definition: vpViper850.h:91
virtual void get_fJe(vpMatrix &_fJe)=0
Get the robot Jacobian expressed in the robot reference (or world) frame.
Modelisation of the ADEPT Viper 850 robot.
Definition: vpViper850.h:66
Class that consider the particular case of twist transformation matrix that allows to transform a vel...
void setMaxRotationVelocity(const double maxVr)
Definition: vpRobot.cpp:251
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpViper.cpp:931
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
Manual control mode activated when the dead man switch is in use.
static const double defaultPositioningVelocity
The pose is a complete representation of every rigid motion in the euclidian space.
Definition: vpPoseVector.h:92
Automatic control mode (default).
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...