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



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST