Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.vscode
*.bdb
*bo
.venv
.claude
/sim/results
91 changes: 86 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LABEL DBM-SMS.version="0.1"
# Install common dependencies
RUN apt-get update && apt-get install -y \
build-essential \
dpkg \
dpkg \
git \
pkg-config \
python \
Expand All @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y \
libboost-filesystem-dev \
cmake \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
apt-get -y install sudo
RUN adduser --disabled-password --gecos '' docker
Expand Down Expand Up @@ -82,6 +82,50 @@ RUN cd /home/docker/buzz &&\
make install &&\
ldconfig

# Create ARGoSConfig.cmake if the argos3 fork didn't install one
RUN if ! find /usr/local -name "ARGoSConfig.cmake" 2>/dev/null | grep -q .; then \
mkdir -p /usr/local/lib/cmake/argos3 && \
printf 'set(ARGOS_FOUND TRUE)\nset(ARGoS_FOUND TRUE)\nset(ARGOS_PREFIX "/usr/local")\nset(ARGOS_INSTALL_PREFIX "/usr/local")\nset(ARGOS_INCLUDE_DIRS "/usr/local/include")\nset(ARGOS_LIBRARY_DIRS "/usr/local/lib/argos3")\nset(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/local/share/argos3/cmake")\nset(ARGOS_BUILD_FOR_SIMULATOR TRUE)\nset(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/lib/x86_64-linux-gnu")\nfind_package(Qt5 COMPONENTS Widgets Gui OpenGL QUIET)\nif(Qt5Widgets_FOUND AND Qt5Gui_FOUND)\n set(ARGOS_QTOPENGL_FOUND TRUE)\n set(CMAKE_AUTOMOC ON)\n set(CMAKE_CXX_STANDARD 14)\n set(CMAKE_INCLUDE_CURRENT_DIR ON)\n set(ARGOS_QTOPENGL_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS})\n set(ARGOS_QTOPENGL_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES})\nendif()\n' \
> /usr/local/lib/cmake/argos3/ARGoSConfig.cmake; \
fi

# Expose Lua headers at the unversioned path expected by argos3 plugins
RUN ln -sf /usr/include/lua5.3/lua.h /usr/include/lua.h &&\
ln -sf /usr/include/lua5.3/lauxlib.h /usr/include/lauxlib.h &&\
ln -sf /usr/include/lua5.3/luaconf.h /usr/include/luaconf.h &&\
ln -sf /usr/include/lua5.3/lualib.h /usr/include/lualib.h

# Register argos3 plugin library path with the dynamic linker
# Also symlink .so files into /usr/local/lib so ld finds them at compile-time link
RUN echo "/usr/local/lib/argos3" > /etc/ld.so.conf.d/argos3.conf && ldconfig &&\
find /usr/local/lib/argos3 -name "*.so" -exec ln -sf {} /usr/local/lib/ \;

# Install ARGoS Khepera IV plugin
RUN . /home/docker/argos3/build_simulator/setup_env.sh &&\
git clone https://github.com/ilpincy/argos3-kheperaiv.git /home/docker/argos3-kheperaiv &&\
cd /home/docker/argos3-kheperaiv &&\
mkdir build &&\
cd build &&\
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="/usr/local;/usr/lib/x86_64-linux-gnu" \
-DARGoS_DIR=/usr/local/lib/cmake/argos3 \
-DCMAKE_MODULE_PATH=/usr/local/share/argos3/cmake \
../src &&\
make &&\
make install &&\
ldconfig

# Normalize kheperaiv install paths: cmake may install to /include and /lib instead of /usr/local
RUN if [ -d /include/argos3 ]; then cp -rn /include/argos3/. /usr/local/include/argos3/; fi &&\
find /lib/argos3 -name "*.so" -exec cp -n {} /usr/local/lib/argos3/ \; 2>/dev/null || true
# Re-run symlinks and ldconfig to pick up kheperaiv library installed after the first run
RUN find /usr/local/lib/argos3 -name "*.so" -exec ln -sf {} /usr/local/lib/ \; && ldconfig

# Patch: ilpincy kheperaiv declares RegisterFunctions() private; DBM-SMS calls it explicitly
RUN perl -i -0pe \
's/private:\n\n virtual buzzvm_state RegisterFunctions/protected:\n\n virtual buzzvm_state RegisterFunctions/' \
/usr/local/include/argos3/plugins/robots/kheperaiv/control_interface/buzz_controller_kheperaiv.h

# Simulation dependencies
RUN apt-get update && apt-get install -y python-pip
RUN pip install matplotlib && pip install scipy
Expand All @@ -94,14 +138,51 @@ RUN cd /home/docker/ &&\
git clone https://github.com/lajoiepy/DBM-SMS.git

# Compile C++ controller
# Patch: DBM-SMS CMakeLists doesn't link kheperaiv, causing undefined symbols at runtime
RUN sed -i 's/argos3plugin_simulator_buzz/argos3plugin_simulator_kheperaiv\n argos3plugin_simulator_buzz/' \
/home/docker/DBM-SMS/sim/controller/src/CMakeLists.txt
RUN cd /home/docker/DBM-SMS/sim/controller &&\
mkdir build &&\
cd build/ &&\
cmake ../src &&\
make &&\
make install

# Compile buzz script
# Compile loop functions
RUN cd /home/docker/DBM-SMS/sim/loop_functions &&\
mkdir build &&\
cd build/ &&\
cmake ../src &&\
make &&\
make install

# Compile buzz scripts
RUN cd /home/docker/DBM-SMS/sim &&\
bzzc dbm-random-walk.bzz &&\
bzzc dbm-gradient.bzz
bzzc dora.bzz &&\
bzzc frontier.bzz &&\
bzzc randomwalk.bzz

# this to try fixing some issues with graphics card usage
RUN apt-get update && apt-get install -y \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6 \
mesa-utils


# Install system-level dependencies for Matplotlib/Pillow
RUN apt-get update && apt-get install -y \
python3-pip \
zlib1g-dev \
libjpeg-dev \
libfreetype6-dev \
&& rm -rf /var/lib/apt/lists/*

# Upgrade pip first (helps avoid building from source)
RUN pip3 install --upgrade pip setuptools

# Use pip3 to install dependencies
RUN pip3 install matplotlib scipy seaborn
23 changes: 23 additions & 0 deletions docker/docker-compose.windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:
argos:
build: .
container_name: argos_project
environment:
- DISPLAY=host.docker.internal:0.0
- QT_X11_NO_MITSHM=1
- LIBGL_ALWAYS_SOFTWARE=1
- GALLIUM_DRIVER=llvmpipe
volumes:
- ../sim:/workspace
stdin_open: true
tty: true

# To use the GUI (ARGoS visualizer):
# 1. Install VcXsrv: https://sourceforge.net/projects/vcxsrv/
# 2. Launch XLaunch → Multiple windows → Display 0 → Check "Disable access control"
# 3. Then run: docker compose -f docker-compose.windows.yml up
#
# To enter the container:
# docker exec -it argos_project bash
#
# To run headless (no GUI), pass -vizualization none in your .argos config
31 changes: 31 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:
argos:
build: .
container_name: argos_project
runtime: nvidia
environment:
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all, graphics, utility, display
- __NV_PRIME_RENDER_OFFLOAD=1
- __GLX_VENDOR_LIBRARY_NAME=nvidia
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu, graphics]
volumes:
- ..:/workspace
- /tmp/.X11-unix:/tmp/.X11-unix:rw
stdin_open: true
tty: true
network_mode: host


# xhost +local:docker
# docker exec -it argos bash

Loading