Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpRobotAfma4.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 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 
178 class VISP_EXPORT vpRobotAfma4 : public vpAfma4, public vpRobot
179 {
180 
181 private: /* Not allowed functions. */
185  vpRobotAfma4(const vpRobotAfma4 &robot);
186 
187 private: /* Attributs prives. */
197  static bool robotAlreadyCreated;
198 
199  double positioningVelocity;
200 
201  // Variables used to compute the measured velocities (see getVelocity() )
202  vpColVector q_prev_getvel;
203  vpHomogeneousMatrix fMc_prev_getvel;
204  double time_prev_getvel;
205  bool first_time_getvel;
206 
207  // Variables used to compute the measured displacement (see
208  // getDisplacement() )
209  vpColVector q_prev_getdis;
210  bool first_time_getdis;
211 
212 public: /* Constantes */
213  /* Vitesse maximale par default lors du positionnement du robot.
214  * C'est la valeur a la construction de l'attribut prive \a
215  * positioningVelocity. Cette valeur peut etre changee par la fonction
216  * #setPositioningVelocity.
217  */
218  static const double defaultPositioningVelocity; // = 20.0;
219 
220 public: /* Methode publiques */
221  explicit vpRobotAfma4(bool verbose = true);
222  virtual ~vpRobotAfma4(void);
223 
224  void getDisplacement(vpRobot::vpControlFrameType frame, vpColVector &displacement);
225  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position);
226  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position, double &timestamp);
227 
228  double getPositioningVelocity(void);
229  bool getPowerState();
230 
231  double getTime() const;
232 
233  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity);
234  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity, double &timestamp);
235 
236  vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
237  vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
238 
239  void get_cMe(vpHomogeneousMatrix &cMe) const;
240  void get_cVe(vpVelocityTwistMatrix &cVe) const;
241  void get_cVf(vpVelocityTwistMatrix &cVf) const;
242  void get_eJe(vpMatrix &eJe);
243  void get_fJe(vpMatrix &fJe);
244 
245  void init(void);
246 
247  void move(const char *filename);
248 
249  void powerOn();
250  void powerOff();
251 
252  static bool readPosFile(const std::string &filename, vpColVector &q);
253  static bool savePosFile(const std::string &filename, const vpColVector &q);
254 
255  /* --- POSITIONNEMENT --------------------------------------------------- */
256  void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &position);
257  void setPosition(const vpRobot::vpControlFrameType frame, const double q1, const double q2, const double q4,
258  const double q5);
259  void setPosition(const char *filename);
260  void setPositioningVelocity(const double velocity);
261 
262  /* --- ETAT ------------------------------------------------------------- */
263 
265 
266  /* --- VITESSE ---------------------------------------------------------- */
267 
268  void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity);
269 
270  void stopMotion();
271 };
272 
273 #endif
274 #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 get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpAfma4.cpp:320
void init(void)
Definition: vpAfma4.cpp:106
void get_cVf(const vpColVector &q, vpVelocityTwistMatrix &cVf) const
Definition: vpAfma4.cpp:348
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:201
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
Definition: vpAfma4.cpp:395
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&#39;s cylindrical robot named Afma4.
Definition: vpAfma4.h:110
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Control of Irisa&#39;s cylindrical robot named Afma4.
Definition: vpRobotAfma4.h:178
void get_fJe(const vpColVector &q, vpMatrix &fJe) const
Definition: vpAfma4.cpp:450
virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)=0
static const double defaultPositioningVelocity
Definition: vpRobotAfma4.h:218