Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpRobotAfma6.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 Afma6 robot controlled by an Adept MotionBlox.
33  *
34  * Authors:
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 
39 #ifndef vpRobotAfma6_h
40 #define vpRobotAfma6_h
41 
42 #include <visp3/core/vpConfig.h>
43 
44 #ifdef VISP_HAVE_AFMA6
45 
46 #include <iostream>
47 #include <stdio.h>
48 
49 #include <visp3/core/vpColVector.h>
50 #include <visp3/core/vpDebug.h>
51 #include <visp3/core/vpPoseVector.h>
52 #include <visp3/robot/vpAfma6.h>
53 #include <visp3/robot/vpRobot.h>
54 
55 // low level controller api
56 extern "C" {
57 #include "irisa_Afma6.h"
58 #include "trycatch.h"
59 }
60 
212 class VISP_EXPORT vpRobotAfma6 : public vpAfma6, public vpRobot
213 {
214 
215 private: /* Not allowed functions. */
219  vpRobotAfma6(const vpRobotAfma6 &robot);
220 
221 private: /* Attributs prives. */
231  static bool robotAlreadyCreated;
232 
233  double positioningVelocity;
234 
235  // Variables used to compute the measured velocities (see getVelocity() )
236  vpColVector q_prev_getvel;
237  vpHomogeneousMatrix fMc_prev_getvel;
238  double time_prev_getvel;
239  bool first_time_getvel;
240 
241  // Variables used to compute the measured displacement (see
242  // getDisplacement() )
243  vpColVector q_prev_getdis;
244  bool first_time_getdis;
245  vpHomogeneousMatrix fMc_prev_getdis;
246 
247 public: /* Constantes */
248  /* Vitesse maximale par default lors du positionnement du robot.
249  * C'est la valeur a la construction de l'attribut prive \a
250  * positioningVelocity. Cette valeur peut etre changee par la fonction
251  * #setPositioningVelocity.
252  */
253  static const double defaultPositioningVelocity; // = 20.0;
254 
255 public: /* Methode publiques */
256  explicit vpRobotAfma6(bool verbose = true);
257  virtual ~vpRobotAfma6(void);
258 
259  bool checkJointLimits(vpColVector &jointsStatus);
260 
261  void closeGripper();
262 
263  void getDisplacement(vpRobot::vpControlFrameType frame, vpColVector &displacement);
264 
265  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position);
266  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position, double &timestamp);
267  void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position);
268  void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position, double &timestamp);
269 
270  double getPositioningVelocity(void);
271  bool getPowerState();
272  double getTime() const;
273 
274  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity);
275  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity, double &timestamp);
276 
277  vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
278  vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
279 
280  void get_cMe(vpHomogeneousMatrix &_cMe) const;
281  void get_cVe(vpVelocityTwistMatrix &_cVe) const;
282  void get_eJe(vpMatrix &_eJe);
283  void get_fJe(vpMatrix &_fJe);
284 
285  void init(void);
286  void init(vpAfma6::vpAfma6ToolType tool, const vpHomogeneousMatrix &eMc);
287  void init(vpAfma6::vpAfma6ToolType tool, const std::string &filename);
288  void
291 
292  void move(const std::string &filename);
293  void move(const std::string &filename, const double velocity);
294 
295  void openGripper();
296 
297  void powerOn();
298  void powerOff();
299 
300  static bool readPosFile(const std::string &filename, vpColVector &q);
301  static bool savePosFile(const std::string &filename, const vpColVector &q);
302 
303  /* --- POSITIONNEMENT --------------------------------------------------- */
304  void setPosition(const vpRobot::vpControlFrameType frame, const vpPoseVector &pose);
305  void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &position);
306  void setPosition(const vpRobot::vpControlFrameType frame, const double pos1, const double pos2, const double pos3,
307  const double pos4, const double pos5, const double pos6);
308  void setPosition(const std::string &filename);
309  void setPositioningVelocity(const double velocity);
310  void set_eMc(const vpHomogeneousMatrix &eMc);
311 
312  /* --- ETAT ------------------------------------------------------------- */
313 
315 
316  /* --- VITESSE ---------------------------------------------------------- */
317 
318  void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity);
319 
320  void stopMotion();
321 };
322 
323 #endif
324 #endif /* #ifndef vpRobotAfma6_h */
Modelisation of Irisa&#39;s gantry robot named Afma6.
Definition: vpAfma6.h:78
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpAfma6.cpp:842
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Implementation of an homogeneous matrix and operations on such kind of matrices.
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
Definition: vpAfma6.cpp:864
vpAfma6ToolType
List of possible tools that can be attached to the robot end-effector.
Definition: vpAfma6.h:118
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
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:201
Control of Irisa&#39;s gantry robot named Afma6.
Definition: vpRobotAfma6.h:212
vpRobotStateType
Definition: vpRobot.h:64
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpAfma6.cpp:820
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get the robot position (frame has to be specified).
virtual void set_eMc(const vpHomogeneousMatrix &eMc)
Definition: vpAfma6.cpp:1119
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:92
void init(void)
Definition: vpAfma6.cpp:153
virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)=0
void get_fJe(const vpColVector &q, vpMatrix &fJe) const
Definition: vpAfma6.cpp:934
static const double defaultPositioningVelocity
Definition: vpRobotAfma6.h:253