Main MRPT website > C++ reference for MRPT 1.5.7
CSkeletonTracker.h
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 #ifndef CSkeletonTracker_H
11 #define CSkeletonTracker_H
12 
15 #include <mrpt/poses/CPose3D.h>
18 
19 namespace mrpt
20 {
21  namespace hwdrivers
22  {
23 
24  /** A class for grabbing mrpt::obs::CObservationSkeleton from a PrimeSense camera.
25  * It connects to a PrimeSense camera and tries to detect users while recording the positions of their skeletons' joints along time.
26  *
27  * See also the application "rawlog-grabber" for a ready-to-use application to gather data from this sensor.
28  *
29  * \code
30  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
31  * -------------------------------------------------------
32  * [supplied_section_name]
33  * driver = CSkeletonTracker
34  * sensorLabel = <label> ; Label of the sensor
35  * grab_decimation = 1 ; [int] Grab skeletons in 1 out of 'grab_decimation' frames.
36  * show_preview = 1 ; [bool] {0,1} Opens a display window to show the recorded skeleton.
37  * pose_x = 0 ; [double] Sensor 3D position relative to the robot (meters)
38  * pose_y = 0
39  * pose_z = 0
40  * pose_yaw = 0 ; [double] Angles in degrees
41  * pose_pitch = 0
42  * pose_roll = 0
43  *
44  * \endcode
45  * \ingroup mrpt_hwdrivers_grp
46  */
48  {
49 
50 enum JOINT {HEAD = 0, 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, NONE};
53 
54 #define NUM_JOINTS 15 // number of joints
55 #define NUM_LINES 14 // number of lines joining joints
56 
57  DEFINE_GENERIC_SENSOR(CSkeletonTracker)
58  protected:
59 
60  /** Opaque pointers to specific NITE data */
61  void * /* nite::SkeletonState* */ m_skeletons_ptr;
62  void * /* nite::userTracker* */ m_userTracker_ptr;
63 
64  /** Timestamp management */
67 
69  int m_nUsers; //!< Number of detected users
70 
71  /** Preview window management */
73  mrpt::gui::CDisplayWindow3DPtr m_win;
74  std::vector< std::pair<JOINT,JOINT> > m_linesToPlot; //!< Lines between joints
75  std::vector<double> m_joint_theta; //!< Joint angles when no skeleton has been detected
76 
77  unsigned int m_toutCounter; //!< Timeout counter (for internal use only)
78 
79  /** See the class documentation at the top for expected parameters */
80  void loadConfig_sensorSpecific(
81  const mrpt::utils::CConfigFileBase & configSource,
82  const std::string & iniSection );
83 
84  /** Displays real-time info for the captured skeleton */
85  void processPreview(const mrpt::obs::CObservationSkeletonPtr & obs);
86  void processPreviewNone();
87 
88  public:
89  /** Constructor
90  */
92 
93  /** Destructor
94  */
95  virtual ~CSkeletonTracker();
96 
97  /** This method will be invoked at a minimum rate of "process_rate" (Hz)
98  * \exception This method must throw an exception with a descriptive message if some critical error is found.
99  */
100  void doProcess();
101 
102  /** Connects to the PrimeSense camera and prepares it to get skeleton data */
103  void initialize();
104 
105  /** Set/unset preview */
106  inline void setPreview( const bool setPreview = true ) { m_showPreview = setPreview; }
107  }; // end of class
108 
109  } // end of namespace
110 } // end of namespace
111 
112 #endif
113 
114 
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
void * m_skeletons_ptr
Opaque pointers to specific NITE data.
mrpt::system::TTimeStamp m_timeStartTT
unsigned int m_toutCounter
Timeout counter (for internal use only)
std::vector< std::pair< JOINT, JOINT > > m_linesToPlot
Lines between joints.
int m_nUsers
Number of detected users.
This class allows loading and storing values and vectors of different types from a configuration text...
mrpt::poses::CPose3D m_sensorPose
Sensor pose.
A class for grabbing mrpt::obs::CObservationSkeleton from a PrimeSense camera.
GLsizei const GLchar ** string
Definition: glext.h:3919
Definition: inflate.h:25
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::gui::CDisplayWindow3DPtr m_win
bool m_showPreview
Preview window management.
void setPreview(const bool setPreview=true)
Set/unset preview.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
unsigned __int32 uint32_t
Definition: rptypes.h:49
uint32_t m_timeStartUI
Timestamp management.
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.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019