# Template

We provide templates for both RoboLab courses in spring and autumn. They act as base repositories each group has to clone from and then set the upstream to their assigned repo afterwards. You have already been explained this process during the Git introduction.

The templates provide scripts to speed up and automate the process of deploying as well as executing Python code on the LEGO MINDSTORMS EV3 robots running our customized, Debian based operating system ev3dev-robolab. They also include the most recent programming interface which is used to check parts of the students solutions in the final exam and has to be implemented by every group.

## Background

The deploy functionality that syncs Python files from the local src/ folder to a remote EV3 brick is enabled by the submodule robolab-deploy. Its contents were not directly included in this repository, as the submodule allows easier updating without manually adding files to your group repository. Afterwards this scripts attaches to a pre-loaded tmux session on the remote device, which is running python3 including some modules that are already imported. These, for instance the Python language bindings for the EV3, usually take way to long for practical development and debugging. The script further performs a reload on the main.py file in the remote /home/robot/src/ folder and starts execution from main.run(). This is made possible by the custom systemd service robolab-startup that runs automatically on our OS after boot.

## Precondition

For private repositories follow the steps described in your specific installation page (NES/INF).

## Usage

All source file must reside inside the src/ sub directory. To start deploying and executing, call the file according to your operating system configuration and setup of Python.

### Linux and macOS

There is a so called Shebang placed on the top of the scripts. This should automatically resolve the Python executable in most cases. Hence you can simply call it from the working directory with

$./deploy.py [optional arguments] ### Windows Unfortunately some investigation and work on Windows may be necessary as the mentioned Shebang does not work here by default. We recommend using Git-Bash or the Windows Subsystem for Linux (WSL, new since Windows 10). $ PYTHON_EXECUTABLE ./deploy.py [optional arguments]

The variable PYTHON_EXECUTABLE contains either the shortcut registered in your systems \$PATH environment or the full direct path to the python.exe.