Now you can download a copy of these docs so you can use them offline! Download now
Kinect.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2011. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef __KINECT_H__
8 #define __KINECT_H__
9 
10 #include "SensorBase.h"
11 #include "Skeleton.h"
12 
13 #include <semLib.h>
14 
15 #define kNumSkeletons 1
16 
24 class Kinect : public SensorBase
25 {
26 public:
27  typedef enum {kNotTracked, kPositionOnly, kTracked} SkeletonTrackingState;
28  typedef enum {kClippedRight = 1, kClippedLeft = 2, kClippedTop = 4, kClippedBottom = 8} SkeletonQuality;
29  typedef struct
30  {
31  float x;
32  float y;
33  float z;
34  float w;
35  } Point4;
36 
37  int GetNumberOfPlayers();
40  Skeleton GetSkeleton(int skeletonIndex = 1);
41  Point4 GetPosition(int skeletonIndex = 1);
42  uint32_t GetQuality(int skeletonIndex = 1);
43  SkeletonTrackingState GetTrackingState(int skeletonIndex = 1);
44 
45  static Kinect *GetInstance();
46 
47 private:
48  Kinect();
49  ~Kinect();
50  void UpdateData();
51 
52  DISALLOW_COPY_AND_ASSIGN(Kinect);
53 
54  uint32_t m_recentPacketNumber;
55  SEM_ID m_dataLock;
56  int m_numberOfPlayers;
57  Point4 m_floorClipPlane;
58  Point4 m_gravityNormal;
59  Point4 m_position[kNumSkeletons];
60  uint32_t m_quality[kNumSkeletons];
61  SkeletonTrackingState m_trackingState[kNumSkeletons];
62  Skeleton m_skeletons[kNumSkeletons];
63 
64  // TODO: Include structs for this data format (would be clearer than 100 magic numbers)
65  char m_rawHeader[46];
66  char m_rawSkeletonExtra[42];
67  char m_rawSkeleton[242];
68 
69  static Kinect *_instance;
70 };
71 
72 #endif
73 
int GetNumberOfPlayers()
Definition: Kinect.cpp:54
Skeleton GetSkeleton(int skeletonIndex=1)
Definition: Kinect.cpp:87
Point4 GetGravityNormal()
Definition: Kinect.cpp:74
Point4 GetPosition(int skeletonIndex=1)
Definition: Kinect.cpp:103
static Kinect * GetInstance()
Definition: Kinect.cpp:43
SkeletonTrackingState GetTrackingState(int skeletonIndex=1)
Definition: Kinect.cpp:137
uint32_t GetQuality(int skeletonIndex=1)
Definition: Kinect.cpp:120
Point4 GetFloorClipPlane()
Definition: Kinect.cpp:64
Definition: Kinect.h:24

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6