Visual Servoing Platform  version 3.1.0
vpRobotAfma4.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  * Interface for the Irisa's Afma4 robot.
33  *
34  * Authors:
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 
39 #ifndef vpRobotAfma4_h
40 #define vpRobotAfma4_h
41 
42 #include <visp3/core/vpConfig.h>
43 
44 #ifdef VISP_HAVE_AFMA4
45 
46 #include <iostream>
47 #include <stdio.h>
48 
49 #include <visp3/core/vpColVector.h>
50 #include <visp3/core/vpDebug.h>
51 #include <visp3/robot/vpAfma4.h>
52 #include <visp3/robot/vpRobot.h>
53 
54 // low level controller api
55 extern "C" {
56 #include "irisa_Afma4.h"
57 #include "trycatch.h"
58 }
59 
177 class VISP_EXPORT vpRobotAfma4 : public vpAfma4, public vpRobot
178 {
179 
180 private: /* Not allowed functions. */
184  vpRobotAfma4(const vpRobotAfma4 &robot);
185 
186 private: /* Attributs prives. */
196  static bool robotAlreadyCreated;
197 
198  double positioningVelocity;
199 
200  // Variables used to compute the measured velocities (see getVelocity() )
201  vpColVector q_prev_getvel;
202  vpHomogeneousMatrix fMc_prev_getvel;
203  double time_prev_getvel;
204  bool first_time_getvel;
205 
206  // Variables used to compute the measured displacement (see
207  // getDisplacement() )
208  vpColVector q_prev_getdis;
209  bool first_time_getdis;
210 
211 public: /* Constantes */
212  /* Vitesse maximale par default lors du positionnement du robot.
213  * C'est la valeur a la construction de l'attribut prive \a
214  * positioningVelocity. Cette valeur peut etre changee par la fonction
215  * #setPositioningVelocity.
216  */
217  static const double defaultPositioningVelocity; // = 20.0;
218 
219 public: /* Methode publiques */
220  explicit vpRobotAfma4(bool verbose = true);
221  virtual ~vpRobotAfma4(void);
222 
223  void getDisplacement(vpRobot::vpControlFrameType frame, vpColVector &displacement);
224  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position);
225  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position, double &timestamp);
226 
227  double getPositioningVelocity(void);
228  bool getPowerState();
229 
230  double getTime() const;
231 
232  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity);
233  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity, double &timestamp);
234 
235  vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
236  vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
237 
238  void get_cMe(vpHomogeneousMatrix &cMe) const;
239  void get_cVe(vpVelocityTwistMatrix &cVe) const;
240  void get_cVf(vpVelocityTwistMatrix &cVf) const;
241  void get_eJe(vpMatrix &eJe);
242  void get_fJe(vpMatrix &fJe);
243 
244  void init(void);
245 
246  void move(const char *filename);
247 
248  void powerOn();
249  void powerOff();
250 
251  static bool readPosFile(const std::string &filename, vpColVector &q);
252  static bool savePosFile(const std::string &filename, const vpColVector &q);
253 
254  /* --- POSITIONNEMENT --------------------------------------------------- */
255  void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &position);
256  void setPosition(const vpRobot::vpControlFrameType frame, const double q1, const double q2, const double q4,
257  const double q5);
258  void setPosition(const char *filename);
259  void setPositioningVelocity(const double velocity);
260 
261  /* --- ETAT ------------------------------------------------------------- */
262 
264 
265  /* --- VITESSE ---------------------------------------------------------- */
266 
267  void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity);
268 
269  void stopMotion();
270 };
271 
272 #endif
273 #endif /* #ifndef vpRobotAfma4_h */
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpAfma4.cpp:309
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:75
void init(void)
Definition: vpAfma4.cpp:106
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:201
vpRobotStateType
Definition: vpRobot.h:64
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) const
Definition: vpAfma4.cpp:450
Modelisation of Irisa&#39;s cylindrical robot named Afma4.
Definition: vpAfma4.h:110
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpAfma4.cpp:320
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Control of Irisa&#39;s cylindrical robot named Afma4.
Definition: vpRobotAfma4.h:177
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
Definition: vpAfma4.cpp:395
virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)=0
static const double defaultPositioningVelocity
Definition: vpRobotAfma4.h:217
void get_cVf(const vpColVector &q, vpVelocityTwistMatrix &cVf) const
Definition: vpAfma4.cpp:348