Main MRPT website > C++ reference for MRPT 1.5.6
CSkeletonTracker.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2014, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "hwdrivers-precomp.h" // Precompiled headers
11 
12 #include <mrpt/system/threads.h>
14 
15 // opengl includes
16 #include <mrpt/opengl/CSphere.h>
18 #include <mrpt/opengl/C3DSScene.h>
21 #include <mrpt/opengl/CBox.h>
22 #include <mrpt/opengl/CText.h>
23 #include <mrpt/opengl/CCylinder.h>
26 
28 
29 using namespace mrpt::utils;
30 using namespace mrpt::hwdrivers;
31 using namespace mrpt::poses;
32 using namespace mrpt::obs;
33 using namespace std;
34 
35 #define skl_states (static_cast<nite::SkeletonState*>(m_skeletons_ptr))
36 #define user_tracker (static_cast<nite::UserTracker*>(m_userTracker_ptr))
37 #define MAX_USERS 10
38 #define FILL_JOINT_DATA(_J1,_J2) \
39  obs->_J1.x = user.getSkeleton().getJoint(_J2).getPosition().x;\
40  obs->_J1.y = user.getSkeleton().getJoint(_J2).getPosition().y;\
41  obs->_J1.z = user.getSkeleton().getJoint(_J2).getPosition().z;\
42  obs->_J1.conf = user.getSkeleton().getJoint(_J2).getPositionConfidence();
43 
44 #if MRPT_HAS_NITE2
45  #include "NiTE.h"
46  #pragma comment (lib,"NiTE2.lib")
47 #endif
48 
49 string jointNames[] = {
50  "head","neck","torso",
51  "left_shoulder", "left_elbow", "left_hand", "left_hip", "left_knee", "left_foot",
52  "right_shoulder", "right_elbow", "right_hand", "right_hip", "right_knee", "right_foot"
53 };
54 
55 /*-------------------------------------------------------------
56  CSkeletonTracker
57 -------------------------------------------------------------*/
58 CSkeletonTracker::CSkeletonTracker( ) :
59  m_skeletons_ptr (NULL),
60  m_userTracker_ptr (NULL),
61  m_timeStartUI (0),
62  m_timeStartTT (0),
63  m_sensorPose (),
64  m_nUsers (0),
65  m_showPreview (false),
66  m_toutCounter (0)
67 {
68  m_sensorLabel = "skeletonTracker";
69 
70 #if MRPT_HAS_OPENNI2 && MRPT_HAS_NITE2
71  m_skeletons_ptr = new nite::SkeletonState[MAX_USERS];
72  m_userTracker_ptr = new nite::UserTracker;
73  for(int i = 0; i < MAX_USERS; ++i)
74  skl_states[i] = nite::SKELETON_NONE;
75 
76  m_linesToPlot.resize(NUM_LINES);
77  m_joint_theta.resize(NUM_JOINTS);
78  for(int i = 1; i < NUM_JOINTS; ++i )
79  m_joint_theta[i] = (i-1)*(M_2PI/(NUM_JOINTS-1));
80 #else
81  THROW_EXCEPTION("MRPT has been compiled with 'BUILD_OPENNI2'=OFF or 'BUILD_NITE2'=OFF, so this class cannot be used.");
82 #endif
83 
84 }
85 
86 /*-------------------------------------------------------------
87  ~CSkeletonTracker
88 -------------------------------------------------------------*/
90 {
91 #if MRPT_HAS_OPENNI2 && MRPT_HAS_NITE2
92  nite::NiTE::shutdown(); // close tracker
93  delete[] skl_states; m_skeletons_ptr = NULL;
94  delete user_tracker; m_userTracker_ptr = NULL;
95 #endif
96  if(m_win) m_win.clear();
97 }
98 
99 /*-------------------------------------------------------------
100  processPreviewNone
101 -------------------------------------------------------------*/
103 {
104  using namespace mrpt::opengl;
105 
106  // show skeleton data
107  if( m_showPreview )
108  {
109  if( !m_win )
110  {
111  string caption = string("Preview of ") + m_sensorLabel;
112  m_win = mrpt::gui::CDisplayWindow3D::Create( caption, 800, 600 );
113 
114  COpenGLScenePtr & scene = m_win->get3DSceneAndLock();
115  scene->insert( CGridPlaneXZ::Create(-3,3,0,5,-1.5 ) );
116 
117  // set camera parameters
118  m_win->setCameraElevationDeg(-90);
119  m_win->setCameraAzimuthDeg(90);
120  m_win->setCameraZoom(4);
121  m_win->setCameraPointingToPoint(0,0,0);
122 
123  // insert initial body
124  CSetOfObjectsPtr body = CSetOfObjects::Create();
125  body->setName("body");
126  for(int i = 0; i < NUM_JOINTS; ++i)
127  {
128  CSpherePtr sph = CSphere::Create(0.03f);
129  sph->setColor(0,1,0);
130  sph->setName( jointNames[i] );
131  body->insert(sph);
132  }
133 
134  // insert initial lines
135  CSetOfLinesPtr lines = CSetOfLines::Create();
136  lines->setName("lines");
137  lines->setColor(0,0,1);
138  body->insert(lines);
139 
140  scene->insert(body);
141  m_win->unlockAccess3DScene();
142  }
143 
144  if( m_win && m_win->isOpen() )
145  {
146  COpenGLScenePtr & scene = m_win->get3DSceneAndLock();
147  {
148  m_win->addTextMessage( 0.35, 0.9,
149  "Please, adopt this position",
150  TColorf(1,1,1),"mono",10, mrpt::opengl::FILL,
151  0);
152 
153  // insert translucid dummy and help text (it will go away when measurements are taken)
154  if( !scene->getByName("dummy") )
155  {
156  const double SCALE = 0.8;
157  const double BODY_RADIUS = 0.22*SCALE;
158  const double BODY_LENGTH = 0.8*SCALE;
159  const double ARM_RADIUS = 0.05*SCALE;
160  const double ARM_LENGTH = 0.4*SCALE;
161  const double LEG_RADIUS = 0.1*SCALE;
162  const double LEG_LENGTH = 0.8*SCALE;
163  const double HEAD_RADIUS = 0.15*SCALE;
164  const double ALPHA_CH = 0.8;
165 
166  CSetOfObjectsPtr dummy = CSetOfObjects::Create();
167  dummy->setName("dummy");
168  dummy->setPose(math::TPose3D(0,0,0,0,0,DEG2RAD(-90)));
169  {
170  // head
171  CSpherePtr part = CSphere::Create(HEAD_RADIUS);
172  part->setColor(1,1,1,ALPHA_CH);
173  part->setPose(math::TPose3D(0,0,0.5*BODY_LENGTH+HEAD_RADIUS,0,0,0));
174  dummy->insert(part);
175  }
176  {
177  // body
178  CCylinderPtr part = CCylinder::Create(BODY_RADIUS,BODY_RADIUS,BODY_LENGTH);
179  part->setColor(1,1,1,ALPHA_CH);
180  part->setPose(math::TPose3D(0,0,-BODY_LENGTH/2,0,0,0));
181  dummy->insert(part);
182  }
183  {
184  // left arm 0
185  CCylinderPtr part = CCylinder::Create(ARM_RADIUS,ARM_RADIUS,ARM_LENGTH);
186  part->setColor(1,1,1,ALPHA_CH);
187  part->setPose(math::TPose3D(-BODY_RADIUS,0,0.5*BODY_LENGTH-ARM_RADIUS,0,DEG2RAD(-90),0));
188  dummy->insert(part);
189  }
190  {
191  // left arm 1
192  CCylinderPtr part = CCylinder::Create(ARM_RADIUS,ARM_RADIUS,ARM_LENGTH);
193  part->setColor(1,1,1,ALPHA_CH);
194  part->setPose(math::TPose3D(-BODY_RADIUS-ARM_LENGTH+ARM_RADIUS,0,0.5*BODY_LENGTH-ARM_RADIUS,0,0,0));
195  dummy->insert(part);
196  }
197  {
198  // right arm 0
199  CCylinderPtr part = CCylinder::Create(ARM_RADIUS,ARM_RADIUS,ARM_LENGTH);
200  part->setColor(1,1,1,ALPHA_CH);
201  part->setPose(math::TPose3D(BODY_RADIUS,0,0.5*BODY_LENGTH-ARM_RADIUS,0,DEG2RAD(90),0));
202  dummy->insert(part);
203  }
204  {
205  // right arm 1
206  CCylinderPtr part = CCylinder::Create(ARM_RADIUS,ARM_RADIUS,ARM_LENGTH);
207  part->setColor(1,1,1,ALPHA_CH);
208  part->setPose(math::TPose3D(BODY_RADIUS+ARM_LENGTH-ARM_RADIUS,0,0.5*BODY_LENGTH-ARM_RADIUS,0,0,0));
209  dummy->insert(part);
210  }
211  {
212  // left leg
213  CCylinderPtr part = CCylinder::Create(LEG_RADIUS,LEG_RADIUS,LEG_LENGTH);
214  part->setColor(1,1,1,ALPHA_CH);
215  part->setPose(math::TPose3D(-BODY_RADIUS+LEG_RADIUS,0,-(0.5*BODY_LENGTH+LEG_LENGTH),0,0,0));
216  dummy->insert(part);
217  }
218  {
219  // right leg
220  CCylinderPtr part = CCylinder::Create(LEG_RADIUS,LEG_RADIUS,LEG_LENGTH);
221  part->setColor(1,1,1,ALPHA_CH);
222  part->setPose(math::TPose3D(BODY_RADIUS-LEG_RADIUS,0,-(0.5*BODY_LENGTH+LEG_LENGTH),0,0,0));
223  dummy->insert(part);
224  }
225  scene->insert(dummy);
226  } // end-if
227  else
228  {
229  CSetOfObjectsPtr dummy = static_cast<CSetOfObjectsPtr>( scene->getByName("dummy") );
230  dummy->setVisibility(true);
231  }
232 
233  // update joints positions
234  CSetOfObjectsPtr body = static_cast<CSetOfObjectsPtr>( scene->getByName("body") );
235  ASSERT_( body )
236 
237  for(int i = 0; i < NUM_JOINTS; ++i)
238  {
239  CSpherePtr s = static_cast<CSpherePtr>( body->getByName( jointNames[i] ) );
240  CPoint3D sphPos;
241  if( i == 0 )
242  sphPos = CPoint3D(0,0,0);
243  else
244  {
245  m_joint_theta[i] += M_2PI/(10*(NUM_JOINTS-1));
246  sphPos.x( 0.5*cos( m_joint_theta[i] ) );
247  sphPos.y( 0.5*sin( m_joint_theta[i] ) );
248  sphPos.z( 0.0 );
249  }
250  s->setPose( sphPos );
251  s->setColor( 1, 0, 0 );
252  s->setRadius( i == 0 ? 0.07 : 0.03 );
253  } // end-for
254  } // end-get3DSceneAndLock
255  m_win->unlockAccess3DScene();
256  m_win->forceRepaint();
257  } // end if
258  } // end if
259 } // end-processPreviewNone
260 
261 /*-------------------------------------------------------------
262  processPreview
263 -------------------------------------------------------------*/
264 void CSkeletonTracker::processPreview(const mrpt::obs::CObservationSkeletonPtr & obs)
265 {
266  using namespace mrpt::opengl;
267 
268  // show skeleton data
269  if( m_showPreview )
270  {
271  if( !m_win )
272  {
273  string caption = string("Preview of ") + m_sensorLabel;
274  m_win = mrpt::gui::CDisplayWindow3D::Create( caption, 800, 600 );
275 
276  COpenGLScenePtr & scene = m_win->get3DSceneAndLock();
277  scene->insert( CGridPlaneXZ::Create(-3,3,0,5,-1.5 ) );
278 
279  // set camera parameters
280  m_win->setCameraElevationDeg(-90);
281  m_win->setCameraAzimuthDeg(90);
282  m_win->setCameraZoom(4);
283  m_win->setCameraPointingToPoint(0,0,0);
284 
285  // insert initial body
286  CSetOfObjectsPtr body = CSetOfObjects::Create();
287  body->setName("body");
288  for(int i = 0; i < NUM_JOINTS; ++i)
289  {
290  CSpherePtr sph = CSphere::Create(0.03f);
291  sph->setColor(0,1,0);
292  sph->setName( jointNames[i] );
293  body->insert(sph);
294  }
295 
296  // insert initial lines
297  CSetOfLinesPtr lines = CSetOfLines::Create();
298  lines->setName("lines");
299  lines->setColor(0,0,1);
300  body->insert(lines);
301 
302  scene->insert(body);
303  m_win->unlockAccess3DScene();
304  }
305 
306  if( m_win && m_win->isOpen() )
307  {
308  COpenGLScenePtr & scene = m_win->get3DSceneAndLock();
309 
310  // remove help text and dummy
311  m_win->clearTextMessages();
312  CSetOfObjectsPtr dummy = static_cast<CSetOfObjectsPtr>( scene->getByName("dummy") );
313  if( dummy ) dummy->setVisibility(false);
314 
315  {
316  // update joints positions
317  CSetOfObjectsPtr body = static_cast<CSetOfObjectsPtr>( scene->getByName("body") );
318  ASSERT_( body )
319 
320  for(int i = 0; i < NUM_JOINTS; ++i)
321  {
323 
324  switch( i )
325  {
326  case 0: j = obs->head; break;
327  case 1: j = obs->neck; break;
328  case 2: j = obs->torso; break;
329 
330  case 3: j = obs->left_shoulder; break;
331  case 4: j = obs->left_elbow; break;
332  case 5: j = obs->left_hand; break;
333  case 6: j = obs->left_hip; break;
334  case 7: j = obs->left_knee; break;
335  case 8: j = obs->left_foot; break;
336 
337  case 9: j = obs->right_shoulder; break;
338  case 10: j = obs->right_elbow; break;
339  case 11: j = obs->right_hand; break;
340  case 12: j = obs->right_hip; break;
341  case 13: j = obs->right_knee; break;
342  case 14: j = obs->right_foot; break;
343  } // end-switch
344 
345  CSpherePtr s = static_cast<CSpherePtr>( body->getByName( jointNames[i] ) );
346  s->setPose( mrpt::math::TPose3D(j.x*1e-3,j.y*1e-3,j.z*1e-3,0,0,0) );
347  s->setColor( std::min(1.0,2*(1-j.conf)), std::min(1.0,2*j.conf), 0 );
348  s->setRadius( i == 0 ? 0.07 : 0.03 );
349  } // end-for
350 
351  // update lines joining joints
352  CSetOfLinesPtr lines = static_cast<CSetOfLinesPtr>(body->getByName("lines") );
353  ASSERT_(lines)
354 
355  lines->clear();
356  for(int i = 0; i < NUM_LINES; ++i)
357  {
358  pair<JOINT,JOINT> pair = m_linesToPlot[i];
359  CSpherePtr s0 = static_cast<CSpherePtr>( body->getByName( jointNames[pair.first] ) );
360  CSpherePtr s1 = static_cast<CSpherePtr>( body->getByName( jointNames[pair.second] ) );
361  ASSERT_(s0 && s1)
362 
363  lines->appendLine(
364  s0->getPoseX(),s0->getPoseY(),s0->getPoseZ(),
365  s1->getPoseX(),s1->getPoseY(),s1->getPoseZ()
366  );
367  }
368  } // end-get3DSceneAndLock
369  m_win->unlockAccess3DScene();
370  m_win->forceRepaint();
371  } // end if
372  } // end if
373 }
374 
375 /*-------------------------------------------------------------
376  doProcess
377 -------------------------------------------------------------*/
379 {
380 #if MRPT_HAS_OPENNI2 && MRPT_HAS_NITE2
381  if(m_state == ssError)
382  {
383  mrpt::system::sleep(200);
384  initialize();
385  }
386 
387  if(m_state == ssError)
388  return;
389 
390  nite::UserTrackerFrameRef userTrackerFrame;
391  nite::Status niteRc = user_tracker->readFrame(&userTrackerFrame);
392 
393  if (niteRc != nite::STATUS_OK)
394  {
395  printf(" [Skeleton tracker] Get next frame failed\n");
396  return;
397  }
398 
399  int n_data_ok = 0;
400  const nite::Array<nite::UserData> & users = userTrackerFrame.getUsers();
401  m_nUsers = users.getSize();
402  for (int i = 0; i < m_nUsers; ++i)
403  {
404  const nite::UserData & user = users[i];
405 
406  // update user state
407  skl_states[user.getId()] = user.getSkeleton().getState();
408 
409  if( user.isNew() )
410  {
411  user_tracker->startSkeletonTracking(user.getId());
412  cout << " [Skeleton tracker] New user found" << endl;
413  }
414  else if( user.getSkeleton().getState() == nite::SKELETON_TRACKED )
415  {
416  cout << " [Skeleton tracker] User " << user.getId() << " tracked" << endl;
417  CObservationSkeletonPtr obs = CObservationSkeleton::Create();
418 
419  // timestamp
420  const uint64_t nowUI = userTrackerFrame.getTimestamp();
421 
422  uint64_t AtUI = 0;
423  if( m_timeStartUI == 0 )
424  {
425  m_timeStartUI = nowUI;
427  }
428  else
429  AtUI = nowUI - m_timeStartUI;
430 
431  mrpt::system::TTimeStamp AtDO = mrpt::system::secondsToTimestamp( AtUI * 1e-6 /* Board time is usec */ );
433 
434  // fill joint data
435  FILL_JOINT_DATA(head,nite::JOINT_HEAD)
436  FILL_JOINT_DATA(neck,nite::JOINT_NECK)
437  FILL_JOINT_DATA(torso,nite::JOINT_TORSO)
438 
439  FILL_JOINT_DATA(left_shoulder,nite::JOINT_LEFT_SHOULDER)
440  FILL_JOINT_DATA(left_elbow,nite::JOINT_LEFT_ELBOW)
441  FILL_JOINT_DATA(left_hand,nite::JOINT_LEFT_HAND)
442  FILL_JOINT_DATA(left_hip,nite::JOINT_LEFT_HIP)
443  FILL_JOINT_DATA(left_knee,nite::JOINT_LEFT_KNEE)
444  FILL_JOINT_DATA(left_foot,nite::JOINT_LEFT_FOOT)
445 
446  FILL_JOINT_DATA(right_shoulder,nite::JOINT_RIGHT_SHOULDER)
447  FILL_JOINT_DATA(right_elbow,nite::JOINT_RIGHT_ELBOW)
448  FILL_JOINT_DATA(right_hand,nite::JOINT_RIGHT_HAND)
449  FILL_JOINT_DATA(right_hip,nite::JOINT_RIGHT_HIP)
450  FILL_JOINT_DATA(right_knee,nite::JOINT_RIGHT_KNEE)
451  FILL_JOINT_DATA(right_foot,nite::JOINT_RIGHT_FOOT)
452 
453  // sensor label:
454  obs->sensorLabel = m_sensorLabel + "_" + std::to_string(user.getId());
455 
456  appendObservation(obs);
457  processPreview(obs);
458 
459  m_toutCounter = 0;
460  n_data_ok++;
461  } // end-else-if
462  } // end-for
463 
464  if( n_data_ok == 0 ) // none of the sensors yielded data
465  m_toutCounter++;
466 
467  if( m_toutCounter > 0 )
468  {
470  if((m_toutCounter%50) == 0 )
471  cout << " [Skeleton tracker] Looking for user..." << endl;
472  }
473 
474  if( m_toutCounter > 2000 )
475  {
476  m_toutCounter = 0;
477  m_state = ssError;
478 
479  cout << " [Skeleton tracker] No user found after 2000 attempts ..." << endl;
480  nite::NiTE::shutdown(); // close tracker
481  }
482 #else
483  THROW_EXCEPTION("MRPT has been compiled with 'BUILD_OPENNI2'=OFF or 'MRPT_HAS_NITE2'=OFF, so this class cannot be used.");
484 #endif
485 }
486 
487 /*-------------------------------------------------------------
488  initialize
489 -------------------------------------------------------------*/
491 {
492 #if MRPT_HAS_OPENNI2 && MRPT_HAS_NITE2
493 
494  // initialize tracker
495  nite::NiTE::initialize();
496  nite::Status niteRc = user_tracker->create();
497 
498  if (niteRc != nite::STATUS_OK)
499  {
500  printf("Couldn't create user tracker\n");
501  m_state = ssError;
502  }
503  else
504  {
505  printf("Sucessfully created user tracker \n");
506  printf("Start moving around to get detected...\n(PSI pose may be required for skeleton calibration, depending on the configuration)\n");
508  }
509  // initialize preview joints and lines
510  if( m_showPreview )
511  {
512  m_linesToPlot[0] = make_pair(NECK,HEAD);
513  m_linesToPlot[1] = make_pair(NECK,TORSO);
514  m_linesToPlot[2] = make_pair(NECK,LEFT_SHOULDER);
515  m_linesToPlot[3] = make_pair(NECK,RIGHT_SHOULDER);
516  m_linesToPlot[4] = make_pair(LEFT_SHOULDER,LEFT_ELBOW);
517  m_linesToPlot[5] = make_pair(LEFT_ELBOW,LEFT_HAND);
518  m_linesToPlot[6] = make_pair(RIGHT_SHOULDER,RIGHT_ELBOW);
519  m_linesToPlot[7] = make_pair(RIGHT_ELBOW,RIGHT_HAND);
520  m_linesToPlot[8] = make_pair(TORSO,LEFT_HIP);
521  m_linesToPlot[9] = make_pair(TORSO,RIGHT_HIP);
522  m_linesToPlot[10] = make_pair(LEFT_HIP,LEFT_KNEE);
523  m_linesToPlot[11] = make_pair(LEFT_KNEE,LEFT_FOOT);
524  m_linesToPlot[12] = make_pair(RIGHT_HIP,RIGHT_KNEE);
525  m_linesToPlot[13] = make_pair(RIGHT_KNEE,RIGHT_FOOT);
526  }
527 #else
528  THROW_EXCEPTION("MRPT has been compiled with 'BUILD_OPENNI2'=OFF OR 'MRPT_HAS_NITE2'=OFF, so this class cannot be used.");
529 #endif
530 }
531 
532 /*-------------------------------------------------------------
533  loadConfig_sensorSpecific
534 -------------------------------------------------------------*/
536  const mrpt::utils::CConfigFileBase & configSource,
537  const std::string & iniSection )
538 {
540  configSource.read_float( iniSection, "pose_x", 0, false ),
541  configSource.read_float( iniSection, "pose_y", 0, false ),
542  configSource.read_float( iniSection, "pose_z", 0, false ),
543  DEG2RAD( configSource.read_float( iniSection, "pose_yaw", 0, false ) ),
544  DEG2RAD( configSource.read_float( iniSection, "pose_pitch", 0, false ) ),
545  DEG2RAD( configSource.read_float( iniSection, "pose_roll", 0, false ) )
546  );
547 
548  m_showPreview = configSource.read_bool( iniSection, "showPreview", m_showPreview, false );
549 
550  // dump parameters to console
551  cout << "---------------------------" << endl;
552  cout << "Skeleton Tracker parameters: " << endl;
553  cout << "---------------------------" << endl;
554  cout << m_sensorPose << endl;
555  cout << m_showPreview << endl;
556  cout << "---------------------------" << endl << endl;
557 }
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
double x() const
Common members of all points & poses classes.
Definition: CPoseOrPoint.h:113
bool read_bool(const std::string &section, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
Status
Definition: xmlParser.cpp:523
#define min(a, b)
void * m_skeletons_ptr
Opaque pointers to specific NITE data.
#define NUM_JOINTS
virtual ~CSkeletonTracker()
Destructor.
float read_float(const std::string &section, const std::string &name, float defaultValue, bool failIfNotFound=false) const
mrpt::system::TTimeStamp m_timeStartTT
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
string jointNames[]
std::string m_sensorLabel
See CGenericSensor.
#define THROW_EXCEPTION(msg)
unsigned int m_toutCounter
Timeout counter (for internal use only)
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
Definition: datetime.h:70
Contains classes for various device interfaces.
std::vector< std::pair< JOINT, JOINT > > m_linesToPlot
Lines between joints.
STL namespace.
GLdouble s
Definition: glext.h:3602
int m_nUsers
Number of detected users.
#define skl_states
This class allows loading and storing values and vectors of different types from a configuration text...
#define M_2PI
Definition: mrpt_macros.h:380
mrpt::poses::CPose3D m_sensorPose
Sensor pose.
static CDisplayWindow3DPtr Create()
A class for grabbing mrpt::obs::CObservationSkeleton from a PrimeSense camera.
void BASE_IMPEXP sleep(int time_ms) MRPT_NO_THROWS
An OS-independent method for sending the current thread to "sleep" for a given period of time...
Definition: threads.cpp:57
void processPreview(const mrpt::obs::CObservationSkeletonPtr &obs)
Displays real-time info for the captured skeleton.
This namespace contains representation of robot actions and observations.
void initialize()
Connects to the PrimeSense camera and prepares it to get skeleton data.
#define DEG2RAD
#define NUM_LINES
GLsizei const GLchar ** string
Definition: glext.h:3919
A class used to store a 3D point.
Definition: CPoint3D.h:32
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
#define MAX_USERS
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
unsigned __int64 uint64_t
Definition: rptypes.h:52
mrpt::gui::CDisplayWindow3DPtr m_win
bool m_showPreview
Preview window management.
void setFromValues(const double x0, const double y0, const double z0, const double yaw=0, const double pitch=0, const double roll=0)
Set the pose from a 3D position (meters) and yaw/pitch/roll angles (radians) - This method recomputes...
Definition: CPose3D.cpp:254
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
The namespace for 3D scene representation and rendering.
#define ASSERT_(f)
A RGB color - floats in the range [0,1].
Definition: TColor.h:80
void appendObservation(const mrpt::utils::CSerializablePtr &obj)
Like appendObservations() but for just one observation.
mrpt::system::TTimeStamp BASE_IMPEXP secondsToTimestamp(const double nSeconds)
Transform a time interval (in seconds) into TTimeStamp (e.g.
Definition: datetime.cpp:219
#define user_tracker
A generic joint for the skeleton observation.
uint32_t m_timeStartUI
Timestamp management.
renders glyphs as filled polygons
Definition: opengl_fonts.h:38
#define FILL_JOINT_DATA(_J1, _J2)
std::vector< double > m_joint_theta
Joint angles when no skeleton has been detected.



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019