Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:

- name: Run tests
working-directory: docker
run: bash run_tests.sh
run: bash build.sh && bash run_tests.sh
2 changes: 1 addition & 1 deletion docker/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PYICUB_VERSION=8.3.7
PYICUB_VERSION=8.3.8
PYICUB_APPS_VERSION=master
PYICUB_FRONTEND_VERSION=v8.8-ng

Expand Down
5 changes: 5 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/bash

set -e

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"

docker compose build
88 changes: 54 additions & 34 deletions docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,128 +5,148 @@ x-pyicub-common: &pyicub-common
network_mode: host
privileged: true

x-pyicub-build: &pyicub-build
context: ..
dockerfile: docker/Dockerfile.pyicub
args:
DOCKER_SRC: ${ROBOTOLOGY_IMAGE_NAME}
PYICUB_VERSION: ${PYICUB_VERSION:-master}
PYICUB_APPS_VERSION: ${PYICUB_APPS_VERSION:-master}
WORKDIR: ${WORKDIR:-/usr/local/src/robot}

x-pyicub-headless: &pyicub-headless
<<: *pyicub-common
build: *pyicub-build
env_file:
- pyicub.env
environment:
- DISPLAY=:99


services:

pyicub-yarpserver:
<<: *pyicub-common
container_name: pyicub-yarpserver

command: ["/bin/bash", "-c", "yarpserver --write"]

restart: unless-stopped

healthcheck:
test: ["CMD", "/bin/bash", "-c", "yarp detect"]
interval: 10s
timeout: 5s
retries: 6
start_period: 1s
profiles:
- backend
- frontend


pyicub-backend:
<<: *pyicub-common
container_name: pyicub-backend
build: *pyicub-build
container_name: pyicub-backend

build:
context: ..
dockerfile: docker/Dockerfile.pyicub
args:
DOCKER_SRC: ${ROBOTOLOGY_IMAGE_NAME}
PYICUB_VERSION: ${PYICUB_VERSION:-master}
PYICUB_APPS_VERSION: ${PYICUB_APPS_VERSION:-master}
WORKDIR: ${WORKDIR:-/usr/local/src/robot}

runtime: ${DOCKER_RUNTIME:-runc}

env_file:
- pyicub.env

environment:
- DISPLAY=${DISPLAY:-:0}
- PULSE_SERVER=unix:${XDG_RUNTIME_DIR:?error}/pulse/native
- PULSE_COOKIE=/run/pulse/cookie
- XDG_RUNTIME_DIR=/tmp/runtime-root
- XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:?error}
- XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
- QT_X11_NO_MITSHM=1
- NO_AT_BRIDGE=1
- NVIDIA_VISIBLE_DEVICES=${GPU_DEVICES:-none}
- NVIDIA_DRIVER_CAPABILITIES=all
- SSH_AUTH_SOCK=/ssh-agent

command: ["/bin/bash", "-c", "bash ${WORKDIR:?error}/pyicub/scripts/start.sh"]

profiles:
- backend

healthcheck:
test: ["CMD", "/bin/bash", "-c", "yarp ping /${PYICUB_NODE:?error}"]
interval: 1m30s
timeout: 30s
retries: 5
start_period: 30s

depends_on:
pyicub-yarpserver:
condition: service_healthy

volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
- ${HOME}/.config/pulse/cookie:/run/pulse/cookie
- ${XDG_RUNTIME_DIR:?error}/pulse:${XDG_RUNTIME_DIR:?error}/pulse
- ${HOME}/.gitconfig:/root/.gitconfig:ro
- ${SSH_AUTH_SOCK:-/dev/null}:/ssh-agent
- ${HOME}/.ssh:/root/.ssh:ro

pyicub.frontend:
image: ${PYICUB_FRONTEND_IMAGE_NAME:?error}
container_name: pyicub-frontend

build:
context: .
dockerfile: Dockerfile.pyicub-frontend
args:
- PYICUB_FRONTEND_VERSION=${PYICUB_FRONTEND_VERSION:?error}

environment:
- SSH_AUTH_SOCK=/ssh-agent

network_mode: host

volumes:
- pyicub-frontend-workspace:${WORKDIR:?error}/pyicub-frontend
- ${HOME}/.gitconfig:/root/.gitconfig:ro
- ${HOME}/.ssh:/root/.ssh:ro
- ${SSH_AUTH_SOCK:-/dev/null}:/ssh-agent

profiles:
- frontend

depends_on:
pyicub-yarpserver:
condition: service_healthy
pyicub-backend:
condition: service_healthy

pyicub.simulation-nogui:
<<: *pyicub-headless
<<: *pyicub-common
container_name: pyicub-simulation-nogui
command: ["/bin/bash", "-c", "bash ${WORKDIR:?error}/pyicub/scripts/start.sh --simulation_nogui"]
command: ["/bin/bash", "-c", "bash ${WORKDIR:?error}/pyicub/scripts/nogui.sh"]
depends_on:
pyicub-yarpserver:
condition: service_healthy

env_file:
- pyicub.env

environment:
- ICUB_APP_XML=${ICUB_APP_XML:-}

healthcheck:
test: ["CMD", "/bin/bash", "-c", "yarp exists /icubSim/head/rpc:i"]
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
profiles:
- simulation_nogui
- test

pyicub.test:
<<: *pyicub-headless
<<: *pyicub-common
container_name: pyicub-test

command: ["/bin/bash", "-c", "bash ${WORKDIR:?error}/pyicub/scripts/run_tests.sh"]

env_file:
- pyicub.env

environment:
- DISPLAY=:99

volumes:
- ./shared:/shared

depends_on:
pyicub.simulation-nogui:
condition: service_healthy

profiles:
- test

volumes:
pyicub-frontend-workspace:
name: pyicub-frontend-workspace
name: pyicub-frontend-workspace
6 changes: 1 addition & 5 deletions docker/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ set -e

source "$(dirname "$0")/setup.sh"

docker compose --profile simulation_nogui up --build -d

docker compose --profile test up --build pyicub.test

docker container stop pyicub-simulation-nogui

docker compose --profile test down --remove-orphans
docker compose --profile test down --remove-orphans
2 changes: 1 addition & 1 deletion pyicub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
__authors__ = 'Davide De Tommaso, Adam Lukomski, Nicola Russi, Enrico Piacenti, Gioele Migno, Mohammad Gharb'
__emails__ = 'davide.detommaso@iit.it, adam.lukomski@iit.it, nicola.russi@iit.it, enrico.piacenti@iit.it, gioele.migno@iit.it, mohammad.gharb@iit.it'
__license__ = 'BSD-2'
__version__ = '8.3.7'
__version__ = '8.3.8'
__description__ = 'Developing iCub applications using Python'
20 changes: 0 additions & 20 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,6 @@ ensure_ssh_key_installed() {
ssh-copy-id -o StrictHostKeyChecking=no icub@"$ICUB_HOST"
}

start_simulation() {
export DISPLAY=:99
sudo Xvfb :99 -screen 0 1024x768x24 &
sleep 1

initialize_environment
start_yarpserver_detached >/dev/null 2>&1
start_local_yarprun >/dev/null 2>&1

echo "Starting Gazebo simulation..."
gzserver ${ICUB_APPS}/gazebo/icub-world.sdf >/dev/null 2>&1 &
sleep 5

echo "Starting robot interface..."
yarprobotinterface --context gazeboCartesianControl --config no_legs.xml --portprefix /icubSim >/dev/null 2>&1 &
sleep 5

exec "$@"
}

check_existing_yarpserver() {
for i in {1..5}; do
if yarp detect --write >/dev/null 2>&1; then
Expand Down
14 changes: 14 additions & 0 deletions scripts/nogui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

source "$(dirname "$0")/common.sh"
export ICUB_NAME=icubSim
export DISPLAY=:99
sudo Xvfb :99 -screen 0 1024x768x24 &
sleep 1 # Give it time to start

initialize_environment
start_yarpserver_detached >/dev/null 2>&1
start_local_yarprun >/dev/null 2>&1

SIM_APP_XML="${ICUB_APP_XML:-${ICUB_APPS}/applications/icubSim/icub-gazebo.xml}"
yarpmanager-console --application "$SIM_APP_XML" --run --connect
7 changes: 6 additions & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ else
fi

# Check PulseAudio socket
if [[ ! -S ${XDG_RUNTIME_DIR}/pulse/native ]]; then
PULSE_SOCKET_PATH="${XDG_RUNTIME_DIR}/pulse/native"
if [[ -n "${PULSE_SERVER:-}" && "${PULSE_SERVER}" == unix:* ]]; then
PULSE_SOCKET_PATH="${PULSE_SERVER#unix:}"
fi

if [[ ! -S "${PULSE_SOCKET_PATH}" ]]; then
echo "🟡 PulseAudio socket missing. Audio via Pulse may fail."
else
echo "🟢 PulseAudio socket is ready."
Expand Down
7 changes: 0 additions & 7 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

source "$(dirname "$0")/common.sh"

MODE="${1:-}"

if [[ "$MODE" == "--simulation_nogui" ]]; then
start_simulation sleep infinity
exit 0
fi

initialize_environment
source "$(dirname "$0")/setup.sh"

Expand Down
Loading