Skip to content

Commit fe52157

Browse files
committed
Get user specified parameters at startup
1 parent eb4d1d6 commit fe52157

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

draco_point_cloud_transport/src/draco_publisher.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
8585
declareParam<int>(
8686
encode_speed_paramDescriptor.name, config_.encode_speed,
8787
encode_speed_paramDescriptor);
88+
getParam<int>(encode_speed_paramDescriptor.name, config_.encode_speed);
8889

8990
rcl_interfaces::msg::ParameterDescriptor decode_speed_paramDescriptor;
9091
decode_speed_paramDescriptor.name = "decode_speed";
@@ -99,6 +100,7 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
99100
declareParam<int>(
100101
decode_speed_paramDescriptor.name, config_.decode_speed,
101102
decode_speed_paramDescriptor);
103+
getParam<int>(decode_speed_paramDescriptor.name, config_.decode_speed);
102104

103105
rcl_interfaces::msg::ParameterDescriptor encode_method_paramDescriptor;
104106
encode_method_paramDescriptor.name = "encode_method";
@@ -113,13 +115,15 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
113115
declareParam<int>(
114116
encode_method_paramDescriptor.name, config_.encode_method,
115117
encode_method_paramDescriptor);
118+
getParam<int>(encode_method_paramDescriptor.name, config_.encode_method);
116119

117120
rcl_interfaces::msg::ParameterDescriptor deduplicate_paramDescriptor;
118121
deduplicate_paramDescriptor.name = "deduplicate";
119122
deduplicate_paramDescriptor.type = rcl_interfaces::msg::ParameterType::PARAMETER_BOOL;
120123
deduplicate_paramDescriptor.description =
121124
"Remove duplicate point entries.";
122125
declareParam<bool>(deduplicate_paramDescriptor.name, true, deduplicate_paramDescriptor);
126+
getParam<bool>(deduplicate_paramDescriptor.name, config_.deduplicate);
123127

124128
rcl_interfaces::msg::ParameterDescriptor force_quantization_paramDescriptor;
125129
force_quantization_paramDescriptor.name = "force_quantization";
@@ -130,6 +134,7 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
130134
declareParam<bool>(
131135
force_quantization_paramDescriptor.name, config_.force_quantization,
132136
force_quantization_paramDescriptor);
137+
getParam<bool>(force_quantization_paramDescriptor.name, config_.force_quantization);
133138

134139
rcl_interfaces::msg::ParameterDescriptor quantization_POSITION_paramDescriptor;
135140
quantization_POSITION_paramDescriptor.name = "quantization_POSITION";
@@ -143,8 +148,9 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
143148
.set__to_value(31)
144149
.set__step(1)});
145150
declareParam<int>(
146-
quantization_POSITION_paramDescriptor.name, config_.quantization_NORMAL,
151+
quantization_POSITION_paramDescriptor.name, config_.quantization_POSITION,
147152
quantization_POSITION_paramDescriptor);
153+
getParam<int>(quantization_POSITION_paramDescriptor.name, config_.quantization_POSITION);
148154

149155
rcl_interfaces::msg::ParameterDescriptor quantization_NORMAL_paramDescriptor;
150156
quantization_NORMAL_paramDescriptor.name = "quantization_NORMAL";
@@ -157,8 +163,9 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
157163
.set__to_value(31)
158164
.set__step(1)});
159165
declareParam<int>(
160-
quantization_NORMAL_paramDescriptor.name, config_.quantization_COLOR,
166+
quantization_NORMAL_paramDescriptor.name, config_.quantization_NORMAL,
161167
quantization_NORMAL_paramDescriptor);
168+
getParam<int>(quantization_NORMAL_paramDescriptor.name, config_.quantization_NORMAL);
162169

163170
rcl_interfaces::msg::ParameterDescriptor quantization_COLOR_paramDescriptor;
164171
quantization_COLOR_paramDescriptor.name = "quantization_COLOR";
@@ -171,8 +178,9 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
171178
.set__to_value(31)
172179
.set__step(1)});
173180
declareParam<int>(
174-
quantization_COLOR_paramDescriptor.name, config_.quantization_TEX_COORD,
181+
quantization_COLOR_paramDescriptor.name, config_.quantization_COLOR,
175182
quantization_COLOR_paramDescriptor);
183+
getParam<int>(quantization_COLOR_paramDescriptor.name, config_.quantization_COLOR);
176184

177185
rcl_interfaces::msg::ParameterDescriptor quantization_TEX_COORD_paramDescriptor;
178186
quantization_TEX_COORD_paramDescriptor.name = "quantization_TEX_COORD";
@@ -186,8 +194,9 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
186194
.set__to_value(31)
187195
.set__step(1)});
188196
declareParam<int>(
189-
quantization_TEX_COORD_paramDescriptor.name, config_.quantization_GENERIC,
197+
quantization_TEX_COORD_paramDescriptor.name, config_.quantization_TEX_COORD,
190198
quantization_TEX_COORD_paramDescriptor);
199+
getParam<int>(quantization_TEX_COORD_paramDescriptor.name, config_.quantization_TEX_COORD);
191200

192201
rcl_interfaces::msg::ParameterDescriptor quantization_GENERIC_paramDescriptor;
193202
quantization_GENERIC_paramDescriptor.name = "quantization_GENERIC";
@@ -201,8 +210,9 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
201210
.set__to_value(31)
202211
.set__step(1)});
203212
declareParam<int>(
204-
quantization_GENERIC_paramDescriptor.name, config_.quantization_POSITION,
213+
quantization_GENERIC_paramDescriptor.name, config_.quantization_GENERIC,
205214
quantization_GENERIC_paramDescriptor);
215+
getParam<int>(quantization_GENERIC_paramDescriptor.name, config_.quantization_GENERIC);
206216

207217
rcl_interfaces::msg::ParameterDescriptor expert_quantization_paramDescriptor;
208218
expert_quantization_paramDescriptor.name = "expert_quantization";
@@ -214,6 +224,7 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
214224
declareParam<bool>(
215225
expert_quantization_paramDescriptor.name, config_.expert_quantization,
216226
expert_quantization_paramDescriptor);
227+
getParam<bool>(expert_quantization_paramDescriptor.name, config_.expert_quantization);
217228

218229
rcl_interfaces::msg::ParameterDescriptor expert_attribute_types_paramDescriptor;
219230
expert_attribute_types_paramDescriptor.name = "expert_attribute_types";
@@ -225,7 +236,9 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
225236
declareParam<bool>(
226237
expert_attribute_types_paramDescriptor.name, config_.expert_attribute_types,
227238
expert_attribute_types_paramDescriptor);
239+
getParam<bool>(expert_attribute_types_paramDescriptor.name, config_.expert_attribute_types);
228240

241+
// we call get param at runtime to get the latest value for these
229242
declareParam<std::string>("attribute_mapping.attribute_type.x", "POSITION");
230243
declareParam<std::string>("attribute_mapping.attribute_type.y", "POSITION");
231244
declareParam<std::string>("attribute_mapping.attribute_type.z", "POSITION");

draco_point_cloud_transport/src/draco_subscriber.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ namespace draco_point_cloud_transport
4848
void DracoSubscriber::declareParameters()
4949
{
5050
declareParam<bool>(std::string("SkipDequantizationPOSITION"), false);
51+
getParam<bool>(std::string("SkipDequantizationPOSITION"), config_.SkipDequantizationPOSITION);
5152
declareParam<bool>(std::string("SkipDequantizationNORMAL"), false);
53+
getParam<bool>(std::string("SkipDequantizationNORMAL"), config_.SkipDequantizationNORMAL);
5254
declareParam<bool>(std::string("SkipDequantizationCOLOR"), false);
55+
getParam<bool>(std::string("SkipDequantizationCOLOR"), config_.SkipDequantizationCOLOR);
5356
declareParam<bool>(std::string("SkipDequantizationTEX_COORD"), false);
57+
getParam<bool>(std::string("SkipDequantizationTEX_COORD"), config_.SkipDequantizationTEX_COORD);
5458
declareParam<bool>(std::string("SkipDequantizationGENERIC"), false);
59+
getParam<bool>(std::string("SkipDequantizationGENERIC"), config_.SkipDequantizationGENERIC);
5560

5661
auto param_change_callback =
5762
[this](std::vector<rclcpp::Parameter> parameters) -> rcl_interfaces::msg::SetParametersResult

zlib_point_cloud_transport/src/zlib_publisher.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void ZlibPublisher::declareParameters(const std::string & base_topic)
5454
declareParam<int>(
5555
encode_level_paramDescriptor.name, this->encode_level_,
5656
encode_level_paramDescriptor);
57+
getParam<int>(encode_level_paramDescriptor.name, this->encode_level_);
5758

5859
auto param_change_callback =
5960
[this](const std::vector<rclcpp::Parameter> & parameters) -> rcl_interfaces::msg::

zstd_point_cloud_transport/src/zstd_publisher.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void ZstdPublisher::declareParameters(const std::string & base_topic)
5858
declareParam<int>(
5959
encode_level_paramDescriptor.name, this->encode_level_,
6060
encode_level_paramDescriptor);
61+
getParam<int>(encode_level_paramDescriptor.name, this->encode_level_);
6162

6263
auto param_change_callback =
6364
[this](const std::vector<rclcpp::Parameter> & parameters) -> rcl_interfaces::msg::

0 commit comments

Comments
 (0)