Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpSimulatorAfma6.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 * Class which provides a simulator for the robot Afma6.
33 *
34*****************************************************************************/
35
36#ifndef vpSimulatorAfma6_HH
37#define vpSimulatorAfma6_HH
38
44#include <visp3/robot/vpAfma6.h>
45#include <visp3/robot/vpRobotWireFrameSimulator.h>
46
47#include <string>
48
49#if defined(VISP_HAVE_MODULE_GUI) && ((defined(_WIN32) && !defined(WINRT_8_0)) || defined(VISP_HAVE_PTHREAD))
50
174class VISP_EXPORT vpSimulatorAfma6 : public vpRobotWireFrameSimulator, public vpAfma6
175{
176public:
177 static const double defaultPositioningVelocity;
178
179private:
180 vpColVector q_prev_getdis;
181 bool first_time_getdis;
182
183 double positioningVelocity;
184
185 vpColVector zeroPos;
186 vpColVector reposPos;
187
188 bool toolCustom;
189 std::string arm_dir;
190
191public:
193 explicit vpSimulatorAfma6(bool display);
194 virtual ~vpSimulatorAfma6();
195
196 void getCameraParameters(vpCameraParameters &cam, const unsigned int &image_width, const unsigned int &image_height);
199 void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &displacement);
201 void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q, double &timestamp);
202 void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position);
203 void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position, double &timestamp);
204 double getPositioningVelocity(void) { return positioningVelocity; }
205 void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &q);
206 void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &q, double &timestamp);
207 vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
208 vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
209
210 void get_cMe(vpHomogeneousMatrix &cMe);
212 void get_eJe(vpMatrix &eJe);
213 void get_fJe(vpMatrix &fJe);
214
215 void
218 bool initialiseCameraRelativeToObject(const vpHomogeneousMatrix &cMo);
219 void initialiseObjectRelativeToCamera(const vpHomogeneousMatrix &cMo);
220
221 void move(const char *filename);
222
223 static bool readPosFile(const std::string &filename, vpColVector &q);
224 static bool savePosFile(const std::string &filename, const vpColVector &q);
225 void setCameraParameters(const vpCameraParameters &cam);
226 void setJointLimit(const vpColVector &limitMin, const vpColVector &limitMax);
227
228 void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q);
229 void setPosition(const vpRobot::vpControlFrameType frame, double pos1, double pos2, double pos3, double pos4,
230 double pos5, double pos6);
231 void setPosition(const char *filename);
232 void setPositioningVelocity(double vel) { positioningVelocity = vel; }
233 bool setPosition(const vpHomogeneousMatrix &cdMo, vpImage<unsigned char> *Iint = NULL, const double &errMax = 0.001);
235
236 void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity);
237
238 void stopMotion();
239
240protected:
244 void compute_fMi();
245 void findHighestPositioningSpeed(vpColVector &q);
247 inline void get_fMi(vpHomogeneousMatrix *fMit)
248 {
249 m_mutex_fMi.lock();
250 for (int i = 0; i < 8; i++) {
251 fMit[i] = fMi[i];
252 }
253
254 m_mutex_fMi.unlock();
255 }
256 void init();
257 void initArms();
258 void initDisplay();
259 int isInJointLimit(void);
260 bool singularityTest(const vpColVector &q, vpMatrix &J);
263};
264
265#endif
266
267#endif
Modelisation of Irisa's gantry robot named Afma6.
Definition vpAfma6.h:76
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition vpAfma6.cpp:909
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition vpAfma6.cpp:887
void getCameraParameters(vpCameraParameters &cam, const unsigned int &image_width, const unsigned int &image_height) const
Definition vpAfma6.cpp:1255
vpAfma6ToolType
List of possible tools that can be attached to the robot end-effector.
Definition vpAfma6.h:123
Generic class defining intrinsic camera parameters.
@ perspectiveProjWithoutDistortion
Perspective projection without distortion model.
Implementation of column vector and the associated operations.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition of the vpImage class member functions.
Definition vpImage.h:135
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:152
Implementation of a pose vector and operations on poses.
This class aims to be a basis used to create all the simulators of robots.
virtual void computeArticularVelocity()=0
virtual int isInJointLimit()=0
virtual void initArms()=0
virtual void updateArticularPosition()=0
vpControlFrameType
Definition vpRobot.h:73
virtual void get_eJe(vpMatrix &_eJe)=0
Get the robot Jacobian expressed in the end-effector frame.
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:62
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition vpRobot.cpp:198
virtual void get_fJe(vpMatrix &_fJe)=0
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.
Simulator of Irisa's gantry robot named Afma6.
void get_fMi(vpHomogeneousMatrix *fMit)
void setPositioningVelocity(double vel)
static const double defaultPositioningVelocity
double getPositioningVelocity(void)
void getExternalImage(vpImage< unsigned char > &I)