Visual Servoing Platform  version 3.6.1 under development (2024-03-29)
vpRobotAfma4.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 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 https://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 *****************************************************************************/
35 
36 #ifndef vpRobotAfma4_h
37 #define vpRobotAfma4_h
38 
39 #include <visp3/core/vpConfig.h>
40 
41 #ifdef VISP_HAVE_AFMA4
42 
43 #include <iostream>
44 #include <stdio.h>
45 
46 #include <visp3/core/vpColVector.h>
47 #include <visp3/core/vpDebug.h>
48 #include <visp3/robot/vpAfma4.h>
49 #include <visp3/robot/vpRobot.h>
50 
51 // low level controller api
52 extern "C" {
53 #include "irisa_Afma4.h"
54 #include "trycatch.h"
55 }
56 
175 class VISP_EXPORT vpRobotAfma4 : public vpAfma4, public vpRobot
176 {
177 
178 private: /* Not allowed functions. */
182  vpRobotAfma4(const vpRobotAfma4 &robot);
183 
184 private: /* Attributs prives. */
194  static bool robotAlreadyCreated;
195 
196  double positioningVelocity;
197 
198  // Variables used to compute the measured velocities (see getVelocity() )
199  vpColVector q_prev_getvel;
200  vpHomogeneousMatrix fMc_prev_getvel;
201  double time_prev_getvel;
202  bool first_time_getvel;
203 
204  // Variables used to compute the measured displacement (see
205  // getDisplacement() )
206  vpColVector q_prev_getdis;
207  bool first_time_getdis;
208 
209 public: /* Constantes */
210  /* Vitesse maximale par default lors du positionnement du robot.
211  * C'est la valeur a la construction de l'attribut prive \a
212  * positioningVelocity. Cette valeur peut etre changee par la fonction
213  * #setPositioningVelocity.
214  */
215  static const double defaultPositioningVelocity; // = 20.0;
216 
217 public: /* Methode publiques */
218  explicit vpRobotAfma4(bool verbose = true);
219  virtual ~vpRobotAfma4(void);
220 
221  void getDisplacement(vpRobot::vpControlFrameType frame, vpColVector &displacement);
222  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position) vp_override;
223  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position, double &timestamp);
224 
225  double getPositioningVelocity(void);
226  bool getPowerState();
227 
228  double getTime() const;
229 
230  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity);
231  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity, double &timestamp);
232 
233  vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
234  vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
235 
236  void get_cMe(vpHomogeneousMatrix &cMe) const;
237  void get_cVe(vpVelocityTwistMatrix &cVe) const;
238  void get_cVf(vpVelocityTwistMatrix &cVf) const;
239  void get_eJe(vpMatrix &eJe) vp_override;
240  void get_fJe(vpMatrix &fJe) vp_override;
241 
242  void init(void);
243 
244  void move(const char *filename);
245 
246  void powerOn();
247  void powerOff();
248 
249  static bool readPosFile(const std::string &filename, vpColVector &q);
250  static bool savePosFile(const std::string &filename, const vpColVector &q);
251 
252  /* --- POSITIONNEMENT --------------------------------------------------- */
253  void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &position) vp_override;
254  void setPosition(const vpRobot::vpControlFrameType frame, const double q1, const double q2, const double q4,
255  const double q5);
256  void setPosition(const char *filename);
257  void setPositioningVelocity(double velocity);
258 
259  /* --- ETAT ------------------------------------------------------------- */
260 
262 
263  /* --- VITESSE ---------------------------------------------------------- */
264 
265  void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity) vp_override;
266 
267  void stopMotion();
268 };
269 
270 #endif
271 #endif /* #ifndef vpRobotAfma4_h */
Modelization of Irisa's cylindrical robot named Afma4.
Definition: vpAfma4.h:108
void get_fJe(const vpColVector &q, vpMatrix &fJe) const
Definition: vpAfma4.cpp:447
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpAfma4.cpp:306
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpAfma4.cpp:317
void init(void)
Definition: vpAfma4.cpp:103
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
Definition: vpAfma4.cpp:392
void get_cVf(const vpColVector &q, vpVelocityTwistMatrix &cVf) const
Definition: vpAfma4.cpp:345
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:146
Control of Irisa's cylindrical robot named Afma4.
Definition: vpRobotAfma4.h:176
static const double defaultPositioningVelocity
Definition: vpRobotAfma4.h:215
Class that defines a generic virtual robot.
Definition: vpRobot.h:57
vpControlFrameType
Definition: vpRobot.h:75
virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)=0
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position)=0
Get the robot position (frame has to be specified).
vpRobotStateType
Definition: vpRobot.h:63
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:198
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
virtual void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q)=0
Set a displacement (frame has to be specified) in position control.