Skip to content

Commit

Permalink
Fix some tests (#473)
Browse files Browse the repository at this point in the history
* fix evdev reprequirement

* format
  • Loading branch information
PENG Zhenghao committed Jul 26, 2021
1 parent ebc9f2b commit a21c684
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
9 changes: 5 additions & 4 deletions pgdrive/engine/core/manual_controller.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from direct.controls.InputState import InputState
from pgdrive.utils import is_win
if not is_win():

from pgdrive.utils import is_win, is_mac

if (not is_win()) and (not is_mac()):
import evdev
from evdev import ecodes, InputDevice

from pgdrive.utils import import_pygame
from pgdrive.engine.core.pg_world import PGWorld

pygame = import_pygame()

Expand Down Expand Up @@ -79,6 +80,6 @@ def process_input(self, vehicle):
val = int(65535 * (vehicle.speed + offset) / (120 + offset)) if vehicle is not None else 0
self.ffb_dev.write(ecodes.EV_FF, ecodes.FF_AUTOCENTER, val)

#throttle_brake=0.2
# throttle_brake=0.2

return [steering, throttle_brake / 2]
6 changes: 3 additions & 3 deletions pgdrive/tests/test_env/test_ma_tollgate.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,12 +708,12 @@ def test_randomize_spawn_place():
# test_ma_toll_env()
# test_ma_toll_horizon()
# test_ma_toll_reset()
# test_ma_toll_reward_done_alignment()
test_ma_toll_close_spawn()
test_ma_toll_reward_done_alignment()
# test_ma_toll_close_spawn()
# test_ma_toll_reward_sign()
# test_ma_toll_init_space()
# test_ma_toll_no_short_episode()
# test_ma_toll_horizon_termination()
test_ma_toll_40_agent_reset_after_respawn()
# test_ma_toll_40_agent_reset_after_respawn()
# test_ma_no_reset_error()
# test_randomize_spawn_place()
51 changes: 31 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# Please don't change the order of following packages!
import sys
from setuptools import find_namespace_packages # This should be place at top!
from distutils.core import setup
from distutils.extension import Extension
from os import path

import numpy
from Cython.Build import cythonize
from setuptools import find_namespace_packages # This should be place at top!


def is_mac():
return sys.platform == "darwin"


def is_win():
return sys.platform == "win32"


assert sys.version_info.major == 3 and sys.version_info.minor >= 6, "python version >= 3.6 is required"

Expand All @@ -18,7 +27,6 @@
print("We will install the following packages: ", packages)

""" ===== Remember to modify the PG_EDITION at first ====="""

version = "0.1.4"

ext_modules = cythonize([Extension(
Expand All @@ -27,6 +35,26 @@
for ele in ext_modules:
assert isinstance(ele, Extension)

install_requires = [
"gym",
"numpy<=1.19.3",
"matplotlib",
"pandas",
"pygame",
"yapf==0.30.0",
"seaborn",
"panda3d~=1.10.8",
"panda3d-gltf",
"panda3d-simplepbr",
"pillow",
"pytest",
"opencv-python-headless",
"Cython==0.29.6",
]

if (not is_mac()) and (not is_win()):
install_requires.append("evdev")

setup(
name="pgdrive",
version=version,
Expand All @@ -35,24 +63,7 @@
author="PGDrive Team",
author_email="liquanyi@bupt.edu.cn, pengzh@ie.cuhk.edu.hk",
packages=packages,
install_requires=[
"evdev",
"gym",
"numpy<=1.19.3",
"matplotlib",
"pandas",
"pygame",
"yapf==0.30.0",
"seaborn",
"panda3d~=1.10.8",
"panda3d-gltf",
"panda3d-simplepbr",
"pillow",
"pytest",
"opencv-python-headless",
"Cython==0.29.6",

],
install_requires=install_requires,
include_package_data=True,
license="Apache 2.0",
long_description=long_description,
Expand Down

0 comments on commit a21c684

Please sign in to comment.