Skip to content

Commit a9e4854

Browse files
committed
Improve code formatting
1 parent 382b2dc commit a9e4854

File tree

1 file changed

+45
-20
lines changed
  • clearpath_generator_common/clearpath_generator_common/param

1 file changed

+45
-20
lines changed

clearpath_generator_common/clearpath_generator_common/param/platform.py

Lines changed: 45 additions & 20 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,29 +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+
})
238243

239244
# Add cooling for A300 only for now
240245
if self.clearpath_config.get_platform_model() == Platform.A300:
241-
self.param_file.update(
242-
{self.DIAGNOSTIC_AGGREGATOR_NODE: {
246+
self.param_file.update({
247+
self.DIAGNOSTIC_AGGREGATOR_NODE: {
243248
'platform': {
244249
'analyzers': {
245250
'cooling': {
246251
'type': 'diagnostic_aggregator/GenericAnalyzer',
247252
'path': 'Cooling',
248-
'contains': ['Fan', 'Thermal']}}}}})
253+
'contains': ['Fan', 'Thermal']
254+
}
255+
}
256+
}
257+
}
258+
})
249259

250260
if self.clearpath_config.platform.enable_ekf:
251-
self.param_file.update(
252-
{self.DIAGNOSTIC_AGGREGATOR_NODE: {
261+
self.param_file.update({
262+
self.DIAGNOSTIC_AGGREGATOR_NODE: {
253263
'platform': {
254264
'analyzers': {
255265
'odometry': {
256266
'expected': [
257267
'ekf_node: Filter diagnostic updater',
258268
'ekf_node: odometry/filtered topic status',
259-
]}}}}})
269+
]
270+
}
271+
}
272+
}
273+
}
274+
})
260275

261276
sensor_analyzers = {}
262277

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

301316
# Update aggregator sensor sections based on the robot.yaml
302317
if sensor_analyzers:
303-
self.param_file.update(
304-
{self.DIAGNOSTIC_AGGREGATOR_NODE: {
318+
self.param_file.update({
319+
self.DIAGNOSTIC_AGGREGATOR_NODE: {
305320
'sensors': {
306321
'type': 'diagnostic_aggregator/AnalyzerGroup',
307322
'path': 'Sensors',
308-
'analyzers': sensor_analyzers}}})
323+
'analyzers': sensor_analyzers
324+
}
325+
}
326+
})
309327

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

327345
# Update parameters based on the robot.yaml
328346
platform_model = self.clearpath_config.get_platform_model()
329-
self.param_file.update({self.DIAGNOSTIC_UPDATER_NODE: {
330-
'serial_number': self.clearpath_config.get_serial_number(),
331-
'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+
})
332353

333354
if use_sim_time:
334355
latest_apt_firmware_version = 'simulated'
@@ -350,10 +371,13 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
350371
print(f'\033[93mWarning: ros-{ROS_DISTRO}-clearpath-firmware'
351372
' package not found\033[0m')
352373

353-
self.param_file.update({self.DIAGNOSTIC_UPDATER_NODE: {
354-
'ros_distro': ROS_DISTRO,
355-
'latest_apt_firmware_version': latest_apt_firmware_version,
356-
'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+
})
357381

358382
# List all topics to be monitored from each launched sensor
359383
for sensor in self.clearpath_config.sensors.get_all_sensors():
@@ -404,7 +428,8 @@ def add_topic(self, sensor: BaseSensor, topic_key: str) -> None:
404428
"""
405429
self.diag_dict[sensor.get_topic_name(topic_key, local=True)] = {
406430
'type': sensor.get_topic_type(topic_key),
407-
'rate': float(sensor.get_topic_rate(topic_key))}
431+
'rate': float(sensor.get_topic_rate(topic_key))
432+
}
408433

409434
class LocalizationParam(BaseParam):
410435
EKF_NODE = 'ekf_node'

0 commit comments

Comments
 (0)