ViSP  2.8.0
vpRobotAfma4.h
1 /****************************************************************************
2  *
3  * $Id: vpRobotAfma4.h 4317 2013-07-17 09:40:17Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 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 Afma4 robot.
36  *
37  * Authors:
38  * Fabien Spindler
39  *
40  *****************************************************************************/
41 
42 #ifndef vpRobotAfma4_h
43 #define vpRobotAfma4_h
44 
45 #include <visp/vpConfig.h>
46 
47 #ifdef VISP_HAVE_AFMA4
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/vpAfma4.h>
56 
57 // low level controller api
58 extern "C" {
59 # include "irisa_Afma4.h"
60 # include "trycatch.h"
61 }
62 
63 
181 class VISP_EXPORT vpRobotAfma4
182  :
183  public vpAfma4,
184  public vpRobot
185 {
186 
187 private: /* Not allowed functions. */
188 
192  vpRobotAfma4 (const vpRobotAfma4 & robot);
193 
194 private: /* Attributs prives. */
195 
205  static bool robotAlreadyCreated;
206 
207  double positioningVelocity;
208 
209  // Variables used to compute the measured velocities (see getVelocity() )
210  vpColVector q_prev_getvel;
211  vpHomogeneousMatrix fMc_prev_getvel;
212  double time_prev_getvel;
213  bool first_time_getvel;
214 
215  // Variables used to compute the measured displacement (see
216  // getDisplacement() )
217  vpColVector q_prev_getdis;
218  bool first_time_getdis;
219 
220 public: /* Constantes */
221 
222  /* Vitesse maximale par default lors du positionnement du robot.
223  * C'est la valeur a la construction de l'attribut prive \a
224  * positioningVelocity. Cette valeur peut etre changee par la fonction
225  * #setPositioningVelocity.
226  */
227  static const double defaultPositioningVelocity; // = 20.0;
228 
229 public: /* Methode publiques */
230 
231  vpRobotAfma4 (bool verbose=true);
232  virtual ~vpRobotAfma4 (void);
233 
235  vpColVector &displacement);
236  void getPosition (const vpRobot::vpControlFrameType frame,
237  vpColVector &position);
238  void getPosition (const vpRobot::vpControlFrameType frame,
239  vpColVector &position, double &timestamp);
240 
241  double getPositioningVelocity (void);
242  bool getPowerState();
243 
244  double getTime() const;
245 
246  void getVelocity (const vpRobot::vpControlFrameType frame,
247  vpColVector & velocity);
248  void getVelocity (const vpRobot::vpControlFrameType frame,
249  vpColVector & velocity, double &timestamp);
250 
251  vpColVector getVelocity (const vpRobot::vpControlFrameType frame);
252  vpColVector getVelocity (const vpRobot::vpControlFrameType frame, double &timestamp);
253 
254  void get_cMe(vpHomogeneousMatrix &cMe) ;
255  void get_cVe(vpVelocityTwistMatrix &cVe) ;
256  void get_cVf(vpVelocityTwistMatrix &cVf) ;
257  void get_eJe(vpMatrix &eJe) ;
258  void get_fJe(vpMatrix &fJe) ;
259 
260  void init (void);
261 
262  void move(const char *filename) ;
263 
264  void powerOn() ;
265  void powerOff() ;
266 
267  static bool readPosFile(const char *filename, vpColVector &q) ;
268  static bool savePosFile(const char *filename, const vpColVector &q) ;
269 
270  /* --- POSITIONNEMENT --------------------------------------------------- */
271  void setPosition(const vpRobot::vpControlFrameType frame,
272  const vpColVector &position) ;
273  void setPosition (const vpRobot::vpControlFrameType frame,
274  const double q1, const double q2,
275  const double q4, const double q5) ;
276  void setPosition(const char *filename) ;
277  void setPositioningVelocity (const double velocity);
278 
279  /* --- ETAT ------------------------------------------------------------- */
280 
282 
283  /* --- VITESSE ---------------------------------------------------------- */
284 
285  void setVelocity (const vpRobot::vpControlFrameType frame,
286  const vpColVector & velocity);
287 
288  void stopMotion() ;
289 
290 private:
291  void getArticularDisplacement(vpColVector &displacement);
292  void getCameraDisplacement(vpColVector &displacement);
293 };
294 
295 #endif
296 #endif /* #ifndef vpRobotAfma4_h */
Definition of the vpMatrix class.
Definition: vpMatrix.h:96
void get_eJe(const vpColVector &q, vpMatrix &eJe)
Definition: vpAfma4.cpp:417
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get a displacement (frame as to ve specified) between two successive position control.
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
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
void init(void)
Definition: vpAfma4.cpp:114
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:154
vpRobotStateType
Definition: vpRobot.h:66
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get the robot position (frame has to be specified).
void get_fJe(const vpColVector &q, vpMatrix &fJe)
Definition: vpAfma4.cpp:471
Modelisation of Irisa's cylindrical robot named Afma4.
Definition: vpAfma4.h:112
Class that consider the particular case of twist transformation matrix that allows to transform a vel...
void get_cVe(vpVelocityTwistMatrix &cVe)
Definition: vpAfma4.cpp:338
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
void get_cVf(const vpColVector &q, vpVelocityTwistMatrix &cVf)
Definition: vpAfma4.cpp:367
Control of Irisa's cylindrical robot named Afma4.
Definition: vpRobotAfma4.h:181
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...
static const double defaultPositioningVelocity
Definition: vpRobotAfma4.h:227
void get_cMe(vpHomogeneousMatrix &cMe)
Definition: vpAfma4.cpp:323