Visual Servoing Platform  version 3.0.0
vpRobotViper850.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 S850 robot controlled by an Adept MotionBlox.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 
38 #ifndef vpRobotViper850_h
39 #define vpRobotViper850_h
40 
41 #include <visp3/core/vpConfig.h>
42 
43 #ifdef VISP_HAVE_VIPER850
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/vpViper850.h>
52 
53 // low level controller api
54 extern "C" {
55 # include "irisa_Viper850.h"
56 # include "trycatch.h"
57 }
58 
59 
272 class VISP_EXPORT vpRobotViper850
273  :
274  public vpViper850,
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  vpRobotViper850 (const vpRobotViper850 & 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  vpRobotViper850 (bool verbose=true);
332  virtual ~vpRobotViper850 (void);
333 
334  // Force/Torque control
335  void biasForceTorqueSensor() const;
336 
337  void closeGripper() const;
338 
339  void disableJoint6Limits() const;
340  void enableJoint6Limits() const;
341 
343  vpColVector &displacement);
349  return controlMode;
350  }
351 
352  void getForceTorque(vpColVector &H) const;
353 
354  double getMaxRotationVelocityJoint6() const;
355  void getPosition (const vpRobot::vpControlFrameType frame,
356  vpColVector &position);
357  void getPosition (const vpRobot::vpControlFrameType frame,
358  vpColVector &position, double &timestamp);
359  void getPosition (const vpRobot::vpControlFrameType frame,
360  vpPoseVector &position);
361  void getPosition (const vpRobot::vpControlFrameType frame,
362  vpPoseVector &position, double &timestamp);
363 
364  double getPositioningVelocity (void) const;
365  bool getPowerState() const;
366 
367  void getVelocity (const vpRobot::vpControlFrameType frame,
368  vpColVector & velocity);
369  void getVelocity (const vpRobot::vpControlFrameType frame,
370  vpColVector & velocity, double &timestamp);
371 
372  vpColVector getVelocity (const vpRobot::vpControlFrameType frame);
373  vpColVector getVelocity (const vpRobot::vpControlFrameType frame, double &timestamp);
374 
375  double getTime() const;
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 (vpViper850::vpToolType tool,
386 
387  void move(const char *filename) ;
388 
389  void openGripper();
390 
391  void powerOn() ;
392  void powerOff() ;
393 
394  static bool readPosFile(const char *filename, vpColVector &q) ;
395  static bool savePosFile(const char *filename, const vpColVector &q) ;
396 
397  void setMaxRotationVelocity(double w_max);
398  void setMaxRotationVelocityJoint6(double w6_max);
399 
400  // Position control
401  void setPosition(const vpRobot::vpControlFrameType frame,
402  const vpColVector &position) ;
403  void setPosition (const vpRobot::vpControlFrameType frame,
404  const double pos1, const double pos2, const double pos3,
405  const double pos4, const double pos5, const double pos6) ;
406  void setPosition(const char *filename) ;
407  void setPositioningVelocity (const double velocity);
408 
409  // State
411 
412  // Velocity control
413  void setVelocity (const vpRobot::vpControlFrameType frame,
414  const vpColVector & velocity);
415 
416  void stopMotion() ;
417 
418 private:
419  void getArticularDisplacement(vpColVector &displacement);
420  void getCameraDisplacement(vpColVector &displacement);
421 
422  double maxRotationVelocity_joint6;
423 };
424 
425 
426 
427 
428 
429 /*
430  * Local variables:
431  * c-basic-offset: 2
432  * End:
433  */
434 
435 #endif
436 #endif /* #ifndef vpRobotViper850_h */
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpViper.cpp:948
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 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:58
vpControlFrameType
Definition: vpRobot.h:76
vpControlModeType getControlMode() const
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:201
vpRobotStateType
Definition: vpRobot.h:64
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:87
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:62
Implementation of a velocity twist matrix and operations on such kind of matrices.
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
Manual control mode activated when the dead man switch is in use.
static const double defaultPositioningVelocity
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:93
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...