Skip to content

Commit 6d9ca41

Browse files
committed
chore: fix linter errors in launcher_visualization
1 parent 3b2e96a commit 6d9ca41

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

manager/manager/launcher/launcher_visualization.py

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
"""
2+
This module provides the LauncherVisualization class.
3+
4+
Responsible for managing visualization launchers in the Robotics Application Manager.
5+
"""
6+
17
from manager.libs.process_utils import get_class, class_from_module
28
from typing import Optional
39
from pydantic import BaseModel
410

511

6-
from manager.libs.process_utils import get_class, class_from_module, get_ros_version
12+
from manager.manager.launcher.launcher_world import LauncherWorldException
713
from manager.ram_logging.log_manager import LogManager
814
from manager.manager.launcher.launcher_interface import ILauncher
915

@@ -182,24 +188,37 @@
182188

183189

184190
class LauncherVisualization(BaseModel):
191+
"""Manages the launching and termination of visualization modules for the RAM."""
192+
185193
module: str = ".".join(__name__.split(".")[:-1])
186194
visualization: str
187195
visualization_config_path: Optional[str] = None
188196
launchers: Optional[ILauncher] = []
189197

190198
def run(self):
199+
"""Launch all visualization modules specified in the configuration."""
191200
for module in visualization[self.visualization]:
192201
launcher = self.launch_module(module)
193202
self.launchers.append(launcher)
194203

195204
def terminate(self):
205+
"""Terminate all running visualization launchers."""
196206
LogManager.logger.info("Terminating visualization launcher")
197207
for launcher in self.launchers:
198208
if launcher.is_running():
199209
launcher.terminate()
200210
self.launchers = []
201211

202212
def launch_module(self, configuration):
213+
"""
214+
Launch a visualization module based on the provided configuration.
215+
216+
Args:
217+
configuration (dict): Config dictionary for the visualization module.
218+
219+
Returns:
220+
ILauncher: The launcher instance for the visualization module.
221+
"""
203222
def process_terminated(name, exit_code):
204223
LogManager.logger.info(
205224
f"LauncherEngine: {name} exited with code {exit_code}"
@@ -208,16 +227,33 @@ def process_terminated(name, exit_code):
208227
self.terminated_callback(name, exit_code)
209228

210229
launcher_module_name = configuration["module"]
211-
launcher_module = f"{self.module}.launcher_{launcher_module_name}.Launcher{class_from_module(launcher_module_name)}"
230+
launcher_module = (
231+
f"{self.module}.launcher_{launcher_module_name}."
232+
f"Launcher{class_from_module(launcher_module_name)}"
233+
)
212234
launcher_class = get_class(launcher_module)
213235
launcher = launcher_class.from_config(launcher_class, configuration)
214236
launcher.run(self.visualization_config_path, process_terminated)
215237
return launcher
216238

217239
def launch_command(self, configuration):
240+
"""
241+
Launch a visualization command.
242+
243+
Args:
244+
configuration (dict): Config dictionary for the visualization command.
245+
"""
218246
pass
219247

220248

221249
class LauncherVisualizationException(Exception):
250+
"""Exception raised for errors in the LauncherVisualization."""
251+
222252
def __init__(self, message):
253+
"""
254+
Initialize the LauncherVisualizationException with an error message.
255+
256+
Args:
257+
message (str): The error message describing the exception.
258+
"""
223259
super(LauncherWorldException, self).__init__(message)

0 commit comments

Comments
 (0)