-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadap_parameters_estimator.orogen
290 lines (206 loc) · 10.9 KB
/
adap_parameters_estimator.orogen
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name "adap_parameters_estimator"
using_library "adap_parameters_estimator"
using_library "adap_samples_input"
#using_library "motion_model"
import_types_from "adap_parameters_estimator/adap_parameters.hpp"
import_types_from "adap_parameters_estimator/adap_dataTypes.h"
import_types_from "adap_samples_input/samples_dataType.h"
#import_types_from "motion_model/MotionModel.hpp"
import_types_from "base"
task_context "Task" do
needs_configuration
#############################################################
#
# Properties
#
#############################################################
# Gain of model, must be a negative values.
property "gA", "base::VectorXd"
# Gain of parameters, must have positive values.
property "gLambda", "base::MatrixXd"
# Matrix of trhuster. In case the forces and torques are not directly considered
property "thrusterMatrix", "base::MatrixXd"
# If true, the input forces are the direct forces and torques applied in AUV. If false, the input are the forces applied by the thruster
property "body_forces", "bool", true
# Degree of freedom to be analyzed. If UNINITIALISED the method should identify (TODO: check it)
property "dofs", "adap_parameters_estimator::DOFS", :SURGE
# Sample time. Use for filter purpouse and integrator
property "sTime", "double", 0.01
# Frequencie of input thruster. Important for filter the parameters
property "ftau", "double", 0
# If true, use data from "dynamic_samples". If false use raw data from speed_samples and thruster_samples
property "aligned_data", "bool", true
#############################################################
#
# Methods
#
#############################################################
#operation("get_deltaV").
# returns("double")
#############################################################
#
# Input
#
#############################################################
input_port "thruster_samples", "base/samples/Joints"
doc "Samples of thruster actions. Forces and torques applied in AUV"
input_port "speed_samples", "base/samples/RigidBodyState"
doc "Measured input containing velocities"
input_port "dynamic_samples", "adap_samples_input::DynamicAUV"
doc "Measured input containing acceleration, velocity and force, in a aligned way"
#############################################################
#
# Output
#
#############################################################
output_port "parameters", "adap_parameters_estimator/Parameters"
doc "paremeters of the dynamic motion model"
output_port "deltaV", "double"
doc "error of the real velocity and the estimated velocity of the adap_method"
output_port "normDeltaV", "double"
doc "normalized error of the real velocity and the estimated velocity of the adap_method"
port_driven "dynamic_samples"
end
task_context "AdapModelEstimation" do
needs_configuration
#############################################################
#
# Properties
#
#############################################################
# Gain of model, must be a negative values.
property "gA", "base::VectorXd"
# Gain of parameters, must have positive values.
property "gLambda", "base::MatrixXd"
# Degree of freedom to be analyzed. If UNINITIALISED the method should identify (TODO: check it)
property "dofs", "adap_parameters_estimator::DOFS", :SURGE
# Sample time. Use for filter purpouse and integrator.
property "sTime", "double", 0.01
# Frequencie of sinusoidal input forces. Use for filter purpouse.
property "ftau", "double", 0
#############################################################
#
# Input
#
#############################################################
input_port "forces_samples", "base/samples/Joints"
doc "Samples of thruster actions. Forces and torques applied in AUV, in body-frame"
input_port "pose_samples", "base/samples/RigidBodyState"
doc "Measured velocities of AUV in body-frame"
#############################################################
#
# Output
#
#############################################################
output_port "parameters", "adap_parameters_estimator/Parameters"
doc "paremeters of the dynamic motion model"
output_port "deltaV", "double"
doc "error of the real velocity and the estimated velocity of the adap_method"
output_port "normDeltaV", "double"
doc "normalized error of the real velocity and the estimated velocity of the adap_method"
#******************************
#** Aggregator Parameters *****
#******************************
stream_aligner do
align_port("pose_samples", 0.01)
align_port("forces_samples", 0.01)
max_latency(0.1)
end
periodic 0.01
end
task_context "ForceApplier" do
needs_configuration
# The amount of actuators the vehicle has
property "number_of_thruster", "int"
# Convert thruster signal into forces, in positive direction. Should have the size of amount_of_actuators
property "thruster_coefficients_Pos", "base::VectorXd"
# Convert thruster signal into forces, in negative direction. Should have the size of amount_of_actuators
property "thruster_coefficients_Neg", "base::VectorXd"
# Matrix of trhuster. Identifie the forces and torques aplied for each of n trhuster
property "TCM", "base::MatrixXd"
# If left empty, uses RAW by default
property "control_modes", "std::vector<base::JointState::MODE>"
# In case the control mode is PWM, used to convert the signal into DC Voltage
property "thrusterVoltage", "double", 0
# Names of the thrusters
# Leave empty to use no names
property "names", "std::vector<std::string>"
## Thrusters signal
input_port('thruster_samples', '/base/samples/Joints').
doc("thrusters signal")
## Forces and torques applied in the vehicle in body-frame
output_port('forces', '/base/samples/Joints').
doc("Forces applied in the auv. Convert the input signal into force and applied the thruster matrix.")
## Forces and signals applied for each thruster in the vehicle
output_port('thruster_forces', '/base/samples/Joints').
doc("Forces and signals applied by each thruster in the auv.")
exception_states :WRONG_SIZE_OF_CONTROLMODES, :WRONG_SIZE_OF_THRUSTER_COEFFICIENTS, :WRONG_SIZE_OF_NAMES,
:WRONG_SIZE_OF_THRUSTER_MATRIX, :UNSET_THRUSTER_INPUT, :UNEXPECTED_THRUSTER_INPUT
port_driven 'thruster_samples'
end
task_context "ForceApplierModel" do
needs_configuration
# The amount of actuators the vehicle has
property "number_of_thruster", "int"
# Convert thruster signal into forces, in positive direction. Should have the size of amount_of_actuators
property "thruster_coefficients_Pos", "base::VectorXd"
# Convert thruster signal into forces, in negative direction. Should have the size of amount_of_actuators
property "thruster_coefficients_Neg", "base::VectorXd"
# Matrix of trhuster. Identifie the forces and torques aplied for each of n trhuster
property "TCM", "base::MatrixXd"
# If left empty, uses RAW by default
property "control_modes", "std::vector<base::JointState::MODE>"
# In case the control mode is PWM, used to convert the signal into DC Voltage
property "thrusterVoltage", "double", 0
# Names of the thrusters
# Leave empty to use no names
property "names", "std::vector<std::string>"
# Offset error of thruster forces found in motion identification. Added to the resulted forces
property "offset_forces", "base::VectorXd"
## Thrusters signal
input_port('thruster_samples', '/base/samples/Joints').
doc("thrusters signal")
## Forces and torques applied in the vehicle in body-frame
output_port('forces', '/base/samples/Joints').
doc("Forces applied in the auv. Convert the input signal into force and applied the thruster matrix.")
## Forces and signals applied for each thruster in the vehicle
output_port('thruster_forces', '/base/samples/Joints').
doc("Forces and signals applied by each thruster in the auv.")
exception_states :WRONG_SIZE_OF_CONTROLMODES, :WRONG_SIZE_OF_THRUSTER_COEFFICIENTS, :WRONG_SIZE_OF_NAMES,
:WRONG_SIZE_OF_THRUSTER_MATRIX, :UNSET_THRUSTER_INPUT, :UNEXPECTED_THRUSTER_INPUT
port_driven 'thruster_samples'
end
##########################################################################################
##########################################################################################
task_context "Evaluation" do
needs_configuration
#************************************************************************************
#***** PROPERTIES *****
#************************************************************************************
# define degree of freedom to be evaluate
property "dof", "adap_parameters_estimator::DOFS", :SURGE
#************************************************************************************
#***** INPUT PORTS *****
#************************************************************************************
#Input ports receive the RBS from the model and from the measured velocity and will compare the accurace of the model's parameters.
input_port "model_velocity", "/base/samples/RigidBodyState"
input_port "measured_velocity", "/base/samples/RigidBodyState"
#************************************************************************************
#***** OUTPUT PORTS *****
#************************************************************************************
#This output port will provide the error between the two velocities.
output_port "error_velocity", "double"
#This output port will provide the Mean Avarage Error (MAE)= mean(|error_velocity|).
output_port "mae_velocity", "double"
#This output port will provide the normalized MAE = mean(|error_velocity|) / mean(|velocity_measured|).
output_port "norm_mae_velocity", "double"
#******************************
#** Aggregator Parameters *****
#******************************
stream_aligner do
align_port("measured_velocity", 0.09)
align_port("model_velocity", 0.09)
max_latency(0.2)
end
periodic 0.01
end