Skip to content
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

Update to 4.26 #441

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 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
73 changes: 38 additions & 35 deletions src/holodeck/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,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 @@ -669,27 +671,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 @@ -704,27 +702,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.
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.