MRPT  1.9.9
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-2018, 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 
14 #include <mrpt/comms/CSerialPort.h>
15 #include <mrpt/poses/CPose3D.h>
18 
19 namespace mrpt::hwdrivers
20 {
21 // clang-format off
22 /** A class for grabbing mrpt::obs::CObservationSkeleton from a PrimeSense
23  *camera.
24  * It connects to a PrimeSense camera and tries to detect users while
25  *recording the positions of their skeletons' joints along time.
26  *
27  * See also the application "rawlog-grabber" for a ready-to-use application to
28  *gather data from this sensor.
29  *
30  * \code
31  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
32  * -------------------------------------------------------
33  * [supplied_section_name]
34  * driver = CSkeletonTracker
35  * sensorLabel = <label> ; Label of the sensor
36  * grab_decimation = 1 ; [int] Grab skeletons in 1 out of 'grab_decimation' frames.
37  * show_preview = 1 ; [bool] {0,1} Opens a display window to show the recorded skeleton.
38  * pose_x = 0 ; [double] Sensor 3D position relative to the robot (meters)
39  * pose_y = 0
40  * pose_z = 0
41  * pose_yaw = 0 ; [double] Angles in degrees
42  * pose_pitch = 0
43  * pose_roll = 0
44  *
45  * \endcode
46  * \ingroup mrpt_hwdrivers_grp
47  */ // clang-format on
49 {
50  enum JOINT
51  {
52  HEAD = 0,
68  };
69 
70 #define NUM_JOINTS 15 // number of joints
71 #define NUM_LINES 14 // number of lines joining joints
72 
74  protected:
75  /** Opaque pointers to specific NITE data */
76  void* /* nite::SkeletonState* */ m_skeletons_ptr;
77  void* /* nite::userTracker* */ m_userTracker_ptr;
78 
79  /** Timestamp management */
82 
83  /** Sensor pose */
85  /** Number of detected users */
86  int m_nUsers;
87 
88  /** Preview window management */
91  /** Lines between joints */
92  std::vector<std::pair<JOINT, JOINT>> m_linesToPlot;
93  /** Joint angles when no skeleton has been detected */
94  std::vector<double> m_joint_theta;
95 
96  /** Timeout counter (for internal use only) */
97  unsigned int m_toutCounter;
98 
99  /** See the class documentation at the top for expected parameters */
101  const mrpt::config::CConfigFileBase& configSource,
102  const std::string& iniSection);
103 
104  /** Displays real-time info for the captured skeleton */
106  void processPreviewNone();
107 
108  public:
109  /** Constructor
110  */
112 
113  /** Destructor
114  */
115  virtual ~CSkeletonTracker();
116 
117  /** This method will be invoked at a minimum rate of "process_rate" (Hz)
118  * \exception This method must throw an exception with a descriptive
119  * message if some critical error is found.
120  */
121  void doProcess();
122 
123  /** Connects to the PrimeSense camera and prepares it to get skeleton data
124  */
125  void initialize();
126 
127  /** Set/unset preview */
128  inline void setPreview(const bool setPreview = true)
129  {
131  }
132 }; // end of class
133 
134 }
135 #endif
136 
137 
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
void * m_skeletons_ptr
Opaque pointers to specific NITE data.
virtual ~CSkeletonTracker()
Destructor.
mrpt::system::TTimeStamp m_timeStartTT
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
unsigned int m_toutCounter
Timeout counter (for internal use only)
Contains classes for various device interfaces.
int m_nUsers
Number of detected users.
mrpt::poses::CPose3D m_sensorPose
Sensor pose.
void processPreview(const mrpt::obs::CObservationSkeleton::Ptr &obs)
Displays real-time info for the captured skeleton.
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
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 initialize()
Connects to the PrimeSense camera and prepares it to get skeleton data.
std::vector< std::pair< JOINT, JOINT > > m_linesToPlot
Lines between joints.
GLsizei const GLchar ** string
Definition: glext.h:4101
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
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:86
unsigned __int32 uint32_t
Definition: rptypes.h:47
uint32_t m_timeStartUI
Timestamp management.
mrpt::gui::CDisplayWindow3D::Ptr m_win
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020