Main MRPT website > C++ reference for MRPT 1.4.0
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
19namespace 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
50enum 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 */
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 */
81 const mrpt::utils::CConfigFileBase & configSource,
82 const std::string & iniSection );
83
84 /** Displays real-time info for the captured skeleton */
87
88 public:
89 /** Constructor
90 */
92
93 /** Destructor
94 */
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 */
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
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
A class for grabbing mrpt::obs::CObservationSkeleton from a PrimeSense camera.
unsigned int m_toutCounter
Timeout counter (for internal use only)
mrpt::poses::CPose3D m_sensorPose
Sensor pose.
void initialize()
Connects to the PrimeSense camera and prepares it to get skeleton data.
std::vector< double > m_joint_theta
Joint angles when no skeleton has been detected.
void * m_skeletons_ptr
Opaque pointers to specific NITE data.
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
void processPreview(const mrpt::obs::CObservationSkeletonPtr &obs)
Displays real-time info for the captured skeleton.
int m_nUsers
Number of detected users.
virtual ~CSkeletonTracker()
Destructor.
mrpt::system::TTimeStamp m_timeStartTT
std::vector< std::pair< JOINT, JOINT > > m_linesToPlot
Lines between joints.
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
uint32_t m_timeStartUI
Timestamp management.
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:73
This class allows loading and storing values and vectors of different types from a configuration text...
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
Definition: datetime.h:30
#define HWDRIVERS_IMPEXP
struct GUI_IMPEXP CDisplayWindow3DPtr
struct OBS_IMPEXP CObservationSkeletonPtr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned long uint32_t
Definition: pstdint.h:216



Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 08:20:48 UTC 2023