Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpSimulatorAfma6.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Class which provides a simulator for the robot Afma6.
32 */
33
38
39#ifndef vpSimulatorAfma6_HH
40#define vpSimulatorAfma6_HH
41
42#include <visp3/core/vpConfig.h>
43#include <visp3/robot/vpAfma6.h>
44#include <visp3/robot/vpRobotWireFrameSimulator.h>
45
46#include <string>
47
48#if defined(VISP_HAVE_MODULE_GUI) && defined(VISP_HAVE_THREADS)
49
185class VISP_EXPORT vpSimulatorAfma6 : public vpRobotWireFrameSimulator, public vpAfma6
186{
187public:
188 static const double defaultPositioningVelocity;
189
190private:
191 vpColVector q_prev_getdis;
192 bool first_time_getdis;
193
194 double positioningVelocity;
195
196 vpColVector zeroPos;
197 vpColVector reposPos;
198
199 bool toolCustom;
200 std::string arm_dir;
201
202public:
204 VP_EXPLICIT vpSimulatorAfma6(bool display);
205 virtual ~vpSimulatorAfma6() VP_OVERRIDE;
206
207 void getCameraParameters(vpCameraParameters &cam, const unsigned int &image_width, const unsigned int &image_height);
208 void getCameraParameters(vpCameraParameters &cam, const vpImage<unsigned char> &I);
210 void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &displacement) VP_OVERRIDE;
211 void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q) VP_OVERRIDE;
212 void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q, double &timestamp);
213 void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position);
214 void getPosition(const vpRobot::vpControlFrameType frame, vpPoseVector &position, double &timestamp);
215 double getPositioningVelocity(void) { return positioningVelocity; }
216 void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &q);
217 void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &q, double &timestamp);
218 vpColVector getVelocity(const vpRobot::vpControlFrameType frame);
219 vpColVector getVelocity(const vpRobot::vpControlFrameType frame, double &timestamp);
220
221 void get_cMe(vpHomogeneousMatrix &cMe);
223 void get_eJe(vpMatrix &eJe) VP_OVERRIDE;
224 void get_fJe(vpMatrix &fJe) VP_OVERRIDE;
225
226 void
229 bool initialiseCameraRelativeToObject(const vpHomogeneousMatrix &cMo);
230 void initialiseObjectRelativeToCamera(const vpHomogeneousMatrix &cMo);
231
232 void move(const char *filename);
233
234 static bool readPosFile(const std::string &filename, vpColVector &q);
235 static bool savePosFile(const std::string &filename, const vpColVector &q);
236 void setCameraParameters(const vpCameraParameters &cam);
237 void setJointLimit(const vpColVector &limitMin, const vpColVector &limitMax);
238
239 void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q) VP_OVERRIDE;
240 void setPosition(const vpRobot::vpControlFrameType frame, double pos1, double pos2, double pos3, double pos4,
241 double pos5, double pos6);
242 void setPosition(const char *filename);
243 void setPositioningVelocity(double vel) { positioningVelocity = vel; }
244 bool setPosition(const vpHomogeneousMatrix &cdMo, vpImage<unsigned char> *Iint = nullptr, const double &errMax = 0.001);
246
247 void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity) VP_OVERRIDE;
248
249 void stopMotion();
250
251protected:
254 void computeArticularVelocity() VP_OVERRIDE;
255 void compute_fMi();
256 void findHighestPositioningSpeed(vpColVector &q);
257 void getExternalImage(vpImage<vpRGBa> &I);
258 inline void get_fMi(vpHomogeneousMatrix *fMit) VP_OVERRIDE
259 {
260 m_mutex_fMi.lock();
261 for (int i = 0; i < 8; i++) {
262 fMit[i] = fMi[i];
263 }
264
265 m_mutex_fMi.unlock();
266 }
267 void init() VP_OVERRIDE;
268 void initArms() VP_OVERRIDE;
269 void initDisplay();
270 int isInJointLimit() VP_OVERRIDE;
271 bool singularityTest(const vpColVector &q, vpMatrix &J);
272 void updateArticularPosition() VP_OVERRIDE;
274};
275END_VISP_NAMESPACE
276#endif
277
278#endif
void get_cVe(vpVelocityTwistMatrix &cVe) const
Definition vpAfma6.cpp:912
void get_cMe(vpHomogeneousMatrix &cMe) const
Definition vpAfma6.cpp:890
vpAfma6ToolType
List of possible tools that can be attached to the robot end-effector.
Definition vpAfma6.h:124
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:131
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
Implementation of a pose vector and operations on poses.
virtual void computeArticularVelocity()=0
vpControlFrameType
Definition vpRobot.h:74
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
vpRobotStateType
Definition vpRobot.h:62
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition vpRobot.cpp:200
virtual void init()=0
virtual void get_fJe(vpMatrix &_fJe)=0
vpRobot(void)
Definition vpRobot.cpp:49
virtual void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q)=0
Set a displacement (frame has to be specified) in position control.
void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &displacement) VP_OVERRIDE
void getCameraParameters(vpCameraParameters &cam, const unsigned int &image_width, const unsigned int &image_height)
void get_fMi(vpHomogeneousMatrix *fMit) VP_OVERRIDE
void setPositioningVelocity(double vel)
double getPositioningVelocity(void)
void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q) VP_OVERRIDE
static const double defaultPositioningVelocity