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
1 change: 0 additions & 1 deletion robotics_application_manager/libs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from .process_utils import (
get_ros_version,
check_gpu_acceleration,
get_user_world,
wait_for_xserver,
wait_for_process_to_start,
stop_process_and_children,
Expand Down
23 changes: 0 additions & 23 deletions robotics_application_manager/libs/process_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,26 +153,3 @@ def check_gpu_acceleration():
def get_ros_version():
output = subprocess.check_output(["bash", "-c", "echo $ROS_VERSION"])
return output.decode("utf-8")[0]


def get_user_world(launch_file):
""" "
Processes a provided base64 encoded string representing a zip file, decodes it,
saves it as a zip file, and then extracts its contents.

The function takes a base64 encoded string (`launch_file`) as input. It first decodes this
string into binary format, then saves this binary content as a zip file in a predetermined
directory ('workspace/binaries/'). After saving, it extracts the contents of the zip file into
another specified directory ('workspace/worlds/').
"""
try:
# Convert base64 to binary
binary_content = base64.b64decode(launch_file)
# Save the binary content as a file
with open("workspace/binaries/user_worlds.zip", "wb") as file:
file.write(binary_content)
# Unzip the file
with zipfile.ZipFile("workspace/binaries/user_worlds.zip", "r") as zip_ref:
zip_ref.extractall("workspace/worlds/")
except Exception as e:
LogManager.logging.error(f"An error occurred getting user world: {e}")
4 changes: 4 additions & 0 deletions robotics_application_manager/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ def on_launch_world(self, event):
scene_cfg = cfg_dict["scene"]
robot_cfg = cfg_dict["robot"]

# Backwards compatibility for now
if isinstance(robot_cfg, list):
robot_cfg = robot_cfg[0]

# Launch scene
try:
if scene_cfg["type"] == None:
Expand Down
Loading