ViSP  2.6.2
vpSimulatorViper850.h
1 /****************************************************************************
2  *
3  * $Id: vpSimulatorViper850.h 3530 2012-01-03 10:52:12Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2012 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Class which provides a simulator for the robot Viper850.
36  *
37  * Authors:
38  * Nicolas Melchior
39  *
40  *****************************************************************************/
41 
42 #ifndef vpSimulatorViper850_HH
43 #define vpSimulatorViper850_HH
44 
52 #include <visp/vpRobotSimulator.h>
53 #include <visp/vpViper850.h>
54 #include <string>
55 #if defined(WIN32) || defined(VISP_HAVE_PTHREAD)
56 
202 class VISP_EXPORT vpSimulatorViper850 : public vpRobotSimulator, public vpViper850
203 {
204  public:
205  static const double defaultPositioningVelocity;
206 
207  private:
208  vpColVector q_prev_getdis;
209  bool first_time_getdis;
210 
211  double positioningVelocity;
212 
213  vpColVector zeroPos;
214  vpColVector reposPos;
215 
216  bool toolCustom;
217  std::string arm_dir;
218 
219  public:
221  vpSimulatorViper850(bool display);
222  virtual ~vpSimulatorViper850();
223 
225 
227 
229  const unsigned int &image_width,
230  const unsigned int &image_height);
232  const vpImage<unsigned char> &I);
234  void setCameraParameters(const vpCameraParameters cam) ;
235 
236  void setVelocity (const vpRobot::vpControlFrameType frame, const vpColVector & velocity);
239 
240  void setPositioningVelocity (const double velocity) {positioningVelocity = velocity;}
241  void setPosition(const vpRobot::vpControlFrameType frame,const vpColVector &q);
242  void setPosition (const vpRobot::vpControlFrameType frame,
243  const double pos1,
244  const double pos2,
245  const double pos3,
246  const double pos4,
247  const double pos5,
248  const double pos6);
249  void setPosition(const char *filename);
250 
251  void setJointLimit(vpColVector limitMin, vpColVector limitMax);
252 
253  double getPositioningVelocity (void){return positioningVelocity;}
254 
256  void getPosition (const vpRobot::vpControlFrameType frame,
257  vpPoseVector &position);
258 
259  void getCameraDisplacement(vpColVector &displacement);
260  void getArticularDisplacement(vpColVector &displacement);
262  vpColVector &displacement);
263 
264  static bool readPosFile(const char *filename, vpColVector &q);
265  static bool savePosFile(const char *filename, const vpColVector &q);
266  void move(const char *filename) ;
267 
268  void get_cMe(vpHomogeneousMatrix &cMe);
269  void get_cVe(vpVelocityTwistMatrix &cVe);
270  void get_eJe(vpMatrix &eJe);
271  void get_fJe(vpMatrix &fJe);
272 
273  void stopMotion();
274 
275  void initialiseCameraRelativeToObject(vpHomogeneousMatrix cMo);
276  void initialiseObjectRelativeToCamera(vpHomogeneousMatrix cMo);
277 
278  protected:
281  void findHighestPositioningSpeed(vpColVector &q);
282  void init();
283  bool singularityTest(const vpColVector q, vpMatrix &J);
284  int isInJointLimit (void);
285 
286  void initDisplay();
287  void initArms();
289 
290  inline void get_fMi(vpHomogeneousMatrix *fMit) {
291  #if defined(WIN32)
292  WaitForSingleObject(mutex_fMi,INFINITE);
293  for (int i = 0; i < 8; i++)
294  fMit[i] = fMi[i];
295  ReleaseMutex(mutex_fMi);
296  #elif defined(VISP_HAVE_PTHREAD)
297  pthread_mutex_lock (&mutex_fMi);
298  for (int i = 0; i < 8; i++)
299  fMit[i] = fMi[i];
300  pthread_mutex_unlock (&mutex_fMi);
301  #endif
302  }
303 
304  void compute_fMi();
305 };
306 
307 #endif
308 
309 #endif
Definition of the vpMatrix class.
Definition: vpMatrix.h:96
virtual void get_eJe(vpMatrix &_eJe)=0
virtual void getCameraDisplacement(vpColVector &v)=0
void get_fMi(vpHomogeneousMatrix *fMit)
Perspective projection without distortion model.
virtual void updateArticularPosition()=0
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
virtual void computeArticularVelocity()=0
virtual void getArticularDisplacement(vpColVector &qdot)=0
virtual void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q)=0
Set a displacement (frame has to be specified) in position control.
vpControlFrameType
Definition: vpRobot.h:83
virtual void initArms()=0
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:152
virtual void get_fJe(vpMatrix &_fJe)=0
This class aims to be a basis used to create all the simulators of robots.
vpRobotStateType
Definition: vpRobot.h:66
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
Get the robot position (frame has to be specified).
vpToolType
List of possible tools that can be attached to the robot end-effector.
Definition: vpViper850.h:91
Generic class defining intrinsic camera parameters.
Modelisation of the ADEPT Viper 850 robot.
Definition: vpViper850.h:66
Class that consider the particular case of twist transformation matrix that allows to transform a vel...
vpColVector velocity
Simulator of Irisa's Viper S850 robot named Viper850.
virtual void setVelocity(const vpRobot::vpControlFrameType, const vpColVector &)=0
virtual int isInJointLimit()=0
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
void getCameraParameters(vpCameraParameters &cam, const unsigned int &image_width, const unsigned int &image_height)
Definition: vpViper850.cpp:576
The pose is a complete representation of every rigid motion in the euclidian space.
Definition: vpPoseVector.h:92
void setPositioningVelocity(const double velocity)
void get_cMe(vpHomogeneousMatrix &cMe)
Definition: vpViper.cpp:914
void get_cVe(vpVelocityTwistMatrix &cVe)
Definition: vpViper.cpp:935
void getExternalImage(vpImage< vpRGBa > &I)
static const double defaultPositioningVelocity
double getPositioningVelocity(void)
virtual void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0