Visual Servoing Platform  version 3.0.0
vpRobotAfma4.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 Afma4 robot.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 
38 #ifndef vpRobotAfma4_h
39 #define vpRobotAfma4_h
40 
41 #include <visp3/core/vpConfig.h>
42 
43 #ifdef VISP_HAVE_AFMA4
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/vpAfma4.h>
52 
53 // low level controller api
54 extern "C" {
55 # include "irisa_Afma4.h"
56 # include "trycatch.h"
57 }
58 
59 
177 class VISP_EXPORT vpRobotAfma4
178  :
179  public vpAfma4,
180  public vpRobot
181 {
182 
183 private: /* Not allowed functions. */
184 
188  vpRobotAfma4 (const vpRobotAfma4 & robot);
189 
190 private: /* Attributs prives. */
191 
201  static bool robotAlreadyCreated;
202 
203  double positioningVelocity;
204 
205  // Variables used to compute the measured velocities (see getVelocity() )
206  vpColVector q_prev_getvel;
207  vpHomogeneousMatrix fMc_prev_getvel;
208  double time_prev_getvel;
209  bool first_time_getvel;
210 
211  // Variables used to compute the measured displacement (see
212  // getDisplacement() )
213  vpColVector q_prev_getdis;
214  bool first_time_getdis;
215 
216 public: /* Constantes */
217 
218  /* Vitesse maximale par default lors du positionnement du robot.
219  * C'est la valeur a la construction de l'attribut prive \a
220  * positioningVelocity. Cette valeur peut etre changee par la fonction
221  * #setPositioningVelocity.
222  */
223  static const double defaultPositioningVelocity; // = 20.0;
224 
225 public: /* Methode publiques */
226 
227  vpRobotAfma4 (bool verbose=true);
228  virtual ~vpRobotAfma4 (void);
229 
231  vpColVector &displacement);
232  void getPosition (const vpRobot::vpControlFrameType frame,
233  vpColVector &position);
234  void getPosition (const vpRobot::vpControlFrameType frame,
235  vpColVector &position, double &timestamp);
236 
237  double getPositioningVelocity (void);
238  bool getPowerState();
239 
240  double getTime() const;
241 
242  void getVelocity (const vpRobot::vpControlFrameType frame,
243  vpColVector & velocity);
244  void getVelocity (const vpRobot::vpControlFrameType frame,
245  vpColVector & velocity, double &timestamp);
246 
247  vpColVector getVelocity (const vpRobot::vpControlFrameType frame);
248  vpColVector getVelocity (const vpRobot::vpControlFrameType frame, double &timestamp);
249 
250  void get_cMe(vpHomogeneousMatrix &cMe) const;
251  void get_cVe(vpVelocityTwistMatrix &cVe) const;
252  void get_cVf(vpVelocityTwistMatrix &cVf) const;
253  void get_eJe(vpMatrix &eJe);
254  void get_fJe(vpMatrix &fJe);
255 
256  void init (void);
257 
258  void move(const char *filename) ;
259 
260  void powerOn() ;
261  void powerOff() ;
262 
263  static bool readPosFile(const char *filename, vpColVector &q) ;
264  static bool savePosFile(const char *filename, const vpColVector &q) ;
265 
266  /* --- POSITIONNEMENT --------------------------------------------------- */
267  void setPosition(const vpRobot::vpControlFrameType frame,
268  const vpColVector &position) ;
269  void setPosition (const vpRobot::vpControlFrameType frame,
270  const double q1, const double q2,
271  const double q4, const double q5) ;
272  void setPosition(const char *filename) ;
273  void setPositioningVelocity (const double velocity);
274 
275  /* --- ETAT ------------------------------------------------------------- */
276 
278 
279  /* --- VITESSE ---------------------------------------------------------- */
280 
281  void setVelocity (const vpRobot::vpControlFrameType frame,
282  const vpColVector & velocity);
283 
284  void stopMotion() ;
285 
286 private:
287  void getArticularDisplacement(vpColVector &displacement);
288  void getCameraDisplacement(vpColVector &displacement);
289 };
290 
291 #endif
292 #endif /* #ifndef vpRobotAfma4_h */
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.
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpAfma4.cpp:320
Implementation of an homogeneous matrix and operations on such kind of matrices.
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
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpAfma4.cpp:335
void init(void)
Definition: vpAfma4.cpp:111
void get_cVf(const vpColVector &q, vpVelocityTwistMatrix &cVf) const
Definition: vpAfma4.cpp:364
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:201
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
Definition: vpAfma4.cpp:412
vpRobotStateType
Definition: vpRobot.h:64
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get the robot position (frame has to be specified).
Modelisation of Irisa's cylindrical robot named Afma4.
Definition: vpAfma4.h:108
Implementation of a velocity twist matrix and operations on such kind of matrices.
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Control of Irisa's cylindrical robot named Afma4.
Definition: vpRobotAfma4.h:177
void get_fJe(const vpColVector &q, vpMatrix &fJe) const
Definition: vpAfma4.cpp:466
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:223