Visual Servoing Platform  version 3.6.1 under development (2024-11-14)
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 
57 BEGIN_VISP_NAMESPACE
176 class VISP_EXPORT vpRobotAfma4 : public vpAfma4, public vpRobot
177 {
178 
179 private: /* Not allowed functions. */
183  vpRobotAfma4(const vpRobotAfma4 &robot);
184 
185 private: /* Attributs prives. */
195  static bool robotAlreadyCreated;
196 
197  double positioningVelocity;
198 
199  // Variables used to compute the measured velocities (see getVelocity() )
200  vpColVector q_prev_getvel;
201  vpHomogeneousMatrix fMc_prev_getvel;
202  double time_prev_getvel;
203  bool first_time_getvel;
204 
205  // Variables used to compute the measured displacement (see
206  // getDisplacement() )
207  vpColVector q_prev_getdis;
208  bool first_time_getdis;
209 
210 public: /* Constantes */
211  /* Vitesse maximale par default lors du positionnement du robot.
212  * C'est la valeur a la construction de l'attribut prive \a
213  * positioningVelocity. Cette valeur peut etre changee par la fonction
214  * #setPositioningVelocity.
215  */
216  static const double defaultPositioningVelocity; // = 20.0;
217 
218 public: /* Methode publiques */
219  VP_EXPLICIT vpRobotAfma4(bool verbose = true);
220  virtual ~vpRobotAfma4(void);
221 
222  void getDisplacement(vpRobot::vpControlFrameType frame, vpColVector &displacement);
223  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position) VP_OVERRIDE;
224  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position, double &timestamp);
225 
226  double getPositioningVelocity(void);
227  bool getPowerState();
228 
229  double getTime() const;
230 
231  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity);
232  void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity, double &timestamp);
233 
234  vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
235  vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
236 
237  void get_cMe(vpHomogeneousMatrix &cMe) const;
238  void get_cVe(vpVelocityTwistMatrix &cVe) const;
239  void get_cVf(vpVelocityTwistMatrix &cVf) const;
240  void get_eJe(vpMatrix &eJe) VP_OVERRIDE;
241  void get_fJe(vpMatrix &fJe) VP_OVERRIDE;
242 
243  void init(void);
244 
245  void move(const char *filename);
246 
247  void powerOn();
248  void powerOff();
249 
250  static bool readPosFile(const std::string &filename, vpColVector &q);
251  static bool savePosFile(const std::string &filename, const vpColVector &q);
252 
253  /* --- POSITIONNEMENT --------------------------------------------------- */
254  void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &position) VP_OVERRIDE;
255  void setPosition(const vpRobot::vpControlFrameType frame, const double q1, const double q2, const double q4,
256  const double q5);
257  void setPosition(const char *filename);
258  void setPositioningVelocity(double velocity);
259 
260  /* --- ETAT ------------------------------------------------------------- */
261 
263 
264  /* --- VITESSE ---------------------------------------------------------- */
265 
266  void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity) VP_OVERRIDE;
267 
268  void stopMotion();
269 };
270 END_VISP_NAMESPACE
271 #endif
272 #endif /* #ifndef vpRobotAfma4_h */
Modelization of Irisa's cylindrical robot named Afma4.
Definition: vpAfma4.h:110
void get_fJe(const vpColVector &q, vpMatrix &fJe) const
Definition: vpAfma4.cpp:448
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition: vpAfma4.cpp:307
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition: vpAfma4.cpp:318
void init(void)
Definition: vpAfma4.cpp:104
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
Definition: vpAfma4.cpp:393
void get_cVf(const vpColVector &q, vpVelocityTwistMatrix &cVf) const
Definition: vpAfma4.cpp:346
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:169
Control of Irisa's cylindrical robot named Afma4.
Definition: vpRobotAfma4.h:177
static const double defaultPositioningVelocity
Definition: vpRobotAfma4.h:216
Class that defines a generic virtual robot.
Definition: vpRobot.h:59
vpControlFrameType
Definition: vpRobot.h:77
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:65
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:202
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.