Skip to content

Commit d2b7702

Browse files
authored
Add cooling and ekf-node diagnostic settings conditionally (#209)
* Add cooling and ekf-node diagnostic settings conditionally
1 parent 6529957 commit d2b7702

File tree

1 file changed

+61
-14
lines changed
  • clearpath_generator_common/clearpath_generator_common/param

1 file changed

+61
-14
lines changed

clearpath_generator_common/clearpath_generator_common/param/platform.py

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
223223

224224
# Add MCU diagnostic category for all platforms except A200
225225
if self.clearpath_config.get_platform_model() != Platform.A200:
226-
self.param_file.update(
227-
{self.DIAGNOSTIC_AGGREGATOR_NODE: {
226+
self.param_file.update({
227+
self.DIAGNOSTIC_AGGREGATOR_NODE: {
228228
'platform': {
229229
'analyzers': {
230230
'mcu': {
@@ -234,7 +234,44 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
234234
'clearpath_diagnostic_updater: MCU Firmware Version',
235235
'clearpath_diagnostic_updater: MCU Status'
236236
],
237-
'contains': ['MCU']}}}}})
237+
'contains': ['MCU']
238+
}
239+
}
240+
}
241+
}
242+
})
243+
244+
# Add cooling for A300 only for now
245+
if self.clearpath_config.get_platform_model() == Platform.A300:
246+
self.param_file.update({
247+
self.DIAGNOSTIC_AGGREGATOR_NODE: {
248+
'platform': {
249+
'analyzers': {
250+
'cooling': {
251+
'type': 'diagnostic_aggregator/GenericAnalyzer',
252+
'path': 'Cooling',
253+
'contains': ['Fan', 'Thermal']
254+
}
255+
}
256+
}
257+
}
258+
})
259+
260+
if self.clearpath_config.platform.enable_ekf:
261+
self.param_file.update({
262+
self.DIAGNOSTIC_AGGREGATOR_NODE: {
263+
'platform': {
264+
'analyzers': {
265+
'odometry': {
266+
'expected': [
267+
'ekf_node: Filter diagnostic updater',
268+
'ekf_node: odometry/filtered topic status',
269+
]
270+
}
271+
}
272+
}
273+
}
274+
})
238275

239276
sensor_analyzers = {}
240277

@@ -278,12 +315,15 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
278315

279316
# Update aggregator sensor sections based on the robot.yaml
280317
if sensor_analyzers:
281-
self.param_file.update(
282-
{self.DIAGNOSTIC_AGGREGATOR_NODE: {
318+
self.param_file.update({
319+
self.DIAGNOSTIC_AGGREGATOR_NODE: {
283320
'sensors': {
284321
'type': 'diagnostic_aggregator/AnalyzerGroup',
285322
'path': 'Sensors',
286-
'analyzers': sensor_analyzers}}})
323+
'analyzers': sensor_analyzers
324+
}
325+
}
326+
})
287327

288328
class DiagnosticsUpdaterParam(BaseParam):
289329
"""Parameter file for Clearpath Diagnostics indicating which topics to monitor."""
@@ -304,9 +344,12 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
304344

305345
# Update parameters based on the robot.yaml
306346
platform_model = self.clearpath_config.get_platform_model()
307-
self.param_file.update({self.DIAGNOSTIC_UPDATER_NODE: {
308-
'serial_number': self.clearpath_config.get_serial_number(),
309-
'platform_model': platform_model}})
347+
self.param_file.update({
348+
self.DIAGNOSTIC_UPDATER_NODE: {
349+
'serial_number': self.clearpath_config.get_serial_number(),
350+
'platform_model': platform_model
351+
}
352+
})
310353

311354
if use_sim_time:
312355
latest_apt_firmware_version = 'simulated'
@@ -328,10 +371,13 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
328371
print(f'\033[93mWarning: ros-{ROS_DISTRO}-clearpath-firmware'
329372
' package not found\033[0m')
330373

331-
self.param_file.update({self.DIAGNOSTIC_UPDATER_NODE: {
332-
'ros_distro': ROS_DISTRO,
333-
'latest_apt_firmware_version': latest_apt_firmware_version,
334-
'installed_apt_firmware_version': installed_apt_firmware_version}})
374+
self.param_file.update({
375+
self.DIAGNOSTIC_UPDATER_NODE: {
376+
'ros_distro': ROS_DISTRO,
377+
'latest_apt_firmware_version': latest_apt_firmware_version,
378+
'installed_apt_firmware_version': installed_apt_firmware_version
379+
}
380+
})
335381

336382
# List all topics to be monitored from each launched sensor
337383
for sensor in self.clearpath_config.sensors.get_all_sensors():
@@ -382,7 +428,8 @@ def add_topic(self, sensor: BaseSensor, topic_key: str) -> None:
382428
"""
383429
self.diag_dict[sensor.get_topic_name(topic_key, local=True)] = {
384430
'type': sensor.get_topic_type(topic_key),
385-
'rate': float(sensor.get_topic_rate(topic_key))}
431+
'rate': float(sensor.get_topic_rate(topic_key))
432+
}
386433

387434
class LocalizationParam(BaseParam):
388435
EKF_NODE = 'ekf_node'

0 commit comments

Comments
 (0)