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>
128 HANDLE mutex_artCoord;
129 HANDLE mutex_velocity;
130 HANDLE mutex_display;
131 #elif defined(VISP_HAVE_PTHREAD)
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
191 if( (std::fabs(px_ext-1.) >
vpMath::maximum(px_ext,1.)*std::numeric_limits<double>::epsilon())
192 && (std::fabs(py_ext-1) >
vpMath::maximum(py_ext,1.)*std::numeric_limits<double>::epsilon()))
222 void initScene(
const vpSceneObject &obj,
const vpSceneDesiredObject &desiredObject);
223 void initScene(
const char* obj,
const char* desiredObject);
224 void initScene (
const vpSceneObject &obj);
243 constantSamplingTimeMode = _constantSamplingTimeMode;
290 this->thickness_ = thickness;
307 this->delta_t_ = delta_t;
318 this->verbose_ = verbose;
333 static DWORD WINAPI launcher( LPVOID lpParam )
338 #elif defined(VISP_HAVE_PTHREAD)
350 virtual void updateArticularPosition() = 0;
352 virtual int isInJointLimit () = 0;
354 virtual void computeArticularVelocity() = 0;
358 virtual void initArms() = 0;
362 WaitForSingleObject(mutex_artCoord,INFINITE);
364 artCoordTmp = artCoord;
365 ReleaseMutex(mutex_artCoord);
368 WaitForSingleObject(mutex_artCoord,INFINITE);
370 ReleaseMutex(mutex_artCoord);}
373 WaitForSingleObject(mutex_artVel,INFINITE);
375 ReleaseMutex(mutex_artVel);
378 WaitForSingleObject(mutex_artVel,INFINITE);
380 ReleaseMutex(mutex_artVel);}
383 WaitForSingleObject(mutex_velocity,INFINITE);
385 ReleaseMutex(mutex_velocity);
388 WaitForSingleObject(mutex_velocity,INFINITE);
390 ReleaseMutex(mutex_velocity);}
392 void set_displayBusy (
const bool &status) {
393 WaitForSingleObject(mutex_display,INFINITE);
394 displayBusy = status;
395 ReleaseMutex(mutex_display);}
396 bool get_displayBusy () {
397 WaitForSingleObject(mutex_display,INFINITE);
398 bool status = displayBusy;
399 if (!displayBusy) displayBusy =
true;
400 ReleaseMutex(mutex_display);
403 #elif defined(VISP_HAVE_PTHREAD)
405 pthread_mutex_lock (&mutex_artCoord);
407 artCoordTmp = artCoord;
408 pthread_mutex_unlock (&mutex_artCoord);
411 pthread_mutex_lock (&mutex_artCoord);
413 pthread_mutex_unlock (&mutex_artCoord);}
416 pthread_mutex_lock (&mutex_artVel);
418 pthread_mutex_unlock (&mutex_artVel);
421 pthread_mutex_lock (&mutex_artVel);
423 pthread_mutex_unlock (&mutex_artVel);}
426 pthread_mutex_lock (&mutex_velocity);
428 pthread_mutex_unlock (&mutex_velocity);
431 pthread_mutex_lock (&mutex_velocity);
433 pthread_mutex_unlock (&mutex_velocity);}
436 pthread_mutex_lock (&mutex_display);
437 displayBusy = status;
438 pthread_mutex_unlock (&mutex_display);}
440 pthread_mutex_lock (&mutex_display);
441 bool status = displayBusy;
442 if (!displayBusy) displayBusy =
true;
443 pthread_mutex_unlock (&mutex_display);
void setDisplayRobotType(const vpDisplayRobotType dispType)
void setSingularityManagement(const bool sm)
vpColVector get_artCoord()
unsigned int getWidth() const
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
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...
Class that provides a data structure for the column vectors as well as a set of operations on these v...
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)
void set_artVel(const vpColVector &vel)
pthread_mutex_t mutex_velocity
pthread_mutex_t mutex_artVel
static double minTimeForUsleepCall
vpHomogeneousMatrix getExternalCameraPosition() const