38 #ifndef vpRobotWireFrameSimulator_HH
39 #define vpRobotWireFrameSimulator_HH
46 #include <visp3/core/vpConfig.h>
48 #if defined(VISP_HAVE_MODULE_GUI) && ((defined(_WIN32) && !defined(WINRT_8_0)) || defined(VISP_HAVE_PTHREAD))
54 #elif defined(VISP_HAVE_PTHREAD)
58 #include <visp3/robot/vpWireFrameSimulator.h>
59 #include <visp3/robot/vpRobot.h>
60 #include <visp3/robot/vpRobotSimulator.h>
61 #include <visp3/gui/vpDisplayOpenCV.h>
62 #include <visp3/gui/vpDisplayX.h>
63 #include <visp3/gui/vpDisplayGTK.h>
64 #include <visp3/gui/vpDisplayGDI.h>
65 #include <visp3/gui/vpDisplayD3D.h>
123 HANDLE mutex_artCoord;
124 HANDLE mutex_velocity;
125 HANDLE mutex_display;
126 #elif defined(VISP_HAVE_PTHREAD)
150 #if defined VISP_HAVE_X11
152 #elif defined VISP_HAVE_GDI
154 #elif defined VISP_HAVE_OPENCV
156 #elif defined VISP_HAVE_D3D9
158 #elif defined VISP_HAVE_GTK
214 if( (std::fabs(px_ext-1.) >
vpMath::maximum(px_ext,1.)*std::numeric_limits<double>::epsilon())
215 && (std::fabs(py_ext-1) >
vpMath::maximum(py_ext,1.)*std::numeric_limits<double>::epsilon()))
245 void initScene(
const vpSceneObject &obj,
const vpSceneDesiredObject &desiredObject);
246 void initScene(
const char* obj,
const char* desiredObject);
247 void initScene (
const vpSceneObject &obj);
266 constantSamplingTimeMode = _constantSamplingTimeMode;
313 this->thickness_ = thickness;
330 this->delta_t_ = delta_t;
341 this->verbose_ = verbose;
359 static DWORD WINAPI launcher( LPVOID lpParam )
364 #elif defined(VISP_HAVE_PTHREAD)
376 virtual void updateArticularPosition() = 0;
378 virtual int isInJointLimit () = 0;
380 virtual void computeArticularVelocity() = 0;
384 virtual void initArms() = 0;
388 # if defined(WINRT_8_1)
389 WaitForSingleObjectEx(mutex_artCoord, INFINITE, FALSE);
391 WaitForSingleObject(mutex_artCoord,INFINITE);
394 artCoordTmp = artCoord;
395 ReleaseMutex(mutex_artCoord);
398 # if defined(WINRT_8_1)
399 WaitForSingleObjectEx(mutex_artCoord, INFINITE, FALSE);
401 WaitForSingleObject(mutex_artCoord, INFINITE);
404 ReleaseMutex(mutex_artCoord);}
407 # if defined(WINRT_8_1)
408 WaitForSingleObjectEx(mutex_artVel, INFINITE, FALSE);
410 WaitForSingleObject(mutex_artVel, INFINITE);
413 ReleaseMutex(mutex_artVel);
416 # if defined(WINRT_8_1)
417 WaitForSingleObjectEx(mutex_artVel, INFINITE, FALSE);
419 WaitForSingleObject(mutex_artVel, INFINITE);
422 ReleaseMutex(mutex_artVel);}
425 # if defined(WINRT_8_1)
426 WaitForSingleObjectEx(mutex_velocity, INFINITE, FALSE);
428 WaitForSingleObject(mutex_velocity, INFINITE);
431 ReleaseMutex(mutex_velocity);
434 # if defined(WINRT_8_1)
435 WaitForSingleObjectEx(mutex_velocity, INFINITE, FALSE);
437 WaitForSingleObject(mutex_velocity, INFINITE);
440 ReleaseMutex(mutex_velocity);}
442 void set_displayBusy (
const bool &status) {
443 # if defined(WINRT_8_1)
444 WaitForSingleObjectEx(mutex_display, INFINITE, FALSE);
446 WaitForSingleObject(mutex_display, INFINITE);
448 displayBusy = status;
449 ReleaseMutex(mutex_display);}
450 bool get_displayBusy () {
451 # if defined(WINRT_8_1)
452 WaitForSingleObjectEx(mutex_display, INFINITE, FALSE);
454 WaitForSingleObject(mutex_display, INFINITE);
456 bool status = displayBusy;
457 if (!displayBusy) displayBusy =
true;
458 ReleaseMutex(mutex_display);
461 #elif defined(VISP_HAVE_PTHREAD)
463 pthread_mutex_lock (&mutex_artCoord);
465 artCoordTmp = artCoord;
466 pthread_mutex_unlock (&mutex_artCoord);
469 pthread_mutex_lock (&mutex_artCoord);
471 pthread_mutex_unlock (&mutex_artCoord);}
474 pthread_mutex_lock (&mutex_artVel);
476 pthread_mutex_unlock (&mutex_artVel);
479 pthread_mutex_lock (&mutex_artVel);
481 pthread_mutex_unlock (&mutex_artVel);}
484 pthread_mutex_lock (&mutex_velocity);
486 pthread_mutex_unlock (&mutex_velocity);
489 pthread_mutex_lock (&mutex_velocity);
491 pthread_mutex_unlock (&mutex_velocity);}
494 pthread_mutex_lock (&mutex_display);
495 displayBusy = status;
496 pthread_mutex_unlock (&mutex_display);}
498 pthread_mutex_lock (&mutex_display);
499 bool status = displayBusy;
500 if (!displayBusy) displayBusy =
true;
501 pthread_mutex_unlock (&mutex_display);
void setDisplayRobotType(const vpDisplayRobotType dispType)
void setSingularityManagement(const bool sm)
vpColVector get_artCoord()
unsigned int getWidth() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
unsigned int jointLimitArt
static void * launcher(void *arg)
Display for windows using GDI (available on any windows 32 platform).
Class to define colors available for display functionnalities.
void set_fMo(const vpHomogeneousMatrix &fMo_)
bool constantSamplingTimeMode
Flag used to force the sampling time in the thread computing the robot's displacement to a constant v...
bool singularityManagement
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
vpColVector get_velocity()
void setGraphicsThickness(unsigned int thickness)
void setExternalCameraPosition(const vpHomogeneousMatrix &cam_Mf)
void setDesiredCameraPosition(const vpHomogeneousMatrix &cdMo_)
static Type maximum(const Type &a, const Type &b)
pthread_mutex_t mutex_artCoord
vpHomogeneousMatrix get_fMo() const
pthread_mutex_t mutex_display
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed...
vpDisplayRobotType displayType
This class aims to be a basis used to create all the robot simulators.
vpCameraParameters cameraParam
void setExternalCameraPosition(const vpHomogeneousMatrix camMf_)
void set_displayBusy(const bool &status)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
void setSamplingTime(const double &delta_t)
Generic class defining intrinsic camera parameters.
void setCameraColor(const vpColor col)
vpHomogeneousMatrix getExternalCameraPosition() const
void initScene(const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
static Type minimum(const Type &a, const Type &b)
vpCameraParameters getExternalCameraParameters() const
void set_velocity(const vpColVector &vel)
Implementation of a wire frame simulator. Compared to the vpSimulator class, it does not require thir...
void setCurrentViewColor(const vpColor col)
This class aims to be a basis used to create all the simulators of robots.
vpHomogeneousMatrix * fMi
pthread_mutex_t mutex_fMi
void setVerbose(bool verbose)
bool setVelocityCalled
Flag used to specify to the thread managing the robot displacements that the setVelocity() method has...
Implementation of column vector and the associated operations.
void setConstantSamplingTimeMode(const bool _constantSamplingTimeMode)
vpHomogeneousMatrix get_cMo() const
void setDesiredViewColor(const vpColor col)
void setDesiredCameraPosition(const vpHomogeneousMatrix cdMo_)
unsigned int getHeight() const
void set_artCoord(const vpColVector &coord)
VISP_EXPORT double getMinTimeForUsleepCall()
void set_artVel(const vpColVector &vel)
pthread_mutex_t mutex_velocity
pthread_mutex_t mutex_artVel
vpHomogeneousMatrix getExternalCameraPosition() const