forked from vislab-tecnico-lisboa/KinectBody2Yarp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFloorPlane.h
162 lines (134 loc) · 5.26 KB
/
FloorPlane.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// This is an automatically generated file.
// Generated from this FloorPlane.msg definition:
// # This represents the floor plane.
// #
// #Floor Determination
// #Each skeleton frame also contains a floor-clipping-plane vector, which contains the coefficients of an estimated floor-plane equation. The skeleton tracking system updates this estimate for each frame and uses it as a clipping plane for removing the background and segmenting players. The general plane equation is:
// # Ax + By + Cz + D = 0
// #
// #where:
// # A = vFloorClipPlane.x
// # B = vFloorClipPlane.y
// # C = vFloorClipPlane.z
// # D = vFloorClipPlane.w
// #
// #The equation is normalized so that the physical interpretation of D is the height of the camera from the floor, in meters. Note that the floor might not always be visible or detectable. In this case, the floor clipping plane is a zero vector.
// #The floor clipping plane is used in the vFloorClipPlane member of the NUI_SKELETON_FRAME structure (for C++) and in the FloorClipPlane property in managed code.
//
// float64 x
// float64 y
// float64 z
// float64 w
// Instances of this class can be read and written with YARP ports,
// using a ROS-compatible format.
#ifndef YARPMSG_TYPE_FloorPlane
#define YARPMSG_TYPE_FloorPlane
#include <string>
#include <vector>
#include <yarp/os/Wire.h>
#include <yarp/os/idl/WireTypes.h>
class FloorPlane : public yarp::os::idl::WirePortable {
public:
yarp::os::NetFloat64 x;
yarp::os::NetFloat64 y;
yarp::os::NetFloat64 z;
yarp::os::NetFloat64 w;
FloorPlane() {
}
bool readBare(yarp::os::ConnectionReader& connection) {
// *** x ***
x = connection.expectDouble();
// *** y ***
y = connection.expectDouble();
// *** z ***
z = connection.expectDouble();
// *** w ***
w = connection.expectDouble();
return !connection.isError();
}
bool readBottle(yarp::os::ConnectionReader& connection) {
connection.convertTextMode();
yarp::os::idl::WireReader reader(connection);
if (!reader.readListHeader(4)) return false;
// *** x ***
x = reader.expectDouble();
// *** y ***
y = reader.expectDouble();
// *** z ***
z = reader.expectDouble();
// *** w ***
w = reader.expectDouble();
return !connection.isError();
}
bool read(yarp::os::ConnectionReader& connection) {
if (connection.isBareMode()) return readBare(connection);
return readBottle(connection);
}
bool writeBare(yarp::os::ConnectionWriter& connection) {
// *** x ***
connection.appendDouble(x);
// *** y ***
connection.appendDouble(y);
// *** z ***
connection.appendDouble(z);
// *** w ***
connection.appendDouble(w);
return !connection.isError();
}
bool writeBottle(yarp::os::ConnectionWriter& connection) {
connection.appendInt(BOTTLE_TAG_LIST);
connection.appendInt(4);
// *** x ***
connection.appendInt(BOTTLE_TAG_DOUBLE);
connection.appendDouble((double)x);
// *** y ***
connection.appendInt(BOTTLE_TAG_DOUBLE);
connection.appendDouble((double)y);
// *** z ***
connection.appendInt(BOTTLE_TAG_DOUBLE);
connection.appendDouble((double)z);
// *** w ***
connection.appendInt(BOTTLE_TAG_DOUBLE);
connection.appendDouble((double)w);
connection.convertTextMode();
return !connection.isError();
}
bool write(yarp::os::ConnectionWriter& connection) {
if (connection.isBareMode()) return writeBare(connection);
return writeBottle(connection);
}
// This class will serialize ROS style or YARP style depending on protocol.
// If you need to force a serialization style, use one of these classes:
typedef yarp::os::idl::BareStyle<FloorPlane> rosStyle;
typedef yarp::os::idl::BottleStyle<FloorPlane> bottleStyle;
// Give source text for class, ROS will need this
yarp::os::ConstString getTypeText() {
return "# This represents the floor plane.\n\
#\n\
#Floor Determination\n\
#Each skeleton frame also contains a floor-clipping-plane vector, which contains the coefficients of an estimated floor-plane equation. The skeleton tracking system updates this estimate for each frame and uses it as a clipping plane for removing the background and segmenting players. The general plane equation is:\n\
# Ax + By + Cz + D = 0\n\
# \n\
#where:\n\
# A = vFloorClipPlane.x\n\
# B = vFloorClipPlane.y\n\
# C = vFloorClipPlane.z\n\
# D = vFloorClipPlane.w\n\
# \n\
#The equation is normalized so that the physical interpretation of D is the height of the camera from the floor, in meters. Note that the floor might not always be visible or detectable. In this case, the floor clipping plane is a zero vector.\n\
#The floor clipping plane is used in the vFloorClipPlane member of the NUI_SKELETON_FRAME structure (for C++) and in the FloorClipPlane property in managed code.\n\
\n\
float64 x\n\
float64 y\n\
float64 z\n\
float64 w";
}
// Name the class, ROS will need this
yarp::os::Type getType() {
yarp::os::Type typ = yarp::os::Type::byName("FloorPlane","FloorPlane");
typ.addProperty("md5sum",yarp::os::Value("a779879fadf0160734f906b8c19c7004"));
typ.addProperty("message_definition",yarp::os::Value(getTypeText()));
return typ;
}
};
#endif