1+ """
2+ Gazebo Classic Launcher and Lifecycle Manager.
3+
4+ Handles the initialization, state management, and cleanup of the
5+ Gazebo GUI client (gzclient). Orchestrates display routing via
6+ VNC and provides hardware-accelerated rendering through VirtualGL
7+ when compatible DRI devices are detected.
8+ """
9+
110import sys
211from .launcher_interface import ILauncher
312from robotics_application_manager .manager .docker_thread import DockerThread
@@ -32,6 +41,13 @@ def call_service(service, service_type, request_data="{}"):
3241
3342
3443class LauncherGazebo (ILauncher ):
44+ """
45+ Orchestrator for Gazebo simulation visualization.
46+
47+ Manages the 'gzclient' lifecycle, including resolution configuration,
48+ X11 display mapping, and background thread monitoring.
49+ """
50+
3551 display : str
3652 internal_port : int
3753 external_port : int
@@ -43,6 +59,17 @@ class LauncherGazebo(ILauncher):
4359 gz_vnc : Any = Vnc_server ()
4460
4561 def run (self , config_file , callback ):
62+ """
63+ Launches the Gazebo client with appropriate display settings.
64+
65+ Checks for hardware acceleration support (DRI) and initializes the
66+ VNC server. Dynamically generates a 'gui.ini' file to ensure the
67+ simulation resolution matches the web frontend dimensions.
68+
69+ Args:
70+ config_file (str): Path to the exercise configuration.
71+ callback (function): Completion or state-change callback.
72+ """
4673 DRI_PATH = self .get_dri_path ()
4774 ACCELERATION_ENABLED = self .check_device (DRI_PATH )
4875
@@ -72,9 +99,11 @@ def run(self, config_file, callback):
7299 self .running = True
73100
74101 def pause (self ):
102+ """Suspends the physics engine via the /pause_physics ROS 2 service."""
75103 call_service ("/pause_physics" , "std_srvs/srv/Empty" )
76104
77105 def unpause (self ):
106+ """Resumes the physics engine via the /unpause_physics ROS 2 service."""
78107 call_service ("/unpause_physics" , "std_srvs/srv/Empty" )
79108
80109 def reset (self ):
0 commit comments