From 99ce4b99014013a071b1f3473bfcc6a953799a97 Mon Sep 17 00:00:00 2001 From: yaacov Date: Fri, 26 Jul 2024 11:37:02 +0300 Subject: [PATCH] Dont change pytonpath Signed-off-by: yaacov --- Makefile | 2 +- README.md | 10 +++++++++- examples/driver.py | 1 + examples/none.py | 1 + examples/random-driver.py | 1 + rose/main.py => main.py | 3 +++ mydriver.py | 1 + 7 files changed, 17 insertions(+), 2 deletions(-) rename rose/main.py => main.py (96%) diff --git a/Makefile b/Makefile index 4a4870d..a426d9a 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ test: run: @echo "Running driver logic server ..." - PYTHONPATH=$(SRC_DIR):$$PYTHONPATH python rose/main.py --port $(PORT) --driver $(DRIVER_PATH) + python main.py --port $(PORT) --driver $(DRIVER_PATH) build-image: @echo "Building container image ..." diff --git a/README.md b/README.md index 1da1bd1..3b70a49 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,14 @@ Self driving car module example | https://github.com/RedHat-Israel/rose-game-ai- Clone this repository, and make sure you have a game engine running. +Install requirements: + +```bash +# Install requirements +pip install -r requirements.txt +pip install -r requirements-dev.txt +``` + Write your own driving module, you can use the file `mydriver.py`: ```bash @@ -41,7 +49,7 @@ vi mydriver.py Run using `mydriver.py` as the driving module: ```bash -make run +python main.py --driver mydriver.py ``` ## Running ROSE game components containerized diff --git a/examples/driver.py b/examples/driver.py index fe8a750..666eeff 100644 --- a/examples/driver.py +++ b/examples/driver.py @@ -1,6 +1,7 @@ """ This driver implement some logic. """ + from rose.common import obstacles, actions # NOQA driver_name = "Driver" diff --git a/examples/none.py b/examples/none.py index 3904818..f0ccc52 100644 --- a/examples/none.py +++ b/examples/none.py @@ -1,6 +1,7 @@ """ This driver does not do any action. """ + from rose.common import obstacles, actions # NOQA driver_name = "No Driver" diff --git a/examples/random-driver.py b/examples/random-driver.py index cba4a67..8951710 100644 --- a/examples/random-driver.py +++ b/examples/random-driver.py @@ -4,6 +4,7 @@ This is a rather silly driver choosing the next action randomly. It is not a very good driver but the implementation is very elegant. """ + import random from rose.common import obstacles, actions # NOQA diff --git a/rose/main.py b/main.py similarity index 96% rename from rose/main.py rename to main.py index 72aaff1..497bc6d 100644 --- a/rose/main.py +++ b/main.py @@ -65,6 +65,9 @@ def main(): if args.driver == "": print("Error: missing driver command line argument") + print("") + print("Example:") + print(" python main.py --driver mydriver.py") return try: diff --git a/mydriver.py b/mydriver.py index 9d761c3..c8ad134 100644 --- a/mydriver.py +++ b/mydriver.py @@ -1,6 +1,7 @@ """ This driver does not do any action. """ + from rose.common import obstacles, actions # NOQA driver_name = "MyDriver"