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