42 #ifndef vpRobotWireFrameSimulator_HH
43 #define vpRobotWireFrameSimulator_HH
50 #include <visp/vpConfig.h>
54 #if defined(WIN32) || defined(VISP_HAVE_PTHREAD)
59 #elif defined(VISP_HAVE_PTHREAD)
63 #include <visp/vpWireFrameSimulator.h>
64 #include <visp/vpRobot.h>
65 #include <visp/vpRobotSimulator.h>
66 #include <visp/vpDisplayOpenCV.h>
67 #include <visp/vpDisplayX.h>
68 #include <visp/vpDisplayGTK.h>
69 #include <visp/vpDisplayGDI.h>
70 #include <visp/vpDisplayD3D.h>
131 #elif defined(VISP_HAVE_PTHREAD)
134 pthread_mutex_t mutex_fMi;
135 pthread_mutex_t mutex_artVel;
136 pthread_mutex_t mutex_artCoord;
137 pthread_mutex_t mutex_velocity;
138 pthread_mutex_t mutex_display;
155 #if defined VISP_HAVE_X11
157 #elif defined VISP_HAVE_GDI
159 #elif defined VISP_HAVE_OPENCV
161 #elif defined VISP_HAVE_D3D9
163 #elif defined VISP_HAVE_GTK
189 if( (std::fabs(px_ext-1.) >
vpMath::maximum(px_ext,1.)*std::numeric_limits<double>::epsilon())
190 && (std::fabs(py_ext-1) >
vpMath::maximum(py_ext,1.)*std::numeric_limits<double>::epsilon()))
220 void initScene(vpSceneObject obj, vpSceneDesiredObject desiredObject);
221 void initScene(
const char* obj,
const char* desiredObject);
241 constantSamplingTimeMode = _constantSamplingTimeMode;
298 this->delta_t_ = delta_t;
321 #elif defined(VISP_HAVE_PTHREAD)
322 static void* launcher(
void *arg)
333 virtual void updateArticularPosition() = 0;
335 virtual int isInJointLimit () = 0;
337 virtual void computeArticularVelocity() = 0;
341 virtual void initArms() = 0;
345 WaitForSingleObject(mutex_artCoord,INFINITE);
347 artCoordTmp = artCoord;
348 ReleaseMutex(mutex_artCoord);
351 WaitForSingleObject(mutex_artCoord,INFINITE);
353 ReleaseMutex(mutex_artCoord);}
356 WaitForSingleObject(mutex_artVel,INFINITE);
358 ReleaseMutex(mutex_artVel);
361 WaitForSingleObject(mutex_artVel,INFINITE);
363 ReleaseMutex(mutex_artVel);}
366 WaitForSingleObject(mutex_velocity,INFINITE);
368 ReleaseMutex(mutex_velocity);
371 WaitForSingleObject(mutex_velocity,INFINITE);
373 ReleaseMutex(mutex_velocity);}
376 WaitForSingleObject(mutex_display,INFINITE);
377 displayBusy = status;
378 ReleaseMutex(mutex_display);}
380 WaitForSingleObject(mutex_display,INFINITE);
381 bool status = displayBusy;
382 if (!displayBusy) displayBusy =
true;
383 ReleaseMutex(mutex_display);
386 #elif defined(VISP_HAVE_PTHREAD)
388 pthread_mutex_lock (&mutex_artCoord);
390 artCoordTmp = artCoord;
391 pthread_mutex_unlock (&mutex_artCoord);
394 pthread_mutex_lock (&mutex_artCoord);
396 pthread_mutex_unlock (&mutex_artCoord);}
399 pthread_mutex_lock (&mutex_artVel);
401 pthread_mutex_unlock (&mutex_artVel);
404 pthread_mutex_lock (&mutex_artVel);
406 pthread_mutex_unlock (&mutex_artVel);}
409 pthread_mutex_lock (&mutex_velocity);
411 pthread_mutex_unlock (&mutex_velocity);
414 pthread_mutex_lock (&mutex_velocity);
416 pthread_mutex_unlock (&mutex_velocity);}
418 void set_displayBusy (
const bool &status) {
419 pthread_mutex_lock (&mutex_display);
420 displayBusy = status;
421 pthread_mutex_unlock (&mutex_display);}
422 bool get_displayBusy () {
423 pthread_mutex_lock (&mutex_display);
424 bool status = displayBusy;
425 if (!displayBusy) displayBusy =
true;
426 pthread_mutex_unlock (&mutex_display);
void setDesiredCameraPosition(const vpHomogeneousMatrix cdMo)
void setDisplayRobotType(const vpDisplayRobotType dispType)
vpColVector get_artVel() const
void setSingularityManagement(const bool sm)
unsigned int getWidth() const
void set_fMo(const vpHomogeneousMatrix &fMo)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
unsigned int jointLimitArt
Display for windows using GDI (available on any windows 32 platform).
vpColVector get_artCoord() const
Class to define colors available for display functionnalities.
bool constantSamplingTimeMode
Flag used to force the sampling time in the thread computing the robot's displacement to a constant v...
bool singularityManagement
Define the X11 console to display images.
vpColVector get_velocity()
void setExternalCameraPosition(const vpHomogeneousMatrix &camMf)
static Type maximum(const Type &a, const Type &b)
vpHomogeneousMatrix get_fMo() const
Display for windows using Direct3D.
vpDisplayRobotType displayType
This class aims to be a basis used to create all the robot simulators.
vpCameraParameters cameraParam
void set_displayBusy(const bool &status)
The vpDisplayOpenCV allows to display image using the opencv library.
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+ library version 1.2.
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
bool setVelocityCalled
Flag used to specify to the thread managing the robot displacements that the setVelocity() method has...
void setExternalCameraPosition(const vpHomogeneousMatrix camMf)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
void setDesiredCameraPosition(const vpHomogeneousMatrix &cdMo)
void setConstantSamplingTimeMode(const bool _constantSamplingTimeMode)
vpHomogeneousMatrix get_cMo() const
void setDesiredViewColor(const vpColor col)
unsigned int getHeight() const
void set_artCoord(const vpColVector &coord)
void set_artVel(const vpColVector &vel)
static DWORD WINAPI launcher(LPVOID lpParam)
static double minTimeForUsleepCall
vpHomogeneousMatrix getExternalCameraPosition() const