- Repository Setup
- Prerequisites
- Opening the Development Environment
- Filesystem Considerations
- Building the Workspace
- Running the GUI
Tip
Before starting development, it is recommended to create a personal copy of this repository. This ensures privacy and allows you to push code to your own workspace.
Warning
Avoid publishing sensitive credentials (e.g., GitHub, Azure, or other API keys) in a public repository. Service providers may automatically detect and revoke compromised keys.
- On GitHub, click on the “+” button (
Create new...) in the top-right corner. - Select Import repository.
- Paste the following repository link:
https://github.com/gdesimone97/cogrob_pepper_nodes.git - Configure the repository as private.
- Complete the import process.
- Docker Engine: Installation guide
- Visual Studio Code (VS Code): Installation guide
- Dev Container Extension for VS Code: Installation guide
- Clone the repository on your local machine.
- In VS Code, press
F1→ select Build and Reopen in Container. - Choose the configuration corresponding to your operating system:
- Windows / macOS
- Linux
- Wait until the container build process completes.
When running a Docker container, the filesystem is virtualized and isolated from the host machine.
To enable persistence, specific directories can be mounted between the host and container. Any modifications in these linked directories are reflected in both environments.
In this setup, the working directory is automatically mounted inside the container at /workspace (see Opening the Development Environment).
Caution
Rebuilding the container resets its internal filesystem. Only data stored in mounted directories (e.g., /workspace) will persist.
Access the VS Code command menu by either:
- Pressing
F1 - Using
Ctrl+Shift+P
Relevant commands:
- Build and Reopen in Container: Rebuilds the container image and reopens it in VS Code.
- Reopen in Container: Reopens the previously built container without rebuilding.
Different devcontainer.json files are provided depending on the operating system.
For example, the configuration for Windows/macOS is located at:
.devcontainer/windows_mac/devcontainer.json
This file defines:
- User privileges
- Workspace mounting
- Installed VS Code extensions
- Post-build commands
By default, the image is built from Dockerfile, which is initially empty.
To permanently include additional packages, extend this Dockerfile by adding installation commands. Example:
RUN apt update && apt install -y geditor:
RUN pip install httpxImportant
Image building is executed in non-interactive mode. Command-line interaction during compilation is not possible.
Therefore, when using apt, you must include the -y flag to ensure automatic confirmation.
See Dockerfile.base for command examples.
During container creation, the following command is executed automatically:
echo 'source /workspace/ws/install/setup.bash' >> /home/mivia/.bashrcThis avoids the need to manually source the environment each time you run ROS2 nodes.
However, if you create or change a workspace, this may cause issues. To disable this feature, modify the postCreateCommand key inside your target file:
- Windows/Mac: devcontainer.json
- Linux: devcontainer.json
Example:
"postCreateCommand": ""Then rebuild the container.
- Open the container (see Opening the Development Environment).
- Navigate to the workspace directory:
cd ws- Build the workspace:
colcon build --symlink-install- Source the setup file:
source install/setup.bash- On the host machine, open a shell and disable Access Control:
xhost +- Open the container and run:
xclock- Install Vcxsrv
- Run
XLaunch - Set:
Multiple windowsDisplay number: -1
- Press
Next - Tick
Disable Access Control - Open the container and run:
xclock- Install XQuartz
- Run
XQuartz - Open settings/preferences
- Allow network connections
- Reboot the system
- Reopen
XQuartzvia Launchpad - On the host machine, open a shell and disable Access Control:
xhost +- Open the container and run:
xclockReference: http://mamykin.com/posts/running-x-apps-on-mac-with-docker/
- Run run_gui.bat
Note
This works only for Windows. If you need to run it on macOS, reproduce the commands manually in your shell from the same directory.
Caution
This will create a new container that will be removed on exit. Only changes made inside the /workspace directory will persist.
These commands will run the container as a daemon and start the RDP server on port 33890.
You can open the GUI using an RDP client such as Windows Remote Desktop with the following setting:
localhost:33890
Username:
mivia
Password:
mivia