Skip to content

Update to 4.26 #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
author = "Joshua Greaves, Max Robinson, Nick Walton, Jayden Milne"

# The short X.Y version
version = "0.3.2.dev0"
version = "0.3.2.dev1"
# The full version, including alpha/beta/rc tags
release = "0.3.2.dev0"
release = "0.3.2.dev1"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="holodeck",
version="0.3.2.dev0",
version="0.3.2.dev1",
description="High fidelity simulated environments for reinforcement learning",
long_description=readme,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion src/holodeck/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Holodeck is a high fidelity simulator for reinforcement learning.
"""
__version__ = "0.3.2.dev0"
__version__ = "0.3.2.dev1"

from holodeck.holodeck import make
from holodeck.packagemanager import *
Expand Down
73 changes: 38 additions & 35 deletions src/holodeck/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ def __init__(
show_viewport=show_viewport,
)
elif os.name == "nt":
self.__windows_start_process__(binary_path, world_key, verbose=verbose)
self.__windows_start_process__(
binary_path, world_key, verbose=verbose, show_viewport=show_viewport
)
else:
raise HolodeckException("Unknown platform: " + os.name)

Expand Down Expand Up @@ -698,27 +700,23 @@ def __linux_start_process__(
os.O_CREAT | os.O_EXCL,
initial_value=0,
)
# Copy the environment variables and remove the DISPLAY variable to hide viewport
# https://answers.unrealengine.com/questions/815764/in-the-release-notes-it-says-the-engine-can-now-cr.html?sort=oldest
environment = dict(os.environ.copy())
if not show_viewport and "DISPLAY" in environment:
del environment["DISPLAY"]
arguments = [
binary_path,
task_key,
"-HolodeckOn",
"-LOG=HolodeckLog.txt",
"-ForceRes",
"-ResX=" + str(self._window_size[1]),
"-ResY=" + str(self._window_size[0]),
"--HolodeckUUID=" + self._uuid,
"-TicksPerSec=" + str(self._ticks_per_sec),
]

if not show_viewport:
arguments.append("-RenderOffScreen")

self._world_process = subprocess.Popen(
[
binary_path,
task_key,
"-HolodeckOn",
"-opengl" + str(gl_version),
"-LOG=HolodeckLog.txt",
"-ForceRes",
"-ResX=" + str(self._window_size[1]),
"-ResY=" + str(self._window_size[0]),
"--HolodeckUUID=" + self._uuid,
"-TicksPerSec=" + str(self._ticks_per_sec),
],
stdout=out_stream,
stderr=out_stream,
env=environment,
arguments, stdout=out_stream, stderr=out_stream
)

atexit.register(self.__on_exit__)
Expand All @@ -733,27 +731,32 @@ def __linux_start_process__(
loading_semaphore.unlink()
loading_semaphore.close()

def __windows_start_process__(self, binary_path, task_key, verbose):
def __windows_start_process__(
self, binary_path, task_key, verbose, show_viewport=True
):
import win32event

out_stream = sys.stdout if verbose else open(os.devnull, "w")
loading_semaphore = win32event.CreateSemaphore(
None, 0, 1, "Global\\HOLODECK_LOADING_SEM" + self._uuid
)
arguments = [
binary_path,
task_key,
"-HolodeckOn",
"-LOG=HolodeckLog.txt",
"-ForceRes",
"-ResX=" + str(self._window_size[1]),
"-ResY=" + str(self._window_size[0]),
"-TicksPerSec=" + str(self._ticks_per_sec),
"--HolodeckUUID=" + self._uuid,
]

if not show_viewport:
arguments.append("-RenderOffScreen")

self._world_process = subprocess.Popen(
[
binary_path,
task_key,
"-HolodeckOn",
"-LOG=HolodeckLog.txt",
"-ForceRes",
"-ResX=" + str(self._window_size[1]),
"-ResY=" + str(self._window_size[0]),
"-TicksPerSec=" + str(self._ticks_per_sec),
"--HolodeckUUID=" + self._uuid,
],
stdout=out_stream,
stderr=out_stream,
arguments, stdout=out_stream, stderr=out_stream
)

atexit.register(self.__on_exit__)
Expand Down
10 changes: 6 additions & 4 deletions tests/agents/handagent/test_handagent_floating.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,32 @@ def validate_movement(env, amount_to_move, expected_movement):
# X Axis
action[23] = amount_to_move
env.step(action)
action[23] = 0
env.step(action)
new_location = env.tick()["LocationSensor"]
d_x = abs(new_location[0] - last_location[0])

assert abs(d_x - expected_movement) < 0.001

last_location = new_location

action[23] = 0

# Y axis
action[24] = amount_to_move
env.step(action)
action[24] = 0
env.step(action)
new_location = env.tick()["LocationSensor"]
d_y = abs(new_location[1] - last_location[1])

assert (d_y - expected_movement) < 0.001

last_location = new_location

action[24] = 0

# Z Axis
action[25] = amount_to_move
env.step(action)
action[25] = 0
env.step(action)
new_location = env.tick()["LocationSensor"]
d_z = abs(new_location[2] - last_location[2])

Expand Down
Binary file modified tests/sensors/expected/1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/1024_viewport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/2048.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/2048_viewport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/256_viewport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/512_viewport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/sensors/expected/teleport_viewport_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/sensors/test_imu_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import holodeck
import numpy as np
import pytest
import uuid
from tests.utils.equality import almost_equal

turtle_config = {
Expand Down Expand Up @@ -41,10 +42,9 @@ def imu_sensor_env():

SHARED_IMU_SENSOR_ENV = holodeck.environments.HolodeckEnvironment(
scenario=turtle_config,
# binary_path=binary_path,
binary_path=binary_path,
show_viewport=False,
start_world=False,
# uuid=str(uuid.uuid4()),
uuid=str(uuid.uuid4()),
)

with SHARED_IMU_SENSOR_ENV:
Expand All @@ -58,7 +58,7 @@ def test_imu_sensor_at_rest(imu_sensor_env):
imu_sensor_env.tick()
at_rest_sensor_reading = np.array([[0, 0, 9.8], [0, 0, 0]])

new_state = imu_sensor_env.tick(20)
new_state = imu_sensor_env.tick(40)
sensed_imu_data = new_state["IMUSensor"]
assert almost_equal(
at_rest_sensor_reading, sensed_imu_data, 0.5, 0.5
Expand Down
2 changes: 1 addition & 1 deletion tests/sensors/test_orientation_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_orientation_sensor_after_teleport():

accurate_or = np.zeros((3, 3))
accurate_or[0, 2] = 1
accurate_or[1, 1] = -1
accurate_or[1, 1] = 1
accurate_or[2, 0] = -1

assert almost_equal(
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/captures.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from typing import List, Tuple, Optional

import cv2
from cv2 import cv2

from tests.utils.equality import mean_square_err

Expand Down
Binary file modified tests/worlds/mazeworld/expected/weather_fog_density_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_fog_density_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_after_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_after_30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_after_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_before_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_before_30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_time_before_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_type_cloudy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_type_rain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/worlds/mazeworld/expected/weather_type_sunny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.