Skip to content

Commit 85ea0ea

Browse files
authored
Merge pull request #278 from manashree-kalhapure/docs/inline-documentation-3111
docs(launcher): add technical docstrings for Gazebo and RViz #3111
2 parents d7a0ef1 + b49cfdc commit 85ea0ea

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

robotics_application_manager/manager/launcher/launcher_gazebo.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
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+
110
import sys
211
from .launcher_interface import ILauncher
312
from robotics_application_manager.manager.docker_thread import DockerThread
@@ -32,6 +41,13 @@ def call_service(service, service_type, request_data="{}"):
3241

3342

3443
class 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):

robotics_application_manager/manager/launcher/launcher_rviz.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
"""
2+
RViz Visualization Launcher for ROS 2.
3+
4+
Handles the initialization and lifecycle of the ROS 2 Visualization tool (RViz).
5+
Orchestrates the loading of .rviz configuration files and manages the X11
6+
display environment to project sensor data (Lidar, Cameras, TF frames)
7+
to the web frontend.
8+
"""
19
from .launcher_interface import ILauncher
210
from robotics_application_manager.manager.docker_thread import DockerThread
311
from robotics_application_manager.manager.vnc import Vnc_server
@@ -17,6 +25,14 @@ class LauncherRviz(ILauncher):
1725
console_vnc: Any = Vnc_server()
1826

1927
def run(self, config_file, callback):
28+
"""
29+
Launches an RViz instance with a specific display configuration.
30+
31+
Args:
32+
config_file (str): Path to the .rviz file defining the
33+
displays and robot model.
34+
callback (function): Lifecycle state-change callback.
35+
"""
2036
DRI_PATH = self.get_dri_path()
2137
ACCELERATION_ENABLED = self.check_device(DRI_PATH)
2238

0 commit comments

Comments
 (0)