blob: 89e923493067af1b5996c895a2ca1ec5c7b907e1 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/*----------------------------------------------------------------------------*/
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 __SKELETON_H__
8#define __SKELETON_H__
9
10/**
11 * Represents Skeleton data from a Kinect device connected to the
12 * Driver Station. See Getting Started with Microsoft Kinect for
13 * FRC and the Kinect for Windows SDK API reference for more information
14 */
15class Skeleton
16{
17 friend class Kinect;
18public:
19 typedef enum
20 {
21 HipCenter = 0,
22 Spine = 1,
23 ShoulderCenter = 2,
24 Head = 3,
25 ShoulderLeft = 4,
26 ElbowLeft = 5,
27 WristLeft = 6,
28 HandLeft = 7,
29 ShoulderRight = 8,
30 ElbowRight = 9,
31 WristRight = 10,
32 HandRight = 11,
33 HipLeft = 12,
34 KneeLeft = 13,
35 AnkleLeft = 14,
36 FootLeft = 15,
37 HipRight = 16,
38 KneeRight = 17,
39 AnkleRight = 18,
40 FootRight = 19,
41 JointCount = 20
42 } JointTypes;
43
44 typedef enum {kNotTracked, kInferred, kTracked} JointTrackingState;
45
46 typedef struct
47 {
48 float x;
49 float y;
50 float z;
51 JointTrackingState trackingState;
52 } Joint;
53
54 Joint GetHandRight() { return m_joints[HandRight]; }
55 Joint GetHandLeft() { return m_joints[HandLeft]; }
56 Joint GetWristRight() { return m_joints[WristRight]; }
57 Joint GetWristLeft() { return m_joints[WristLeft]; }
58 Joint GetElbowLeft() { return m_joints[ElbowLeft]; }
59 Joint GetElbowRight() { return m_joints[ElbowRight]; }
60 Joint GetShoulderLeft() { return m_joints[ShoulderLeft]; }
61 Joint GetShoulderRight() { return m_joints[ShoulderRight]; }
62 Joint GetShoulderCenter() { return m_joints[ShoulderCenter]; }
63 Joint GetHead() { return m_joints[Head]; }
64 Joint GetSpine() { return m_joints[Spine]; }
65 Joint GetHipCenter() { return m_joints[HipCenter]; }
66 Joint GetHipRight() { return m_joints[HipRight]; }
67 Joint GetHipLeft() { return m_joints[HipLeft]; }
68 Joint GetKneeLeft() { return m_joints[KneeLeft]; }
69 Joint GetKneeRight() { return m_joints[KneeRight]; }
70 Joint GetAnkleLeft() { return m_joints[AnkleLeft]; }
71 Joint GetAnkleRight() { return m_joints[AnkleRight]; }
72 Joint GetFootLeft() { return m_joints[FootLeft]; }
73 Joint GetFootRight() { return m_joints[FootRight]; }
74 Joint GetJointValue(JointTypes index) { return m_joints[index]; }
75
76private:
77 Joint m_joints[20];
78};
79
80#endif
81