Skip to content

Submissions

Emilio Cartoni edited this page Sep 8, 2022 · 2 revisions

How can I make my own controller?

To make your own submission, you can edit the baseline or develop your own controller.
The local_evaluation.py file actually looks into the my_controller.py file to see which agent it has to run.
In the my_controller.py, you can see:

from real_robots.policy import BasePolicy
from baseline.policy import Baseline


class RandomPolicy(BasePolicy):
    def __init__(self, action_space, observation_space):
        self.action_space = action_space
        self.observation_space = observation_space
        self.render = False

    def step(self, observation, reward, done):
        action = self.action_space.sample()
        action['render'] = self.render
        return action


# SubmittedPolicy=RandomPolicy
SubmittedPolicy = Baseline

By commenting the last line and the de-commeting the Submitted=RandomPolicy line, you can switch the evaluation to use the RandomPolicy class instead of the baseline.
You can then further modify the RandomPolicy (or import another class from outside) to make your own controller.
To interact with the environment, your controller has to be a subclass of BasePolicy, so as to follow the interface defined here.

What if I need to install other libraries?

If they are python libraries, you can simply installed them into the conda environment (e.g. using pip install while the environment is active).
Remember to also add them to the environment.yml file, so that they will also be installed inside the container when submitting.
If your controllers needs special system libraries, you will have to modify the Dockerfile so as to include them as well.

How can I enable GPU support in the image built?

You can de-comment the line #gpu_support=true in build.sh to change the Dockerfile recipe for the image build.
The recipe with GPU support will use the tensorflow base image that has GPU support.
This will result in a bigger image, but the submission inside the resulting image will make use of the GPUs when invoked with the --gpus flag, i.e.

docker run --gpus all -it real2022submission:latest /root/miniconda3/bin/conda run -n real_robots python docker_evaluation.py

Clone this wiki locally