diff --git a/README.md b/README.md index e1a721b..4330b52 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,12 @@ For more information about the ways you can contribute to Animal-AI, visit our w If you are new to contributing to open source, [this](https://github.com/Kinds-of-Intelligence-CFI/animal-ai/blob/main/CONTRIBUTING.md) guide helps explain why, what, and how to successfully get involved. ## Version History +* v4.1.0 + + Updated `RaycastParser` to accept new object: + - `HollowBox`. + + Added a new low-level random agent implemented on Braitenberg model. + + Bug fixes and performance improvements, specifically on improving the reliability of the Braitenberg model. + + Added built-in functionality to run yaml configuration files directly via Python. * v4.0.1 + Updated RaycastParser to accept two new objects: - `DecoyGoal` and `DecoyGoalBounce`. diff --git a/animalai/play.py b/animalai/play.py new file mode 100644 index 0000000..4febeb6 --- /dev/null +++ b/animalai/play.py @@ -0,0 +1,33 @@ +import random + +from pathlib import Path + +from animalai import AnimalAIEnvironment, arenas +from animalai.executable import find_executable + +def play(configuration_file: str = None, env_path: str = None) -> None: + """ + Load a config file and play + :param configuration_file: str path to a yaml configuration. Plays animalai.arenas.GoodGoal_Random.yml by default + :param env_path: str path to AAI environment executable. Looks for it in root by default. + :return: None + """ + + print("Initializing AAI environment") + environment = AnimalAIEnvironment( + file_name=env_path if env_path is not None else str(find_executable(Path(""))), + base_port=5005 + random.randint(0, 1000), + arenas_configurations=configuration_file if configuration_file is not None else arenas.GOOD_GOAL_RANDOM_POS, + play=True, + ) + + print("Press Q in the Unity window then Ctrl+C in the command line to close the environment effectively.") + + # Run the environment until signal is lost + try: + while environment._process: # type: ignore + continue + except KeyboardInterrupt: + pass + finally: + environment.close() \ No newline at end of file diff --git a/animalai/raycastparser.py b/animalai/raycastparser.py index 5dd27a6..020d02b 100644 --- a/animalai/raycastparser.py +++ b/animalai/raycastparser.py @@ -26,8 +26,8 @@ class RayCastObjects(enum.Enum): RAMP = 9 PILLARBUTTON = 10 SIGNPOSTER = 11 - DECAYGOAL = 12 - DECAYGOALBOUNCE = 13 + DECOYGOAL = 12 + DECOYGOALBOUNCE = 13 HOLLOWBOX = 14 diff --git a/pyproject.toml b/pyproject.toml index 38a919d..ca8a27d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "animalai" -version = "4.0.1" +version = "4.1.0" description = "Animal AI Python API" license = "MIT" readme = "README.md" diff --git a/test/play.py b/test/play.py new file mode 100644 index 0000000..a942e74 --- /dev/null +++ b/test/play.py @@ -0,0 +1,4 @@ +from animalai.play import play + +if __name__ == "__main__": + play() \ No newline at end of file