-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_analysis.orogen
More file actions
186 lines (123 loc) · 6.56 KB
/
data_analysis.orogen
File metadata and controls
186 lines (123 loc) · 6.56 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name "data_analysis"
using_library "data_analysis"
using_task_library "type_to_vector"
import_types_from "base"
import_types_from "data_analysis/sigmoid.hpp"
task_context "AbsTask", subclasses: "type_to_vector::BaseTask" do
doc "Compute the absolute value of the input data stream"
dynamic_output_port(/^abs_\d+$/, "/base/VectorXd").
doc "The output data stream, where each entry is taken as the absolute value of the input data stream."
port_driven
end
task_context "NormTask", subclasses: "type_to_vector::BaseTask" do
doc "Compute the lp norm of the input data stream"
property("p", "double").
doc "The exponent of the norm. Allowed values are
p = 1 -> sum norm
p = 2 -> euclidean norm
p = inf -> inf-norm/max.-norm"
dynamic_output_port(/^norm_\d+$/, "/double").
doc "The norm of the input data stream."
port_driven
end
task_context "RMSTask", subclasses: "type_to_vector::BaseTask" do
doc "Compute the RMS of the input data stream:
y = sqrt( (1/n) sum_1^n (x_n*x_n) )"
property("window_size", "double").
doc "The size of the filter window. Can be .Inf, in which case all input data ever arrived will be considered"
property("accumulate", "bool", false).
doc "Do not divide the Squared error by the number of samples (accumulated error)"
output_port("n_data", "base/VectorXd")
dynamic_output_port(/^norm_\d+$/, "/double").
doc "The norm of the input data stream."
dynamic_output_port(/^rms_\d+$/, "/double").
doc "The RMS of the input data stream."
operation("reset").
doc "Empty the data queue"
port_driven
end
task_context "MeanTask", subclasses: "type_to_vector::BaseTask" do
doc "Compute mean and std. dev. of the input data stream"
property("window_size", "double").
doc "The size of the filter window. Can be .Inf, in which case all input data ever arrived will be considered"
dynamic_output_port(/^mean_element_\d+$/, "/double").
doc "The mean of the last input sample."
dynamic_output_port(/^mean_\d+$/, "/base/VectorXd").
doc "The mean of the input data stream within the filter window."
dynamic_output_port(/^std_dev_\d+$/, "/base/VectorXd").
doc "The mean of the input data stream within the filter window."
operation("reset").
doc "Empty the data queue"
port_driven
end
task_context "MinMaxTask", subclasses: "type_to_vector::BaseTask" do
doc "Output the min value of the each element of the input data stream"
property("window_size", "double").
doc "The size of the filter window. Can be .Inf, in which case all input data ever arrived will be considered"
dynamic_output_port(/^min_\d+$/, "/double").
doc "The min. value of all elements and all data vectors in the filter window"
dynamic_output_port(/^max_\d+$/, "/double").
doc "The max. value of all elements and all data vectors in the filter window"
dynamic_output_port(/^min_coef_\d+$/, "/double").
doc "The min. value of the current sample"
dynamic_output_port(/^max_coef_\d+$/, "/double").
doc "The max. coefficient of the current sample"
operation("reset").
doc "Empty the data queue"
port_driven
end
task_context "DerivativeSGTask", subclasses: "type_to_vector::BaseTask" do
doc "Compute the first derivative of the input stream using a Savitzki Golay (SG) filter, as well as the normal derivative based
the mean of the (n-1)-th and (n+1)-th input sample."
property("window_size", "int", 11).
doc "The size of the filter window. Has to be positive and larger than poly_degree. A large value gives a smoother derivative, but increases
the phase shift between real and estimated derivate and also increases the computation effort"
property("poly_degree", "int", 2).
doc "Degree of the polynomial used for for filtering. Has to be smaller than window_size. A larger value gives a more accurate
(but not necessarily smoother) derivative and increases the computation effort"
property("expected_cycle_time", "double").
doc "The expected time between two consecutive input samples (two consecutive calls of updateHook()). This value will be used for (a) Scaling the SG Derivative (b) numerical
differentiation for the normal derivative (deltaT). Thus, this value should be as accurate as possible. If the expected cycle time is unknown,
this value can can be set to .NaN, in which case it will be computed internally (which usually leads to more noisy derivatives)"
output_port("derivative", "base/VectorXd").
doc "The normal derivative of the input stream using normal numerical differentiation (based on the mean of the (n-1)-th and (n+1)-th input sample)"
output_port("derivative_sg", "base/VectorXd").
doc "The (smooth) derivative of the input stream computed by the sg filter."
output_port("computation_time", "double").
doc "Computation time for filtering one input sample in seconds"
output_port("cycle_time", "double").
doc "Time between two subsequent incoming samples in seconds"
operation("reset").
doc "Empty the data queue"
port_driven
end
task_context "WeightedSumTask", subclasses: "type_to_vector::BaseTask" do
doc "Compute the weighted sum of n input streams"
property("weights", "base/VectorXd").
doc "Weighting factors of the weighted sum. Size has to be same as size of port_config vector"
output_port("weighted_sum", "base/VectorXd").
doc "The weighted sum of all input streams"
port_driven
end
task_context "SigmoidTask" do
doc "Implements a Generalized Sigmoid function: y = A + (K - A) / (1 + Q*exp(-B*(t - M)))
with: A - Lower Asymptote
K - Upper Asymptote
B - Growth rate
M - Horizontal shift
Q - Initial Value
The size of the port_config property has to be 1 See 'type_to_vector::BaseTask' for more info"
property("sigmoid_params", "data_analysis/SigmoidParams").
doc "Parameters for the Sigmoid function"
input_port("input_data", "double").
doc "The input data stream"
output_port("sigmoid", "double").
doc "The output sigmoid function"
operation("writeToFile").
argument("filename", "std/string").
argument("range_min", "double").
argument("range_max", "double").
argument("step_size", "double").
doc "Output the Sigmoid function to a file"
port_driven
end