38 #ifndef vpRobotWireFrameSimulator_HH
39 #define vpRobotWireFrameSimulator_HH
46 #include <visp3/core/vpConfig.h>
48 #if defined(VISP_HAVE_MODULE_GUI) && (defined(_WIN32) || 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
212 if( (std::fabs(px_ext-1.) >
vpMath::maximum(px_ext,1.)*std::numeric_limits<double>::epsilon())
213 && (std::fabs(py_ext-1) >
vpMath::maximum(py_ext,1.)*std::numeric_limits<double>::epsilon()))
243 void initScene(
const vpSceneObject &obj,
const vpSceneDesiredObject &desiredObject);
244 void initScene(
const char* obj,
const char* desiredObject);
245 void initScene (
const vpSceneObject &obj);
264 constantSamplingTimeMode = _constantSamplingTimeMode;
311 this->thickness_ = thickness;
328 this->delta_t_ = delta_t;
339 this->verbose_ = verbose;
354 static DWORD WINAPI launcher( LPVOID lpParam )
359 #elif defined(VISP_HAVE_PTHREAD)
371 virtual void updateArticularPosition() = 0;
373 virtual int isInJointLimit () = 0;
375 virtual void computeArticularVelocity() = 0;
379 virtual void initArms() = 0;
383 WaitForSingleObject(mutex_artCoord,INFINITE);
385 artCoordTmp = artCoord;
386 ReleaseMutex(mutex_artCoord);
389 WaitForSingleObject(mutex_artCoord,INFINITE);
391 ReleaseMutex(mutex_artCoord);}
394 WaitForSingleObject(mutex_artVel,INFINITE);
396 ReleaseMutex(mutex_artVel);
399 WaitForSingleObject(mutex_artVel,INFINITE);
401 ReleaseMutex(mutex_artVel);}
404 WaitForSingleObject(mutex_velocity,INFINITE);
406 ReleaseMutex(mutex_velocity);
409 WaitForSingleObject(mutex_velocity,INFINITE);
411 ReleaseMutex(mutex_velocity);}
413 void set_displayBusy (
const bool &status) {
414 WaitForSingleObject(mutex_display,INFINITE);
415 displayBusy = status;
416 ReleaseMutex(mutex_display);}
417 bool get_displayBusy () {
418 WaitForSingleObject(mutex_display,INFINITE);
419 bool status = displayBusy;
420 if (!displayBusy) displayBusy =
true;
421 ReleaseMutex(mutex_display);
424 #elif defined(VISP_HAVE_PTHREAD)
426 pthread_mutex_lock (&mutex_artCoord);
428 artCoordTmp = artCoord;
429 pthread_mutex_unlock (&mutex_artCoord);
432 pthread_mutex_lock (&mutex_artCoord);
434 pthread_mutex_unlock (&mutex_artCoord);}
437 pthread_mutex_lock (&mutex_artVel);
439 pthread_mutex_unlock (&mutex_artVel);
442 pthread_mutex_lock (&mutex_artVel);
444 pthread_mutex_unlock (&mutex_artVel);}
447 pthread_mutex_lock (&mutex_velocity);
449 pthread_mutex_unlock (&mutex_velocity);
452 pthread_mutex_lock (&mutex_velocity);
454 pthread_mutex_unlock (&mutex_velocity);}
457 pthread_mutex_lock (&mutex_display);
458 displayBusy = status;
459 pthread_mutex_unlock (&mutex_display);}
461 pthread_mutex_lock (&mutex_display);
462 bool status = displayBusy;
463 if (!displayBusy) displayBusy =
true;
464 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
Define the X11 console to display images.
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.
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.
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
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