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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 4 additions & 34 deletions .ci/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,14 @@
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e

source "/opt/ros/${ROS_DISTRO:-jazzy}/setup.bash"
source "/opt/ros/humble/setup.bash"

# Rebuild ros2_vive_controller if setup.py has changed (e.g. new entry points)
SETUP_FILE="/ros2_ws/src/ros2_vive_controller/setup.py"
SETUP_HASH_FILE="/ros2_ws/.setup_py_hash"
if [ -f "$SETUP_FILE" ]; then
CURRENT_HASH=$(md5sum "$SETUP_FILE" | awk '{print $1}')
STORED_HASH=""
[ -f "$SETUP_HASH_FILE" ] && STORED_HASH=$(cat "$SETUP_HASH_FILE")
if [ "$CURRENT_HASH" != "$STORED_HASH" ]; then
echo "Detected setup.py change, rebuilding ros2_vive_controller..."
cd /ros2_ws
colcon build --symlink-install --packages-select ros2_vive_controller
echo "$CURRENT_HASH" > "$SETUP_HASH_FILE"
fi
fi

if [ -f "/ros2_ws/install/setup.bash" ]; then
source "/ros2_ws/install/setup.bash"
fi

export RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION:-rmw_cyclonedds_cpp}
export ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-1}

# Setup steamclient symlinks
mkdir -p /root/.steam/sdk64 /root/.steam/sdk32
ln -sf /home/steam/.local/share/Steam/steamcmd/linux64/steamclient.so /root/.steam/sdk64/steamclient.so
ln -sf /home/steam/.local/share/Steam/steamcmd/linux32/steamclient.so /root/.steam/sdk32/steamclient.so

# Start vrserver directly (no compositor/monitor needed for tracker-only use)
STEAMVR_PATH="/home/steam/Steam/steamapps/common/SteamVR"
export LD_LIBRARY_PATH="$STEAMVR_PATH/bin/linux64:${LD_LIBRARY_PATH}"

if [ -d "$STEAMVR_PATH" ]; then
echo "Starting SteamVR vrserver..."
"$STEAMVR_PATH/bin/linux64/vrserver" --keepalive &
sleep 3
echo "SteamVR vrserver started."
# Optional: Log that the workspace was found
# echo "✅ Workspace sourced."
fi

exec "$@"
14 changes: 14 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
STEAM_USER=your_steam_username
STEAM_PASSWORD=your_steam_password
REGISTRY=registry.gitlab.inria.fr/eurobin-horizon/code/ros2-vive-controller
TAG=latest

# General
ROS_DOMAIN_ID=2
LINEAR_SCALE=1.75 # Scale factor for linear position, adjust as needed for your setup

# Hardware Serials
SERIAL_LEFT=LHR-97752221 # Replace with your left controller's serial number
SERIAL_RIGHT=LHR-4BB3817E # Replace with your right controller's serial number
REFERENCE_LIGHTHOUSE_SERIAL=LHB-2E7D2119 # Replace with your reference lighthouse's serial number (The one that will be used as origin)

75 changes: 75 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# --- Configuration ---
# Load variables from .env if it exists
ifneq ("$(wildcard .env)","")
include .env
export $(shell sed 's/=.*//' .env)
endif

# Default shell
SHELL := /bin/bash

# --- Phony Targets ---
.PHONY: help gui-perms build build-force push franka tiago tiago_pro g1 calibrate identify stop clean

# --- Help ---
help: ## Show this help message
@echo "Vive Controller Docker Management"
@echo "Usage: make <target>"
@echo ""
@echo "Available commands:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

# --- GUI Permissions ---
gui-perms: ## Set X11 permissions for Docker UI (used internally)
@echo "Setting X11 permissions for Docker..."
@xhost + > /dev/null

# --- Build Targets ---
build: ## Build the 'app' image (cached)
docker compose build

build-force: ## Build from scratch (no cache)
docker compose build --no-cache

push: ## Push built images to the registry
@echo "Pushing images to the configured registry..."
docker compose push

pull: ## Pull the latest pre-built images from the registry
@echo "Pulling latest images..."
docker compose pull

# --- Robot Missions ---
franka: gui-perms ## Start Franka (Single Right Controller)
docker compose --profile franka up

tiago: gui-perms ## Start Tiago Dual Arm
docker compose --profile tiago up

tiago_pro: gui-perms ## Start Tiago Pro Dual Arm
docker compose --profile tiago_pro up

g1: gui-perms ## Start G1 Dual Arm
docker compose --profile g1 up

# --- Utilities ---
calibrate: gui-perms ## Run workspace calibration
# Runs calibration inside the franka container context
docker compose --profile franka run --rm franka ros2 launch ros2_vive_controller calibration.launch.py

identify: ## Vibrate controllers to check IDs
@echo "Vibrating RIGHT controller..."
-docker exec -it ros2_vive_franka /entrypoint.sh ros2 service call /vive/right/identify std_srvs/srv/Trigger || \
docker exec -it ros2_vive_tiago /entrypoint.sh ros2 service call /vive/right/identify std_srvs/srv/Trigger || \
docker exec -it ros2_vive_tiago_pro /entrypoint.sh ros2 service call /vive/right/identify std_srvs/srv/Trigger || \
docker exec -it ros2_vive_g1 /entrypoint.sh ros2 service call /vive/right/identify std_srvs/srv/Trigger
@echo "Vibrating LEFT controller..."
-docker exec -it ros2_vive_tiago_pro /entrypoint.sh ros2 service call /vive/left/identify std_srvs/srv/Trigger || \
docker exec -it ros2_vive_g1 /entrypoint.sh ros2 service call /vive/left/identify std_srvs/srv/Trigger

stop: ## Stop all running vive containers
docker compose down

clean: ## Remove all vive containers and networks
docker compose down --remove-orphans --volumes

Loading