Kinds-of-Intelligence-CFI / animal-ai

Animal-AI supports interdisciplinary research to help better understand human, animal, and artificial cognition.
https://sites.google.com/csah.cam.ac.uk/animalai/
Apache License 2.0
55 stars 9 forks source link

Configurable Camera Positions and Use of 'n' button for human play via YAML #7

Closed kozzy97 closed 1 year ago

kozzy97 commented 1 year ago

In the Python API in "player mode", it would be great to have an option to call the AAIEnvironment class with certain features disabled. At the moment, you can press /c/ to change the camera view, and press /n/ and/or /r/ to reset or skip to the next episode. When using this for human testing, we would like to be able to disable these features, selecting only one camera view, and disabling the skips. At the moment, we are getting round this by using a different build with those features disabled inside the C# scripts, but if we could do this through the API that would be great.

alhasacademy96 commented 1 year ago

Hey @kozzy97, I couldn't find any code that defines which perspective the camera is launched with during Play on python side of things. I believe this is written in code in unity side. Have I missed something? Can you show me where in the API where this is defined (python side)?

kozzy97 commented 1 year ago

Hi @alhasacademy96, there isn't anything yet. Currently, the AnimalAIEnvironment is called using this class. I propose the following:

class AnimalAIEnvironment(UnityEnvironment):
    ...
    def __init__(
        self,
        ...
        inference: bool = False #already exists
        play: bool = False, #already exists
        ...
        camera: str = "first-person" #with other options for "birds-eye" and "third-person", for example
        skip-enable: bool = True #can participants in play mode skip episodes by pressing 'n' or 'r'?
        ):

These bools would control behaviour in this file (lines 46-67 plus anything downstream of that).

I think these updates should be built with a view to eventually allowing agents to be trained on different camera views. But for now, the priority is to provide options for play mode (so camera and skip-enable would be ignored when play = False.

alhasacademy96 commented 1 year ago

I’ve already modified the script to always accept a Boolean (set true for both by default) whether the episode can be skipped or camera perspectives can be changed :) see branch end of episode notification which includes all my current commits :)

This makes it flexible as the user can choose which to turn on/off individually. This should be a good starting point.

On 28 Aug 2023 at 00:53 +0300, Kozzy Voudouris @.***>, wrote:

Hi @alhasacademy96, there isn't anything yet. Currently, the AnimalAIEnvironment is called using this class. I propose the following: class AnimalAIEnvironment(UnityEnvironment): ... def init( self, ... inference: bool = False #already exists play: bool = False, #already exists ... camera: str = "first-person" #with other options for "birds-eye" and "third-person", for example skip-enable: bool = True #can participants in play mode skip episodes by pressing 'n' or 'r'? ): These bools would control behaviour in this file (lines 46-67 plus anything downstream of that). I think these updates should be built with a view to eventually allowing agents to be trained on different camera views. But for now, the priority is to provide options for play mode (so camera and skip-enable would be ignored when play = False. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>