Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions robotics_application_manager/manager/launcher/launcher_gazebo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
Gazebo Classic Launcher and Lifecycle Manager.

Handles the initialization, state management, and cleanup of the
Gazebo GUI client (gzclient). Orchestrates display routing via
VNC and provides hardware-accelerated rendering through VirtualGL
when compatible DRI devices are detected.
"""

import sys
from .launcher_interface import ILauncher
from robotics_application_manager.manager.docker_thread import DockerThread
Expand Down Expand Up @@ -32,6 +41,13 @@ def call_service(service, service_type, request_data="{}"):


class LauncherGazebo(ILauncher):
"""
Orchestrator for Gazebo simulation visualization.

Manages the 'gzclient' lifecycle, including resolution configuration,
X11 display mapping, and background thread monitoring.
"""

display: str
internal_port: int
external_port: int
Expand All @@ -43,6 +59,17 @@ class LauncherGazebo(ILauncher):
gz_vnc: Any = Vnc_server()

def run(self, config_file, callback):
"""
Launches the Gazebo client with appropriate display settings.

Checks for hardware acceleration support (DRI) and initializes the
VNC server. Dynamically generates a 'gui.ini' file to ensure the
simulation resolution matches the web frontend dimensions.

Args:
config_file (str): Path to the exercise configuration.
callback (function): Completion or state-change callback.
"""
DRI_PATH = self.get_dri_path()
ACCELERATION_ENABLED = self.check_device(DRI_PATH)

Expand Down Expand Up @@ -72,9 +99,11 @@ def run(self, config_file, callback):
self.running = True

def pause(self):
"""Suspends the physics engine via the /pause_physics ROS 2 service."""
call_service("/pause_physics", "std_srvs/srv/Empty")

def unpause(self):
"""Resumes the physics engine via the /unpause_physics ROS 2 service."""
call_service("/unpause_physics", "std_srvs/srv/Empty")

def reset(self):
Expand Down
16 changes: 16 additions & 0 deletions robotics_application_manager/manager/launcher/launcher_rviz.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
RViz Visualization Launcher for ROS 2.

Handles the initialization and lifecycle of the ROS 2 Visualization tool (RViz).
Orchestrates the loading of .rviz configuration files and manages the X11
display environment to project sensor data (Lidar, Cameras, TF frames)
to the web frontend.
"""
from .launcher_interface import ILauncher
from robotics_application_manager.manager.docker_thread import DockerThread
from robotics_application_manager.manager.vnc import Vnc_server
Expand All @@ -17,6 +25,14 @@ class LauncherRviz(ILauncher):
console_vnc: Any = Vnc_server()

def run(self, config_file, callback):
"""
Launches an RViz instance with a specific display configuration.

Args:
config_file (str): Path to the .rviz file defining the
displays and robot model.
callback (function): Lifecycle state-change callback.
"""
DRI_PATH = self.get_dri_path()
ACCELERATION_ENABLED = self.check_device(DRI_PATH)

Expand Down
Loading