Visual Servoing Platform  version 3.1.0
vpRobot.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 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  * Generic virtual robot.
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
39 #ifndef vpRobot_H
40 #define vpRobot_H
41 
47 #include <visp3/core/vpColVector.h>
48 #include <visp3/core/vpHomogeneousMatrix.h>
49 #include <visp3/core/vpMatrix.h>
50 #include <visp3/core/vpPoseVector.h>
51 
58 class VISP_EXPORT vpRobot
59 {
60 public:
64  typedef enum {
65  STATE_STOP,
69  STATE_ACCELERATION_CONTROL
71 
75  typedef enum {
76  REFERENCE_FRAME,
79  CAMERA_FRAME,
81  MIXT_FRAME
85 
86 private: /* Membres privees */
87  vpRobot::vpRobotStateType stateRobot;
88  vpRobot::vpControlFrameType frameRobot;
89 
90 protected:
92  static const double maxTranslationVelocityDefault; // = 0.2;
94  static const double maxRotationVelocityDefault; // = 0.7;
95 
97  int nDof;
106 
108  double *qmin;
109  double *qmax;
110 
111  bool verbose_;
112 
113 public:
114  vpRobot(void);
115  vpRobot(const vpRobot &robot);
116  virtual ~vpRobot();
117 
120 
121  //---------- Jacobian -----------------------------
123  virtual void get_eJe(vpMatrix &_eJe) = 0;
126  virtual void get_fJe(vpMatrix &_fJe) = 0;
127 
130  virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q) = 0;
131 
132  double getMaxTranslationVelocity(void) const;
133  double getMaxRotationVelocity(void) const;
135  virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q) = 0;
136 
137  // Return the robot position (frame has to be specified).
138  vpColVector getPosition(const vpRobot::vpControlFrameType frame);
139  virtual vpRobotStateType getRobotState(void) const { return stateRobot; }
140 
141  virtual void init() = 0;
142 
143  vpRobot &operator=(const vpRobot &robot);
144 
145  void setMaxRotationVelocity(const double maxVr);
146  void setMaxTranslationVelocity(const double maxVt);
148  virtual void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q) = 0;
149  virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState);
150 
153  virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) = 0;
154  inline void setVerbose(bool verbose) { verbose_ = verbose; };
155 
157 
160  static vpColVector saturateVelocities(const vpColVector &v_in, const vpColVector &v_max, bool verbose = false);
162 
163 protected:
166  vpControlFrameType setRobotFrame(vpRobot::vpControlFrameType newFrame);
167  vpControlFrameType getRobotFrame(void) const { return frameRobot; }
169 };
170 
171 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
double maxTranslationVelocity
Definition: vpRobot.h:91
void setVerbose(bool verbose)
Definition: vpRobot.h:154
double * qmax
Definition: vpRobot.h:109
double maxRotationVelocity
Definition: vpRobot.h:93
Initialize the position controller.
Definition: vpRobot.h:68
Class that defines a generic virtual robot.
Definition: vpRobot.h:58
vpControlFrameType
Definition: vpRobot.h:75
int eJeAvailable
is the robot Jacobian expressed in the end-effector frame available
Definition: vpRobot.h:101
static const double maxTranslationVelocityDefault
Definition: vpRobot.h:92
Initialize the velocity controller.
Definition: vpRobot.h:67
virtual vpRobotStateType getRobotState(void) const
Definition: vpRobot.h:139
vpRobotStateType
Definition: vpRobot.h:64
bool verbose_
Definition: vpRobot.h:111
static const double maxRotationVelocityDefault
Definition: vpRobot.h:94
int areJointLimitsAvailable
Definition: vpRobot.h:107
int nDof
number of degrees of freedom
Definition: vpRobot.h:97
vpMatrix eJe
robot Jacobian expressed in the end-effector frame
Definition: vpRobot.h:99
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
double * qmin
Definition: vpRobot.h:108
vpControlFrameType getRobotFrame(void) const
Definition: vpRobot.h:167
int fJeAvailable
is the robot Jacobian expressed in the robot reference frame available
Definition: vpRobot.h:105
vpMatrix fJe
robot Jacobian expressed in the robot reference frame available
Definition: vpRobot.h:103