Skip to content

Development Setup

For the development of SEEREP, a Visual Studio Code Dev Container is used. This enables the use of a Docker container as a development environment, handling dependencies in a unified manner and abstracting different operating systems. For the system requirements, please refer to the Visual Studio Code Docs.

Setup

Clone the repository with:

git clone git@github.com:agri-gaia/seerep.git
git clone https://github.com/agri-gaia/seerep

For the development, it is assumed that the directory designated for SEEREP's data storage is a sibling folder named seerep-data, located next to the repository. Make sure it exists!

mkdir seerep-data

Warning

Since a Docker bind mount is used to mount the data storage directory inside the container, providing an incorrect or non-existent path for the host directory will result in an unclear error message when starting the container.

Subsequently, install the Remote Containers and Docker Visual Studio Code extensions:

code --install-extension ms-vscode-remote.remote-containers ; \
code --install-extension ms-azuretools.vscode-docker

Launch Visual Studio Code within the repository:

code seerep

The presence of a .devcontainer folder should automatically trigger the detection of a Dev-Container environment. To reopen the repository folder in the container, a prompt will appear on the lower right corner:

Vs Code reopen in container notice

Reopen in Dev-Container menu

Or in case this window doesn't open, use either F1 or Ctrl+Shift+P and input Remote-Containers: Reopen Folder in Container. Confirm by pressing Enter.

Starting the Dev-Container the first time may take a while as it involves downloading the required SEEREP Docker image (around 4 GB). Additionally Visual Studio Code extensions, Intellisense, and pre-commit checks are setup in the container.

Container Credentials

The default credentials have both the username and password set to docker.

Pre Commit Checks

The repository uses pre-commit hooks to verify compliance with established coding guidelines and, if necessary, to format the code in a consistent way. The checks are automatically run before each commit and as part of the GitHub CI. To manually run the checks use:

pre-commit run -a

The main hooks are:

Along with other checks for Dockerfiles and YAML, see the complete list in the configuration.

Debugging with VS-Code

Inside the Dev-Container, catkin builds the server executable in debug mode by default. To start debugging with VS-Code support, the provided launch configurations can be used. For that switch into the Run and Debug window (Ctrl+Shift+D ) and select seerep_serverfrom the dropdown. To finally launch the server, click the ▶ button.

SEEREP start in D

Start SEEREP in debug mode inside VS-Code

The gdb debug console should be displayed at the bottom. Switching to the terminal tab provides access to the logging output. An example from a fresh server start is shown below:

SEEREP start in D

Terminal output upon start

For further information regarding debugging in VS-Code check the offical docs.