Commit a6910194 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

setup: requirments.txt / Docker

parent 93daa20a
FROM memmos.laas.fr:5000/gepetto/buildfarm/robotpkg:20.04
FROM python:3.9
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt --mount=type=cache,sharing=locked,target=/var/lib/apt \
apt-get update -qqy && DEBIAN_FRONTEND=noninteractive apt-get install -qqy \
python3-pip \
robotpkg-py38-example-robot-data \
&& python -m pip install --no-cache-dir \
meshcat
RUN useradd -m user
USER user
WORKDIR /home/user
ENV PATH /home/user/.local/bin:$PATH
CMD jupyter notebook
ADD requirements.txt .
RUN --mount=type=cache,sharing=locked,uid=1000,gid=1000,target=/home/user/.cache \
python -m pip install --user -U pip \
&& python -m pip install --user -r requirements.txt
ADD . .
# Supaero robotics, 2021
# Supaero robotics, 2022
This repository contains the exercices for the robotics class at Supaero, 2021.
This repository contains the exercices for the robotics class at Supaero, 2022.
The exercices are organized by notebook. Each notebook corresponds to one chapter of the class.
The notebooks are in Python and based on the software [Pinocchio](https://github.com/stack-of-tasks/pinocchio).
## Set up
Two virtualizations have been prepared to execute the software on any system.
A Docker image is available, follow the instructions [here](setup/README.md#setting-up-with-docker).
Or you can download a complete virtual box, see also the instructions [here](setup/README.md#setting-up-with-virtualbox).
The software can be run natively on Ubuntu LTS, following the instructions [here](setup/README.md#native-installation).
### Linux, Python 3, PyPI
On a Linux system with Python 3, you can get the dependencies directly with:
```bash
python3 -m pip install -r requirements.txt
```
NB: you should consider using a [virtualenv](https://docs.python.org/3/library/venv.html)
Once you have the dependencies, you can start the server with `jupyter notebook`
### Docker
On other systems, a Docker image is provided, and can be started with:
```bash
docker run --net host gepetto/supaero
```
FROM ubuntu:18.04
ADD setup.sh robotpkg.key /
RUN /setup.sh
RUN useradd -m student
USER student
WORKDIR /home/student
ENV PATH=/opt/openrobots/bin:$PATH \
LD_LIBRARY_PATH=/opt/openrobots/lib
EXPOSE 6000 7000 8888
CMD jupyter notebook --no-browser --ip='*'
VOLUME /home/student
# (in)validate docker build cache with the last commit from github
ADD https://api.github.com/repos/nmansard/supaero2021/commits/main /
RUN git clone --recursive https://github.com/nmansard/supaero2021.git \
&& ln -s supaero2021/setup/hello_talos.ipynb
# Supaero Robotics, software set up
This setup is provided as a [Docker](https://www.docker.com/) image and a [VirtualBox](https://www.virtualbox.org/)
image. We expect better performances with Docker, but VirtualBox is easier to use and more bullet-proof.
## Setting up with Docker
1. Install docker engine [https://docs.docker.com](https://docs.docker.com/engine/install/ubuntu/#installation-methods)
1. run
```bash
docker run --rm -p 7000:7000 -p 7001:7001 -p 7002:7002 -p 7003:7003 -p 7004:7004 -p 8888:8888 \
-v data:/home/student \
-it gepetto/supaero
```
1. Several links are produced by the terminal. Open the one that starts with `127.0.0.1` in your web browser.
1. An minimal example is produced in ~/hello_talos.ipynb: try it to check your install and say hi to Talos!
1. Notebooks for the tutorials are in ~/supaero2021 .
### Update the notebooks
The VirtualBox or Docker images might not contain the latest version of the notebooks so please pull the latest modifications before the tutorials. To do that :
```bash
docker run --rm -v data:/home/student \
-it gepetto/supaero \
git -C supaero2021 pull --rebase \
--recurse-submodules --ff-only
```
## Setting up with VirtualBox
1. Download the virtual machine using [https://frama.link/supaero2021-vbox](this link).
1. If you don't already have a virtualization system, download [https://www.virtualbox.org/](https://www.virtualbox.org/).
1. Unzip and load the virtual machine into your virtualization system (the virtual machine is in an open format and should be read by any kind of virtualization system).
1. Start the VirtualBox Image. If you start the VirtualBox for the first time, everything should be already running with the test notebook `~/supaero2021/setup/hello_talos.ipynb`. Say Hi to Talos!
1. Otherwise, you can start by running `jupyter notebook` in `~/supaero2021`. Notebooks for the tutorials are in this folder.
### Update the notebooks
The VirtualBox or Docker images might not contain the latest version of the notebooks.
At the begining of each class, just pull the latest modifications before the tutorials. To do that :
1. If running in one of the terminals, kill jupyter notebook using ctrl+C.
1. Pull changes from the repository:
```bash
cd ~/supaero2021
git pull
git submodule update --init
```
1. restart ```jupyter notebook```
## Native installation
*On Ubuntu 18.04, running setup.sh as root should do most of the work, though.
If you feel adventurous on other systems, you can also try to setup the softwares directly on your computer. But you're on your own! Due
to limited time, only few support will be provided. You can ask for help in the project's issue trackers,
but without time guarantees.*
The following dependencies are needed:
- To be install using APT on Ubuntu 18.04 or follow Pinocchio documentation at https://stack-of-tasks.github.io/pinocchio/download.html.
- You also need and some robot models (`sudo apt install robotpkg-py35-example-robot-data`)
- Finally, we need some standard Python packages: `sudo apt install ipython3 python3-pip freeglut3
python3-matplotlib python3-pil.imagetk jupyter python3-scipy python3-matplotlib jupyter python3-scipy python3-numpy`
and a 3D viewer `pip3 install --user meshcat`.
%% Cell type:code id: tags:
``` python
from math import pi
from ipywidgets import interact
import example_robot_data as robex
from pinocchio.visualize import MeshcatVisualizer
```
%% Cell type:code id: tags:
``` python
talos = robex.load('talos')
viz = MeshcatVisualizer(talos.model, talos.collision_model, talos.visual_model)
viz.initViewer(loadModel=True)
viz.viewer.jupyter_cell()
```
%% Cell type:code id: tags:
``` python
q0 = talos.q0
viz.display(q0)
```
%% Cell type:code id: tags:
``` python
@interact(shoulder=(-0.5, 0.5, 0.01))
def say_hi(shoulder=0):
q0[30] = pi - shoulder
viz.display(q0)
```
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFpnGgcBEADDeDCy5UM6F85wUxATZn9jZluoe5tdg7P8C5YLbzov09ehuwQ/
QBs2gMolM2QCRT+3Gm0V1Oihwh5NtgES1YfX4o3lQdIiu3+zZGCcn9wP9h8a0vMe
OiqysIFcsna8mDoRCXuACDr9DM2wIwnVZMMvOdzIBqhOTdZ1gZi5cso4HPlm6cWw
hFi9c/KGADlGWxRH5koaswP3tc854By5aKUefX6cbnyl3tqEVmkUVX3I73ycxm3t
XjvEJupOGZLEHPorf8nGge/vFAyIhp0lFUnqcUHOuz+WhEPo3/UHPdScWEeQp7fL
vNxI1qgVTo6ZQoJPdot96t0QLbVAkosvii+79ZrNM7z9VWwbnnPRDXELmlfGgObt
A63pBcALVp0ygizyoTwUG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y5jRS7TD5WAqnO9mGruFtPAIjA0qMFDWgsoEOh0qqJCo4xoLSWZXp
BF2G7yc9BDyeMLka3BFheW8jADPfFtVHfYRJxFXg5Yrwm9Lu9CTc4iwyd9Hm6VGQ
FGzxA21BFIwgQU6g1KGOVYyqR0yrqsDiem4ullqW0iHHNf4Y5nZUttvDr5rlAnD8
8nEgVn+JHdC3Wy8oGAe0GifMNXT1jBwIdk0LSDR/4rxxhe/g8Ci2Bhhh2AmqgRTN
L1+7d7MQHjOwBrDPWytHfVMfNXLP04cO2jbcaOFn1GPjYwP0ksK36tKIkFJm5AzF
OmBvBK9KjAn6Bes24tFXk1NrOEFSOVC6oU7k6KZhwHvPS+/kzGO8QGYP6ZV4mpmc
3SIswD2R4sC59rJdkA2ys8HMjDc01PjdDokVjy3krj899iMwx51qu4U=
=/psP
-----END PGP PUBLIC KEY BLOCK-----
#!/bin/bash
set -ex
export DEBIAN_FRONTEND=noninteractive
# Setup robotpkg
apt update -qqy
apt install -qqy gnupg2
apt-key add robotpkg.key
echo 'deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub bionic robotpkg' > /etc/apt/sources.list.d/robotpkg.list
# Install dependencies
apt update -qqy
apt install -qqy git python3-{matplotlib,pip} robotpkg-py36-{crocoddyl,tsid,qt5-gepetto-viewer-corba}
pip3 install --no-cache-dir jupyter meshcat
# Configure paths
echo /opt/openrobots/lib/python3.6/site-packages > /usr/lib/python3/dist-packages/robotpkg.pth
echo "export PATH=/opt/openrobots/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/opt/openrobots/lib" >> ~/.bashrc
# Cleanup (avoid useless space on docker image)
rm -rf /var/lib/apt/lists/*
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment