Scope of this tutorial¶
This tutorial will teach you how to set up an experiment and how to use iPython (Jupyter) Notebook to post-process it with the Virtual Coach.
Create the basic setup of the experiment
Launch the Platform, tune rendering quality
Discover the brain editor
Automate throwing balls at the robot using State Machines
Implement robot vision and action in Transfer Functions
Monitor and debug the simulation
Edit the environment
Save all your work
This tutorial is actually documented in an iPython (Jupyter) Notebook script. Let us first get it running (for more information about running the experiments in the Virtual Coach see the corresponding tutorial).
Local source installation¶
Be sure to have an up-to-date NRP in case you are using the source installation.
cd $HBP/user-scripts ./update_nrp update all
Local Docker installation¶
Make sure you have the latest Docker installation of the NRP and attach the terminal to the backend containers in order to have access to the Virtual Coach and NRP environment (use the script provided in the Docker installation instructions).
./nrp_installer.sh install latest ./nrp_installer.sh connect_backend
The terminal is attached to the backend container now.
Preparation for the experiment¶
All the configuration files and the python scripts specific to an experiment are located in the Experiments folder (except the brain and the robot which are located in Models). Let’s make a copy of the tutorial:
cd $HBP/Experiments/ cp -r tutorial_baseball_exercise my_first_experiment cd my_first_experiment mv ExDTutorialBaseballExercise.exc ExDMyFirstExperiment.exc
The important files are:
tutorial_baseball.ipynb: this notebook
ExDMyFirstExperiment.exc: XML configuration of the experiment
tutorial_baseball.bibi: XML configuration of the brain/body interaction
throw_ball.exd: A state machine referenced in the .exc
*.py: Transfer functions referenced in the .bibi
Let’s edit the ExDMyFirstExperiment.exc to change the name of the experiment:
sed -i "s/<name>.*<\/name>/<name>My First Experiment<\/name>/g" ExDMyFirstExperiment.exc
In the following exercises, we will edit the transfer functions and state machine through the Neurorobotics Platform editors. If you want to save your edits, make sure to download your modified code to the respective files in the my_first_experiment/ folder.
Go to your new experiment folder and run the script
cd $HBP/Experiments/my_first_experiment cle-virtual-coach ipython notebook tutorial_baseball.ipynb
If you have not yet installed the iPython notebook, install it now
sudo apt-get install ipython-notebook
You should now have a new browser window with the following view (in case you are using the Docker installation, by default the page should be available at
http://localhost:8888, see this tutorial for details).
The tutorial continues in this window. Have fun!